pidfd monitor can watch an unrelated process after host pid reuse
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- c, macos
- Domain
- operating-systems
Research direction
Start at pidfd_monitor_thread and trace pidfd_create through the kill(hpid, 0) check and kevent() registration, then inspect how the rest of the process layer tracks host pids. Reproduce or reason through host pid reuse during that gap; done means the pidfd cannot report or wait on an unrelated process.
Written by the indexing model from the issue text.
Description
pidfd_monitor_thread checks the target with kill(hpid, 0) and then registers EVFILT_PROC on hpid, the host pid recorded when the pidfd was created. If the target exits and macOS reuses that host pid before the monitor registers, the monitor ends up watching an unrelated process. The pidfd then reports the exit of that process, or waits on it, and not on the guest's target.
The window is between pidfd_create recording the host pid and the kevent() registration succeeding, so it needs fast pid reuse and is unlikely in practice. It is not specific to the pidfd table: anything in elfuse that holds a host pid across a gap has the same exposure, so the fix may belong with however the rest of the process layer tracks host pids.
Found while reviewing #399.
- Dominant language
- C
- Stars
- 271
- Forks
- 28
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sysprog21/elfuse
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 52/100
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 48/100
Maintainers usually reply within 1 day
All issues in sysprog21/elfuse
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
EchoTools/nevr-runtime#117 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
DarkFlippers/qUnleashed#240 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
AFLplusplus/AFLplusplus#2899 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
HarbourMasters/Shipwright#7320 ·
Maintainers usually reply within 1 day