Skip to content

feat(linux): tasksmack-helper's socket inodes attribute other users' connections in the Processes table (#2728) - #2947

Merged
mgradwohl merged 9 commits into
mainfrom
feat/helper-socket-owners-2728
Oct 26, 2026
Merged

mgradwohl merged 9 commits into
mainfrom
feat/helper-socket-owners-2728

Conversation

@mgradwohl

Copy link
Copy Markdown
Owner

Description

Part of #2728 (Linux helper coverage, after #2938): with the helper held, the Processes table's Net Sent and Net Received now cover other users' processes. The probe attributes each connection by mapping socket inodes to PIDs through /proc/<pid>/fd links. Another user's links are refused, so those connections stayed unowned and the columns read unavailable.

  • Protocol v5: ProcessCountersRequest::withSockets (one byte, 0 or 1). Each ProcessCountersEntry carries socketInodes behind a third flags bit (4). Any other flag bit, or inodes without that bit, is refused. Inodes are capped at MAX_COUNTER_SOCKET_INODES (2^18) across the whole reply; an entry that would pass the cap goes back without its sockets but keeps its other figures.
  • Helper: readProcessCountersAt(..., withSockets) reads every fd link through the same /proc/<pid> handle, after the start-time check. socketsRead is set only when the listing finished and no link was refused.
  • Probe: BrokeredProcessProbe asks for sockets at the inner inode map's cadence (INODE_PID_CACHE_TTL_MS), not on every refresh, and only for processes whose network counters were refused (and only when the probe has network counters). readSocketTraffic() credits the connections the inner map left unowned to the helper's owners, with their start time. Between asks, the last read's processes keep their network columns. Like feat(linux): tasksmack-helper reads other users' FD counts and I/O bytes for the Processes table (#2728) #2938, it only uses a helper that's already running, never prompts, and stops asking after an ErrorReply.
  • Other updates: fuzz seeds moved to v5 (the two counters seeds rewritten for the new layout), the dict, helper-handshake.py's v5 Hello, and docs in tasksmack.md and the FAQ.

PR Size

⚠️ Medium (~285 lines added, 40 files). Most of the file count is the 24 one-byte fuzz seed version 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

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

New or changed tests:

  • BrokerProtocolTest: the withSockets round trip and its 0/1 byte; the sockets flag bit; inodes refused without it; AnEntryWhoseSocketsWouldPassTheCapGoesWithoutThem.
  • ProcessCountersReadTest.WithSocketsListsTheInodeOfASocketItHolds, which opens a socket and finds its st_ino.
  • BrokeredProcessProbeTest.TheHelpersSocketInodesAttributeConnectionsTheProbeLeftUnowned: one ask, attribution of the matching inode only, no second ask before the cadence, and the attribution still standing.
  • PkexecBrokerTest...ProcessCounters now asks for sockets from the real helper 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), so the link reads are covered by the allow-list.

Additional Notes

v0.10.0, no backport. Still to do for #2728 on Linux: hidepid listing through the helper, service actions, and the title bar's text.

🤖 Generated with Claude Code

mgradwohl and others added 8 commits October 25, 2026 10:23
…tes for the Processes table (#2728)

Protocol v4 adds a batched ReadProcessCounters request: one round trip for
every process whose handle count or /proc/[pid]/io the probe was refused.
The helper checks each target's start time, counts /proc/[pid]/fd and parses
/proc/[pid]/io with the parser LinuxProcessProbe now shares
(ProcIoParser.h), leaving out a target that has gone or been reused.

BrokeredProcessProbe asks only while a helper session is already held
(callIfIdle, 1 s timeout), never prompts, and stops asking after an
ErrorReply from an older helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…2728)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… read (#2728)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing seccomp filter (#2728, #2752)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…connections in the Processes table (#2728)

Protocol v5: ReadProcessCounters can ask for each process's socket inodes
(withSockets), and each entry carries them behind a third flags bit, capped at
MAX_COUNTER_SOCKET_INODES over the reply. The helper reads every
/proc/[pid]/fd link for them after the start-time check.

BrokeredProcessProbe asks for sockets at the inode map's cadence
(INODE_PID_CACHE_TTL_MS), for the processes whose links were refused, and
readSocketTraffic() credits the connections the probe's own map left unowned
to them, with their start time. Between asks the last read's processes keep
their network columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ers; tidy (#2728)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mgradwohl mgradwohl added this to the v0.10.0 milestone Oct 25, 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 25, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling Developer tooling, CI, editor config, and automation labels Oct 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

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

Scanned Files

None

@mgradwohl
mgradwohl enabled auto-merge (squash) October 25, 2026 22:56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mgradwohl
mgradwohl disabled auto-merge October 26, 2026 00:04
@mgradwohl
mgradwohl enabled auto-merge (squash) October 26, 2026 00:04
@mgradwohl
mgradwohl merged commit b6af7a5 into main Oct 26, 2026
24 checks passed
@mgradwohl
mgradwohl deleted the feat/helper-socket-owners-2728 branch October 26, 2026 00:28
mgradwohl added a commit that referenced this pull request Oct 26, 2026
… pinned clang-format, as CI does (#3022) (#3023)

It used the PATH clang-format, which can differ from the mirrors-clang-format
rev CI pins (#2947 passed it locally with 22.1.2 and failed CI's 22.1.8). With
pre-commit installed the hook now runs its clang-format hook on the file;
without it, it falls back to the PATH binary and says so.

Fixes #3022

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant