mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3933] different seccomp behavior with and without arguments #2459
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2459
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fissie on GitHub (Jan 30, 2021).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3933
Bug and expected behavior
There is a discrepancy in behavior between when "seccomp" and "seccomp something" is used in the profile. It appears as if "seccomp" always defaults to killing the process on hitting the forbidden system call, while "seccomp !chroot" (for example) defaults to using EPERM. Not only is this confusing and undocumented (and per earlier discussion in my pull request #3930, also a bug).
Expected: the difference between "seccomp" and "seccomp !chroot" should only be that one syscall.
Observed: the difference is that all syscalls return, instead of killing the binary.
If I use "seccomp !chroot" and --seccomp-error-action=kill, then the behavior is identical (although the compiled seccomp code is different, but that's a result of the optimizer).
No profile and disabling firejail
No difference (see below)
Reproduce
run $ firejail --audit --seccomp --noprofile echo blah
checking syscalls: mount... umount2... ptrace... swapon... swapoff... init_module... delete_module... chroot... pivot_root... iopl... ioperm...
run $ firejail --audit '--seccomp=!chroot' --seccomp-error-action=kill --noprofile echo blah
GOOD: seccomp BPF enabled.
checking syscalls: mount... umount2... ptrace... swapon... swapoff... init_module... delete_module... chroot...
UGLY: chroot syscall permitted.
pivot_root... iopl... ioperm...
run $ firejail --audit '--seccomp=!chroot' --noprofile echo blah
checking syscalls: mount...
UGLY: mount syscall permitted.
umount2...
UGLY: umount2 syscall permitted.
ptrace...
UGLY: ptrace syscall permitted.
swapon...
UGLY: swapon syscall permitted.
swapoff...
Profit. Now the reality is that the syscalls in case 3 are not really permitted, because the audit binary only detects the killing case, and not the eperm case, but it shows the difference.
Environment
Gentoo, firejail version 0.9.64
debug output
@topimiettinen commented on GitHub (Jan 30, 2021):
Could you test #3934?
@fissie commented on GitHub (Jan 30, 2021):
Much better, but still some bit left. Now the output of all combinations is optimized and looks similar, and --seccomp and --seccomp=X gives the same output (with EPERM). However, with plain --seccomp still ignores --seccomp-error-action=kill and always goes for EPERM.
@topimiettinen commented on GitHub (Feb 1, 2021):
It looks like the pre-built filters (which always use the default error action) are used, there's a bug in a check.
@topimiettinen commented on GitHub (Feb 1, 2021):
I think it should be fixed now, can you test again?
@fissie commented on GitHub (Feb 1, 2021):
Looks good now, thanks!