Repository navigation
codegen: reject x32 syscalls in x86_64 filters (fixes #19) - #50
Open
Saransh-Jainbu wants to merge 1 commit into
Open
Saransh-Jainbu wants to merge 1 commit into
Saransh-Jainbu wants to merge 1 commit into
Conversation
x32 syscalls report AUDIT_ARCH_X86_64 like native x86_64 ones and are only distinguished by __X32_SYSCALL_BIT in nr. seccomp(2) requires filters to reject that bit explicitly; kafel did not, so on kernels with x32 enabled a DEFAULT ALLOW deny-list could be bypassed by issuing the same syscall through the x32 ABI. Kill x32 syscall numbers the same way an untargeted architecture is handled, while letting nr == -1 through to the regular rules (tracers use it to skip a syscall and filters are re-run after tracing), matching libseccomp. Fixes google#19
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This branch has not been deployed
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.
x32 syscalls report
AUDIT_ARCH_X86_64, just like native x86_64 ones, and are told apart only by__X32_SYSCALL_BIT(0x40000000) innr.seccomp(2)says a filter must reject that bitexplicitly. kafel didn't check it, so on a kernel with x32 enabled, a denylist policy
(
DEFAULT ALLOWwithDENY/ERRNOrules) could be bypassed by calling the same syscallthrough the x32 ABI.
Before, with
POLICY p { DENY { ptrace } } USE p DEFAULT ALLOW:Here x32 ptrace (
0x40000209) is ALLOWed.After:
nr == -1still goes through the normal rules, so its result is unchanged. Tracers use -1 toskip a syscall, and filters are re-run after tracing. libseccomp makes the same exception.
x32_abi_rejectedtest. It fails without the change (the x32 syscall getsSECCOMP_RET_ALLOW) and passes with it. It runs on any x86_64 kernel, because seccomp seesnrbefore the kernel rejects x32 when the x32 ABI is disabled. All 36 tests pass.
This affects nsjail's shipped
DEFAULT ALLOWconfigs (apache, firefox, chromium, telegram, znc, ...).I'll send a submodule bump to nsjail once this lands.