mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #86] Can't run 32 bit executable on a 64 bit kernel if seccomp filter is enabled #50
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#50
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 @dzamlo on GitHub (Oct 20, 2015).
Original GitHub issue: https://github.com/netblue30/firejail/issues/86
If you try to run a 32 bit executable on a 64 bit kernel with seccomp filter enabled you get a "Bad system call" message.
@netblue30 commented on GitHub (Oct 20, 2015):
syscall numbers don't match in 32bit and 64bit architectures. For example, syscall 311 is a harmless sys_set_robust_list on 32bit and a troublesome process_vm_writev on 64bit. The kernel seccomp module will shut down the process. There is no way to fix this in user space, a fix in the kernel would be necessary. Affected programs: Wine, Steam.
@dzamlo commented on GitHub (Oct 21, 2015):
I'm not really familiar with bpf/seccomp/syscall so maybe this is wrong,
but in the seccomp-bpf filter you can check the architecture and filter different syscall number depending on the architecture.
The diffuculty whould be getting all the syscall number for both architecture bot this as already be done in the libseccomp project (https://github.com/seccomp/libseccomp) (see there scmp_sys_resolver tool for example)
Here is a quick and dirty example that filter the nanosleep call on both 32 and 64 bits without filtering other syscall:
https://gist.github.com/dzamlo/1ca206e4664a2a845886
@netblue30 commented on GitHub (Oct 22, 2015):
Thank you for the code example. I am merging the text from https://github.com/netblue30/firejail/issues/87 here:
I think we can do it, but we have to be careful: some people use it on architectures such as arm or mips. Maybe we can support this only on amd64.
@dzamlo commented on GitHub (Oct 23, 2015):
I have added in the gist an example using libseccomp, a library which seem to handle all that (including x32).
I think using it is the way forward. Or at least taking some inspiration.
If we choose not to use libseccomp, I think supporting this only on amd64 is the more pragmatic choice, at least initially.
@netblue30 commented on GitHub (Oct 24, 2015):
Firejail is a SUID program, I cannot link to any external libraries!
I'll try something else. Seccomp allows us to chain multiple filters. With some modifications to VALIDATE_ARCHITECTURE, we chain two blacklist filters: the regular one for amd64 and a new one for i386. We do this only for amd64 compilations. For i386 filter we hardcode the syscall values.
@netblue30 commented on GitHub (Oct 29, 2015):
Fixed! I have a dual i386/amd64 filter running when --seccomp is enabled.