Date: Mon, 25 Feb 2019 19:05:19 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 236035] ptrace: SIGTRAP and EXIT race Message-ID: <bug-236035-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236035 Bug ID: 236035 Summary: ptrace: SIGTRAP and EXIT race Product: Base System Version: 12.0-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: robert.ayrapetyan@gmail.com When tracing a process using ptrace and there are multiple threads in the tracing process hitting the same breakpoint, sometimes main thread exits (WIFEXITED(status) is TRUE) before last queued TRAP_BKPT signal(s) have been delivered to the tracing process. So a final breakpoint hits counter is less than it should be. Steps to reproduce: cd /tmp git clone https://github.com/rayrapetyan/ptrace_bug_poc.git cd ptrace_bug_poc mkdir build cd build cmake .. make Run ~20 times: /tmp/ptrace_bug_poc/build/src/ptrace_test/ptrace_test /tmp/ptrace_bug_poc/build/src/mt_example/mt_example 0x201385 ------- Note: make sure 0x201385 is a call to <printf@plt> in "/tmp/ptrace_bug_poc/build/src/mt_example/mt_example": gdb /tmp/ptrace_bug_poc/build/src/mt_example/mt_example disassemble foo ------- Wait fo appearance of: "BOOM! Invalid BP hits counter (hits: 1, tid: XXXX)" at the end of the output (most of the times it will be "SUCCESS") --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236035-227>