Repository navigation
feat(linux): the Processes table lists the processes hidepid hides while the helper runs (#2728) - #2979
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>
…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>
…ile the helper runs (#2728) The third slice: IProcessProbe gains processFromFiles() (ProcFileTexts moves to ProcessTypes.h; LinuxProcessProbe's is the override), and BrokeredProcessProbe, when the probe's capabilities say processes are hidden and a helper session is running, sends ListHiddenProcesses with the PIDs it sees, builds each hidden process's record from its files' text, keeps it only when its start time matches the helper's, and appends it before the counters read, which then fills its FD count, I/O and network like any refused process's. A helper that answers with an error isn't asked again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ile the helper runs (#2728) The third slice: IProcessProbe gains processFromFiles() (ProcFileTexts moves to ProcessTypes.h; LinuxProcessProbe's is the override), and BrokeredProcessProbe, when the probe's capabilities say processes are hidden and a helper session is running, sends ListHiddenProcesses with the PIDs it sees, builds each hidden process's record from its files' text, keeps it only when its start time matches the helper's, and appends it before the counters read, which then fills its FD count, I/O and network like any refused process's. A helper that answers with an error isn't asked again. 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 |
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: slice 3 of 3 for "processes hidden by hidepid (the helper lists them)", after #2972 (the parsing seam, protocol v6 and the helper reader). With this, the Processes table lists the processes hidepid hides from TaskSmack whenever a helper session is running.
IProcessProbe::processFromFiles(pid, ProcFileTexts): a new optional virtual (defaultnullopt).ProcFileTextsmoves toProcessTypes.h, andLinuxProcessProbe's method from 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 becomes the override.BrokeredProcessProbe::enumerate()→listHiddenProcesses(): runs when the inner probe'scapabilities().missingPrivilegeshasPROCESSES_HIDDENand a helper is already running (callIfIdle, 1 s timeout; never prompts). It:ListHiddenProcesseswith the PIDs the probe saw;A helper that answers with an error isn't asked again.
processFromFilesforwards to the inner probe.FAQ: the hidepid paragraph says the helper shows hidden processes while it runs, and which files it reads.
PR Size
✅ Small to medium (~170 lines, 9 files).
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, with a
MockProcessProbe::setProcessFromFileshook:BrokeredProcessProbeTest.ProcessesHidepidHidesAreListedByTheHelperAndJoinTheList:…NothingHiddenOrAHelperThatRefusesMeansNoListing: nothing is asked when nothing is hidden, and a helper that answers with an error is asked once.Additional Notes
v0.10.0, no backport. The rest of #2728's Linux list is service actions through the helper. That needs a design call, because the helper's seccomp filter (#2752) forbids the new socket a D-Bus connection to systemd needs, so I'll raise it with the maintainer before writing code.
🤖 Generated with Claude Code