https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254661

            Bug ID: 254661
           Summary: Debug registers seem to be inherited in forked
                    processes
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

Created attachment 223712
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=223712&action=edit
fbsd-fork-dbreg.c

It seems that when a process forks, the new child process inherits debug
registers from the parent.  Not sure if this is desirable but it's certainly
different than e.g. Linux and NetBSD do (both clear dbregs in the new process).

This currently breaks e.g. GDB that doesn't account for this.  If the process
has any watchpoints set before forking, the watchpoints leak to child process
when it's being detached, and it crashes with SIGTRAP afterwards.

I'm attaching yet another variant of my cheap reproducer scriptâ„¢.  It sets
dbreg on the parent process before fork, and then reads dbreg from the child
after fork.

The results I get are:

dr0 = 0x204690   // set in parent process
dr7 = 00000013
dr0 = 0x204690   // read in child process
dr7 = 00000413

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to