Re: ptrace(PT_DUMPCORE) permission?

2020-08-21 Thread Kamil Rytarowski
On 21.08.2020 17:10, Patrick Welche wrote:
> pbulk was idle stuck building kio at
> 
> dbus24339  0.0  0.0 182156   9644 pts/6  Il   12:45PM   0:00.04 
> /usr/pkg/bin/cmake -E cmake_autogen 
> /tmp/pkgsrc/devel/kio/work/kio-5.70.1/_KDE_build/src/urifilters/ikws/CMakeFiles/kurisearchfilter_autogen.dir/AutogenInfo.json
>   
> 
> Trying to debug:
> 
> # gcore -c cmake.core 24339
> gcore: ptrace(PT_DUMPCORE) to 24339 failed: Permission denied
> # gcore 24339
> gcore: ptrace(PT_ATTACH) to 24339 failed: No such process
> 
> Permission denied? and sure enough after that, there was no process.
> 

There is a general bug in ptrace(PT_ATTACH) that checks permissions on
behalf of the dumping process. For example, once a child sets
RLIMIT_CORE to 0, you cannot attach to it and dump the core.

> Thoughts on giving root permission? (I should have just gdb attached...)
> 

Other ptrace(2) semantics are not affected with the current NetBSD behavior.

New GDB (upcoming in base / pkgsrc), gained gdb-gcore support that uses
ptrace(PT_DUMPCORE), thus suffers from the same problem.

> 
> Cheers,
> 
> Patrick
> 




signature.asc
Description: OpenPGP digital signature


ptrace(PT_DUMPCORE) permission?

2020-08-21 Thread Patrick Welche
pbulk was idle stuck building kio at

dbus24339  0.0  0.0 182156   9644 pts/6  Il   12:45PM   0:00.04 
/usr/pkg/bin/cmake -E cmake_autogen 
/tmp/pkgsrc/devel/kio/work/kio-5.70.1/_KDE_build/src/urifilters/ikws/CMakeFiles/kurisearchfilter_autogen.dir/AutogenInfo.json
  

Trying to debug:

# gcore -c cmake.core 24339
gcore: ptrace(PT_DUMPCORE) to 24339 failed: Permission denied
# gcore 24339
gcore: ptrace(PT_ATTACH) to 24339 failed: No such process

Permission denied? and sure enough after that, there was no process.

Thoughts on giving root permission? (I should have just gdb attached...)


Cheers,

Patrick