Bug 254201 - ptrace(): rfork(RFSPAWN) / posix_spawn() reports fork instead of vfork (+ vfork_done)
Summary: ptrace(): rfork(RFSPAWN) / posix_spawn() reports fork instead of vfork (+ vfo...
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-10 18:54 UTC by Michał Górny
Modified: 2021-03-10 20:08 UTC (History)
3 users (show)

See Also:


Attachments
reproducer (2.82 KB, text/plain)
2021-03-10 18:54 UTC, Michał Górny
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.