Add writev and shutdown to system-probe seccomp profile#2986
Merged
Conversation
Required by system-probe-lite (Rust/hyper-based) which uses vectored writes (`writev`) for HTTP responses and `shutdown(2)` to close the write half of connections. The Go-based system-probe didn't surface these as a problem because net/http buffers responses through bufio.Writer and writes them via plain `write(2)`, and the HTTP/1 keep-alive happy path used by the agent's checks never triggers a `shutdown(2)` (Go only calls `CloseWrite` in edge cases like 431 oversized headers or partially-consumed request bodies). Without this fix, the seccomp profile (defaultAction SCMP_ACT_ERRNO) returns EPERM for `writev`/`shutdown`, surfacing as "error writing a body to connection" / "error shutting down connection" in system-probe-lite logs and "EOF" on the agent's `GET /debug/stats` startup probe, preventing the discovery check from ever starting. Mirrors helm-charts#2634.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2986 +/- ##
=======================================
Coverage 40.75% 40.76%
=======================================
Files 332 332
Lines 28197 28199 +2
=======================================
+ Hits 11493 11495 +2
Misses 15929 15929
Partials 775 775
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
vitkyrka
marked this pull request as ready for review
May 7, 2026 11:06
tbavelier
approved these changes
May 7, 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.
What does this PR do?
Adds
writevandshutdownto the defaultsystem-probeseccomp profile (SCMP_ACT_ERRNOdefault), inDefaultSyscallsForSystemProbe().Motivation
Required by
system-probe-lite(Rust/hyper-based) which uses vectored writes (writev) for HTTP responses andshutdown(2)to close the write half of connections. The Go-basedsystem-probedidn't surface these as a problem becausenet/httpbuffers responses throughbufio.Writerand writes them via plainwrite(2), and the HTTP/1 keep-alive happy path used by the agent's checks never triggers ashutdown(2)(Go only callsCloseWritein edge cases like 431 oversized headers or partially-consumed request bodies).Hyper, by contrast, calls
shutdown(SHUT_WR)at the end of every served connection (proto/h1/dispatch.rs—Future::pollpassesshould_shutdown=trueand the dispatcher invokespoll_shutdownonceis_done()), and uses tokio'sAsyncWrite::poll_write_vectoredwhich translates towritev(2)— both of which the existing profile'sSCMP_ACT_ERRNOdefault rejected withEPERM.When the operator deploys an agent with
serviceDiscovery.enabled: trueand a node Agent image >= 7.78.0, the operator setsDD_DISCOVERY_USE_SYSTEM_PROBE_LITE=true, thesystem-probebinary execs intosystem-probe-lite, and hyper's firstwritevreturnsEPERM. The agent'spkg/system-probe/api/client/check.go:ensureStarted()retriesGET /debug/statsevery 5s and only ever seesEOF, blocking the discovery check from starting at all:After adding the two syscalls, both endpoints respond correctly and the discovery check runs cleanly.
Additional Notes
chown— already allowed in the operator's profile, so not needed here).writevandshutdownare not security-sensitive (basic socket I/O primitives); they are already in the upstream Docker default seccomp profile.TestDefaultSyscallsForSystemProbereferencesDefaultSyscallsForSystemProbe()directly, so it picks up the additions automatically — no test update required.Minimum Agent Versions
serviceDiscovery.enabled: truecauses the operator to setDD_DISCOVERY_USE_SYSTEM_PROBE_LITE=true)Describe your test plan
Verified end-to-end on a kind cluster (aarch64): built the operator from this branch, deployed a
DatadogAgentwithfeatures.serviceDiscovery.enabled: trueand an agent image execing intosystem-probe-lite. With the fix:kubectl exec ... -c system-probe -- curl --unix-socket /var/run/sysprobe/sysprobe.sock http://sysprobe/debug/statsreturns{}(was empty reply).Error serving connectionlog lines insystem-probe-lite.EOFwarnings on the agent'sensureStarted()probe.datadog-system-probe-seccomp) generated by the operator includes bothwritevandshutdown(191 syscalls total).Checklist
bugqa/skip-qalabel