Repository navigation
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
Conversation
…, 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>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
…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>
mgradwohl
marked this pull request as ready for review
October 26, 2026 01:41
mgradwohl
enabled auto-merge (squash)
October 26, 2026 01:41
This was referenced Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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())LinuxProcessProbe'sstat,statm,status,ioandcgroupreaders each split into the read through the/proc/<pid>handle (unchanged, caches and status re-read included) and anapply…(text)half.processFromFiles(pid, ProcFileTexts)builds a record from text alone: the same parsers,applyCmdline(), andreadProcessCommand()'s zombie rule. The FD count and network counters stay unknown for the helper's counters read (feat(linux): tasksmack-helper reads other users' FD counts and I/O bytes for the Processes table (#2728) #2938, feat(linux): tasksmack-helper's socket inodes attribute other users' connections in the Processes table (#2728) #2947) to fill. The architecture is left unknown.Slice 2: protocol v6 and the helper reader
ListHiddenProcesses(40): carries the PIDs TaskSmack already sees (capped atMAX_VISIBLE_PIDS, 2^18).HiddenProcessesResult(57): for every other process, its target (PID plus the start time its stat names) and the text ofstat,statm,status,cmdline,ioandcgrouponly, each capped atMAX_STRING_BYTES.cmdlinehas 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 ofMAX_HIDDEN_PROCESSES(2^14) and says it was cut.HiddenProcessesRead.hopens 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.header_version_*entries);helper-handshake.py's v6 Hello; and tasksmack.md's list of what the helper answers.Next (slice 3):
BrokeredProcessProbesendsListHiddenProcesseswhencapabilities()says processes are hidden and a helper session is running, builds records withprocessFromFiles(), 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
Checklist
clang-tidyand addressed any warningsclang-formaton my changespre-commit run --all-filesor installed pre-commit hooksTesting
TASKSMACK_REQUIRE_DISPLAY=1 TASKSMACK_REQUIRE_SDBUS=1 xvfb-run -a env -u WAYLAND_DISPLAY ctest --preset debug -j 4 # 683/683New tests:
LinuxProcessProbeTest.ARecordFromTheFilesTextIsTheOneEnumerateBuilds, and…TreatsAZombieOrAnUnreadCommandLineAsEnumerateDoes.BrokerProtocolTest.HiddenProcessesRoundTripAndRefuseTooManyOrAStrayCommandLineand…HiddenProcessesPastAFrameAreCutAndSaySo.BrokerRequestMappingTest.AHiddenProcessesRequestGoesToItsReaderWithTheVisiblePids, including the error from a throwing reader and from a helper without one.HiddenProcessesReadTest.*, over a fixture/proc: visible PIDs skipped, an exited process left out, an unreadcmdline, a missing root.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).BrokerPipeServeTestcounts 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