Bug 254201

Summary: ptrace(): rfork(RFSPAWN) / posix_spawn() reports fork instead of vfork (+ vfork_done)
Product: Base System Reporter: Michał Górny <mgorny>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Works As Intended    
Severity: Affects Only Me CC: emaste, kib, mhorne
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
reproducer none

Description Michał Górny 2021-03-10 18:54:29 UTC
Created attachment 223168 [details]
reproducer

If the debugged program executes rfork(RFSPAWN) or posix_spawn(), the first SIGTRAP signal reports PL_FLAG_FORKED instead of PL_FLAG_VFORKED.  This is followed by PL_FLAG_VFORK_DONE, so I guess PL_FLAG_VFORKED was desired.

I'm attaching a simple reproducer.  Confirmed on 14.0-CURRENT from end of January.
Comment 1 Konstantin Belousov freebsd_committer freebsd_triage 2021-03-10 19:12:29 UTC
PL_FLAG_VFORKED is the modifier for PL_FLAG_FORKED so they are reported both.
In your test program, 0x448 is reported in pl_flags, which means
SCX | FORKED | VFORKED.
Comment 2 Michał Górny 2021-03-10 20:08:06 UTC
Ah, indeed.  I wonder why regular vfork() has shown up as vfork in my original program but I guess doesn't matter.  Sorry for the mistake.