Ofunniku / dwarftherapist

Automatically exported from code.google.com/p/dwarftherapist
Other
0 stars 0 forks source link

ptrace attach: No such process #434

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Just run compiled binary

What is the expected output? What do you see instead?
ptrace attach: No such process

What version of the product are you using? On what operating system?
Mandriva 2010

Please provide the "run.log" file in the "log" directory of DwarfTherapist
when this error occurred.
2012-???.-28 09:19:31.405 INFO  core    Dwarf Therapist "0.6.12" starting normally. 
[src/dwarftherapist.cpp:100] (setup_logging)
2012-???.-28 09:19:31.405 TRACE core    loading translations 
[src/dwarftherapist.cpp:114] (load_translator)
2012-???.-28 09:19:31.405 TRACE core    english translation loaded 
[src/dwarftherapist.cpp:118] (load_translator)
2012-???.-28 09:19:31.405 TRACE core    Creating settings object 
[src/dwarftherapist.cpp:51] (DwarfTherapist)
2012-???.-28 09:19:31.405 TRACE core    Creating options menu 
[src/dwarftherapist.cpp:53] (DwarfTherapist)
2012-???.-28 09:19:31.503 TRACE core    Creating main window 
[src/dwarftherapist.cpp:55] (DwarfTherapist)
2012-???.-28 09:19:31.558 INFO  core    Loaded 4 views from disk 
[src/viewmanager.cpp:128] (reload_views)
2012-???.-28 09:19:31.601 DEBUG core    "redrew views in 43ms" 
[src/viewmanager.cpp:160] (draw_views)
2012-???.-28 09:19:31.603 DEBUG core    setting up connections for MainWindow 
[src/mainwindow.cpp:105] (MainWindow)
2012-???.-28 09:19:31.604 DEBUG core    group_by now set to 0 
[src/models/dwarfmodel.cpp:456] (set_group_by)
2012-???.-28 09:19:31.604 TRACE core    connecting signals 
[src/dwarftherapist.cpp:59] (DwarfTherapist)
2012-???.-28 09:19:31.605 DEBUG core    beginning to read settings 
[src/dwarftherapist.cpp:122] (read_settings)
2012-???.-28 09:19:31.605 DEBUG core    finished reading settings 
[src/dwarftherapist.cpp:168] (read_settings)
2012-???.-28 09:19:31.751 DEBUG core    attempting connection to running DF game 
[src/mainwindow.cpp:216] (connect_to_df)
2012-???.-28 09:19:31.751 TRACE core    Searching for MemoryLayout ini files in 
the following directories [src/dfinstance.cpp:87] (DFInstance)
2012-???.-28 09:19:31.751 TRACE core    "/home/andrey/games/log" 
[src/dfinstance.cpp:89] (DFInstance)
2012-???.-28 09:19:31.751 TRACE core    "etc/memory_layouts/linux" 
[src/dfinstance.cpp:89] (DFInstance)
2012-???.-28 09:19:31.751 ERROR core    No valid memory layouts found in the 
following directories... () [src/dfinstance.cpp:106] (DFInstance)
2012-???.-28 09:19:31.751 TRACE core    attempting to find running copy of DF by 
executable name [src/dfinstancelinux.cpp:289] (find_running_copy)
2012-???.-28 09:19:31.765 TRACE core    FOUND PID: 0 [src/dfinstancelinux.cpp:301] 
(find_running_copy)
2012-???.-28 09:19:31.765 ERROR core    Unable to open "/proc/0/maps" 
[src/dfinstancelinux.cpp:353] (map_virtual_memory)
2012-???.-28 09:19:31.765 TRACE core    STARTING ATTACH 0 
[src/dfinstancelinux.cpp:149] (attach)
2012-???.-28 09:19:31.765 ERROR core    Could not attach to PID 0 
[src/dfinstancelinux.cpp:158] (attach)
2012-???.-28 09:19:31.765 ERROR core    Unable to open "/proc/0/mem" 
[src/dfinstancelinux.cpp:202] (read_raw)
2012-???.-28 09:19:31.765 TRACE core    STARTING DETACH 0 
[src/dfinstancelinux.cpp:182] (detach)
2012-???.-28 09:19:31.765 TRACE core    FINISHED DETACH -1 
[src/dfinstancelinux.cpp:190] (detach)
2012-???.-28 09:19:31.765 DEBUG core    base_addr: 0 HEX 0 
[src/dfinstancelinux.cpp:324] (find_running_copy)
2012-???.-28 09:19:31.768 DEBUG core    DF's checksum is "0x00000000" 
[src/dfinstancelinux.cpp:328] (find_running_copy)
2012-???.-28 09:19:31.768 INFO  core    Dwarf fortress path: 
"/home/andrey/games/log" [src/dfinstancelinux.cpp:335] (find_running_copy)

If this is a truly "crazy" issue, please also attach a copy of your save-
game.

Original issue reported on code.google.com by a.rogov...@gmail.com on 28 Aug 2012 at 6:22

GoogleCodeExporter commented 9 years ago
This is a known issue for Ubuntu (Mandriva is probably similar):

https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace_Protection

Here's an example for another program (gdb):
http://blog.mellenthin.de/archives/2010/10/18/gdb-attach-fails-with-ptrace-opera
tion-not-permitted/#comment-141535

Original comment by ian.teg...@gmail.com on 21 Sep 2012 at 2:22

GoogleCodeExporter commented 9 years ago
As a workaround, type this before running DwarfTherapist:
sudo echo 0 > /proc/sys/kernel/yama/ptrace_scope

NOTE: this disables ptrace protection for the whole system
Tested on Ubuntu 12.10

Original comment by daniel.t...@gmail.com on 17 Mar 2013 at 7:56

GoogleCodeExporter commented 9 years ago
This will only work on newer processors. In the 2.x kernel line you don't have 
the option of disabling the protection. From what I read, if Therapist could 
launch Dwarf Fortress then it would be allowed to inspect the process.

Original comment by whitc...@gmail.com on 3 Apr 2013 at 1:38

GoogleCodeExporter commented 9 years ago
Dear, I was migrated to Ubuntu 12.14 lts and forgot about that problem!!!

Original comment by a.rogov...@gmail.com on 3 Apr 2013 at 1:48

GoogleCodeExporter commented 9 years ago
whoops, instead of processors, it should be kernels

Original comment by whitc...@gmail.com on 3 Apr 2013 at 1:50

GoogleCodeExporter commented 9 years ago
hi all
i'm running pclinuxos at the moment and i have the very same ptrace issue, just 
i seem to have no yama nor ptrace config anywhere on the hard disk..

Original comment by assoluto...@gmail.com on 6 May 2013 at 10:06