Skip to content

feat(linux): tasksmack-helper lists the processes hidepid hides, as a fixed set of their /proc files, for the probe's own parsers (#2728) - #2972

Merged
mgradwohl merged 3 commits into
mainfrom
feat/helper-hidepid-2728
Oct 26, 2026
Merged

mgradwohl merged 3 commits into
mainfrom
feat/helper-hidepid-2728

Conversation

@mgradwohl

@mgradwohl mgradwohl commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Description

Part of #2728: slices 1 and 2 of three for "processes hidden by hidepid (the helper lists them)". The maintainer chose this design: for each hidden PID, the helper returns the raw text of a fixed allow-list of /proc/<pid> files, and TaskSmack parses it with its own probe's parsers. Running the probe in the root helper was rejected.

Slice 1: the parsing seam (no behavior change for enumerate())

Slice 2: protocol v6 and the helper reader

  • ListHiddenProcesses (40): carries the PIDs TaskSmack already sees (capped at MAX_VISIBLE_PIDS, 2^18).
  • HiddenProcessesResult (57): for every other process, its target (PID plus the start time its stat names) and the text of stat, statm, status, cmdline, io and cgroup only, each capped at MAX_STRING_BYTES. cmdline has a read flag, so an unreadable one isn't mistaken for a kernel thread; a command line the flag says wasn't read is refused. The reply stops short of a frame or of MAX_HIDDEN_PROCESSES (2^14) and says it was cut.
  • Helper: HiddenProcessesRead.h opens each process's directory once and reads through that handle, so all the text comes from the process its stat names. A process that exits mid-read is left out. Windows' helper answers with an error, since Windows has no hidepid.
  • Other updates: fuzz seeds moved to v6 plus two new ones; dict (including the stale header_version_* entries); helper-handshake.py's v6 Hello; and tasksmack.md's list of what the helper answers.

Next (slice 3): BrokeredProcessProbe sends ListHiddenProcesses when capabilities() says processes are hidden and a helper session is running, builds records with processFromFiles(), and merges them in. Their FD counts and network counters then come from the existing counters read.

PR Size

🔴 Large (~700 lines across ~45 files). About half is tests, and 26 of the files are one-byte fuzz seed bumps.

Type of Change

  • New feature (non-breaking change that adds functionality)

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the project's coding standards
  • I have run clang-tidy and addressed any warnings
  • I have run clang-format on my changes
  • I have run pre-commit run --all-files or installed pre-commit hooks
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass
  • I have updated documentation as needed

Testing

TASKSMACK_REQUIRE_DISPLAY=1 TASKSMACK_REQUIRE_SDBUS=1 xvfb-run -a env -u WAYLAND_DISPLAY ctest --preset debug -j 4   # 683/683

New tests:

  • Probe: LinuxProcessProbeTest.ARecordFromTheFilesTextIsTheOneEnumerateBuilds, and …TreatsAZombieOrAnUnreadCommandLineAsEnumerateDoes.
  • Protocol: BrokerProtocolTest.HiddenProcessesRoundTripAndRefuseTooManyOrAStrayCommandLine and …HiddenProcessesPastAFrameAreCutAndSaySo.
  • Mapping: BrokerRequestMappingTest.AHiddenProcessesRequestGoesToItsReaderWithTheVisiblePids, including the error from a throwing reader and from a helper without one.
  • Reader: HiddenProcessesReadTest.*, over a fixture /proc: visible PIDs skipped, an exited process left out, an unread cmdline, a missing root.
  • Real helper: PkexecBrokerTest.TheHelperListsTheProcessesTaskSmackDoesntSee, under its enforcing seccomp filter ([Security] tasksmack-helper: add a seccomp allow-list (and maybe Landlock) after the capability drop; UID 0 + CAP_SYS_PTRACE isn't containment #2752).
  • Windows: BrokerPipeServeTest counts the new request as a read.

Additional Notes

v0.10.0, no backport. Stays a draft while my lane already has two PRs out of draft.

🤖 Generated with Claude Code

…, and processFromFiles() builds a record from text alone (#2728)

The first of three slices for listing processes hidepid hides from TaskSmack
(the maintainer chose a fixed file allow-list the helper returns as text):
stat, statm, status, io and cgroup each split into the read through the
/proc/[pid] handle, unchanged, and an apply...() on the text. The new
processFromFiles(pid, ProcFileTexts) composes those, applyCmdline() and
readProcessCommand()'s zombie rule into the record enumerate() builds, with
the FD count and network counters left for the helper's counters read.
No behavior change for enumerate().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mgradwohl mgradwohl added this to the v0.10.0 milestone Oct 26, 2026
@mgradwohl mgradwohl added enhancement New feature or request linux testing Platform agent:WSL Owned by the Linux/WSL Claude session (bug-fix conveyor) labels Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

mgradwohl and others added 2 commits October 25, 2026 20:04
…ads the processes hidepid hides as a fixed set of their /proc files (#2728)

The second of three slices: HiddenProcessesRequest names the PIDs TaskSmack
already sees; the helper lists every other process under /proc and returns,
for each, its start time and the text of stat, statm, status, cmdline, io
and cgroup only (HiddenProcessesRead.h), each capped at MAX_STRING_BYTES. The
reply stops short of a frame, or of MAX_HIDDEN_PROCESSES, and says it was cut.
Windows' helper answers it with an error (no hidepid).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation windows tooling Developer tooling, CI, editor config, and automation labels Oct 26, 2026
@mgradwohl mgradwohl changed the title refactor(linux): the probe's per-process parsers take the files' text, and processFromFiles() builds a record from text alone (#2728) feat(linux): tasksmack-helper lists the processes hidepid hides, as a fixed set of their /proc files, for the probe's own parsers (#2728) Oct 26, 2026
@mgradwohl
mgradwohl marked this pull request as ready for review October 26, 2026 01:41
@mgradwohl
mgradwohl enabled auto-merge (squash) October 26, 2026 01:41
@mgradwohl
mgradwohl merged commit 15ef0f3 into main Oct 26, 2026
25 checks passed
@mgradwohl
mgradwohl deleted the feat/helper-hidepid-2728 branch October 26, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:WSL Owned by the Linux/WSL Claude session (bug-fix conveyor) documentation Improvements or additions to documentation enhancement New feature or request linux Platform testing tooling Developer tooling, CI, editor config, and automation windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant