Reject non-native ABIs in ML seccomp BPF filter#3080
Draft
edsavage wants to merge 3 commits into
Draft
Conversation
The Linux seccomp filter matched only on seccomp_data.nr, so an x86_64 process could issue int 0x80 (i386) and hit number collisions — notably i386 socketcall (102) vs allowlisted x86_64 getuid (102). That opened a socket surface the policy intended to block (elastic/security#12621). Require seccomp_data.arch to match the native ABI (AUDIT_ARCH_X86_64 / AUDIT_ARCH_AARCH64) with an immediate deny on mismatch, before any nr allowlist matching. The arch check is self-contained so existing relative jump offsets in the nr allowlist are unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
3 tasks
There was a problem hiding this comment.
Pull request overview
This PR hardens the Linux seccomp-BPF syscall filter used by ML processes by rejecting non-native/compat ABIs via seccomp_data.arch before any syscall-number allowlist checks, preventing syscall-number collisions (e.g. i386 socketcall vs x86_64 getuid).
Changes:
- Add an ABI/arch gate at the start of the Linux seccomp BPF program (x86_64/aarch64).
- Update public header documentation to describe the new
seccomp_data.archrequirement. - Add a changelog entry and clarify unit-test intent/limitations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/seccomp/CSystemCallFilter_Linux.cc | Adds seccomp_data.arch check prefix to deny foreign/compat ABIs before syscall allowlist matching. |
| lib/seccomp/unittest/CSystemCallFilterTest.cc | Documents that the compat-ABI path isn’t currently exercised by the unit test. |
| include/seccomp/CSystemCallFilter.h | Documents the new native-ABI requirement for the Linux filter. |
| docs/changelog/3080.yaml | Adds changelog entry for the security hardening. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use offsetof for seccomp_data field loads and add an x86_64-only int 0x80 denial test, soft-skipped when IA32 emulation is unavailable. Co-authored-by: Cursor <cursoragent@cursor.com>
Comment on lines
+201
to
+203
| // NOLINTNEXTLINE(hicpp-no-assembler) | ||
| asm volatile("int $0x80" : "=a"(ret) : "a"(nr) : "memory"); | ||
| result = ret; |
Comment on lines
+214
to
+216
| // NOLINTNEXTLINE(hicpp-no-assembler) | ||
| asm volatile("int $0x80" : "=a"(ret) : "a"(nr) : "memory"); | ||
| return ret; |
Comment on lines
38
to
39
| //! macOs: | ||
| //! The sandbox facility is used to restict access to system resources. |
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.
Summary
Follow-up to elastic/security#12621 (HackerOne): the Linux
CSystemCallFiltermatched only onseccomp_data.nr, so an x86_64 process could issueint 0x80(i386) and hit syscall-number collisions — notably i386socketcall(102) vs allowlisted x86_64getuid(102). That opened a socket surface the policy intended to block, enabling later HotSpot Attach / JVM escalation in the reported chain.Fix
Require
seccomp_data.archto match the native ABI (AUDIT_ARCH_X86_64/AUDIT_ARCH_AARCH64) before any nr allowlist matching. Mismatch returnsEACCESimmediately. The arch check is a self-contained prefix so existing relative jump offsets in the nr allowlist are unchanged.Test plan
CSystemCallFilterTeststill passes (allowlisted ops work;std::systemblocked).int 0x80syscalls are denied under the new filter (compat-ABI path not covered by unit tests).Related: #3078 (
__setstate__pre-load), forthcoming controllerPR_SET_DUMPABLEPR.Made with Cursor