Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

pidfd monitor can watch an unrelated process after host pid reuse

Open
#401 0 comments 0 reactions 0 assignees View on GitHub

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

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

bug

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sysprog21/elfuse

All issues in sysprog21/elfuse

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.