Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 08 Nov 2020 15:01:53 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 250954] ptrace(): weird ordering between inheriting debug registers and reporting a new thread
Message-ID:  <bug-250954-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D250954

            Bug ID: 250954
           Summary: ptrace(): weird ordering between inheriting debug
                    registers and reporting a new thread
           Product: Base System
           Version: 12.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: mgorny@gentoo.org
                CC: emaste@freebsd.org, kib@FreeBSD.org

Disclaimer: I'm not sure if it's a bug or just a surprising behavior.  Plea=
se
consider the following case:

1. The debugger enables reporting new threads via PT_SET_EVENT_MASK.

2. Debugged program creates a thread (e.g. via pthread_create() or
std::thread).

3. Debugged program is stopped immediately afterwards (e.g. due to breakpoi=
nt).

Now, I can reliably reproduce that the kernel reports the breakpoint (trace
trap) *before* the new thread.  However, it seems that the thread is already
created at this point -- if the debugger alters debug registers in the main
thread, the new thread has the previous value.

Is dbreg inheritance something we want programmers to rely on?

--=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-250954-227>