https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291504
Bug ID: 291504
Summary: ptrace(2) doesn't trace Linux system calls made from
pthreads in Linux processes, and unreliably traces
Linux clone3 sub-processes
Product: Base System
Version: 15.0-CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: [email protected]
Reporter: [email protected]
Created attachment 266020
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=266020&action=edit
testcase.tgz
See the attached testcase.
prog.c (the Linux process) creates 1 pthread and 1 clone3 child.
It calls the 'openat' function:
1. 5 times from the main thread
2. 5 times from the pthread
3. 5 times from the clone3 sub-process
The ptrace log contains:
1. 5 instances of the openat from the main thread (as expected)
2. 0 instances of the openat from the pthread (problem#1: 5 are expected)
3. <5 instances of the openat from the clone3 sub-process (problem#2: 5 are
expected)
The testcase assumes that the 'chroot-linux' script is the the path. Otherwise
you need to build prog manually for Linux.
In my case the log (in the tarball) has these ptrace log lines showing 5+0+2
openat calls with /bogus/ path (should have been 5+5+5):
> PTRACE: [#1] Detected openat syscall (entry) - pathname='/etc/ld.so.cache'
> PTRACE: [#1] openat syscall exit - returned 4
> PTRACE: [#2] Detected openat syscall (entry) - pathname='/lib64/libc.so.6'
> PTRACE: [#2] openat syscall exit - returned 4
> PTRACE: [#3] Detected openat syscall (entry) - pathname='/bogus/bogus-main'
> PTRACE: [#3] openat syscall exit - returned -2
> PTRACE: [#4] Detected openat syscall (entry) - pathname='/bogus/bogus-main'
> PTRACE: [#4] openat syscall exit - returned -2
> PTRACE: [#5] Detected openat syscall (entry) - pathname='/bogus/bogus-main'
> PTRACE: [#5] openat syscall exit - returned -2
> PTRACE: [#6] Detected openat syscall (entry) - pathname='/bogus/bogus-main'
> PTRACE: [#6] openat syscall exit - returned -2
> PTRACE: [#7] Detected openat syscall (entry) - pathname='/bogus/bogus-main'
> PTRACE: [#7] openat syscall exit - returned -2
> PTRACE: [#8] Detected openat syscall (entry) - pathname='/bogus/bogus-clone3'
> PTRACE: [#8] openat syscall exit - returned -2
> PTRACE: [#9] Detected openat syscall (entry) - pathname='/bogus/bogus-clone3'
> PTRACE: [#9] openat syscall exit - returned 0
> PTRACE: [#10] Detected openat syscall (entry) - pathname='/dev/random'
> PTRACE: [#10] openat syscall exit - returned 4
> PTRACE: PID 22119 exited with status 0
--
You are receiving this mail because:
You are the assignee for the bug.