Repository navigation
seccomp: document 64-bit argument comparisons and fix masked-equal doc - #133
Open
ricardobranco777 wants to merge 1 commit into
Open
ricardobranco777 wants to merge 1 commit into
ricardobranco777 wants to merge 1 commit into
Conversation
kolyshkin
reviewed
Oct 16, 2026
kolyshkin
left a comment
Contributor
There was a problem hiding this comment.
LGTM overall, thank you @ricardobranco777. Left some nits
Contributor
|
@ricardobranco777 also makes sense to add a link to the same PR for the main libseccomp repo |
The kernel's seccomp filter compares the raw 64-bit argument registers, while syscalls with 32-bit argument types (e.g. the socket(2) domain) ignore the upper 32 bits. A condition such as MakeCondition(0, CompareEqual, unix.AF_NETLINK) is therefore bypassed by socket(0x100000000|AF_NETLINK, ...). Document this in MakeCondition and CompareEqual, and recommend CompareMaskedEqual with a 0xffffffff mask for 32-bit arguments. Also fix the MakeCondition comment on masked equals, which had the operand order reversed: the first value is the mask and the second is the datum. Signed-off-by: Ricardo Branco <rbranco@suse.de>
ricardobranco777
force-pushed
the
doc-cmp-upper-bits
branch
from
October 16, 2026 07:22
f88716e to
8b58554
Compare
Author
Hopefully fixed now. |
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.
The kernel's seccomp filter compares the raw 64-bit argument registers, while syscalls with 32-bit argument types (e.g. the socket(2) domain) ignore the upper 32 bits. A condition such as
MakeCondition(0, CompareEqual, unix.AF_NETLINK)
is therefore bypassed by socket(0x100000000|AF_NETLINK, ...).
Document this in MakeCondition and CompareEqual, and recommend CompareMaskedEqual with a 0xffffffff mask for 32-bit arguments.
Also fix the MakeCondition comment on masked equals, which had the operand order reversed: the first value is the mask and the second is the datum.
See seccomp/libseccomp#504