mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3219] Crashes with an AMD GPU with Mesa >= 19.3.4 and seccomp #2019
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#2019
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 @creideiki on GitHub (Feb 11, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3219
Since not long ago (I unfortunately don't have exact dates or versions for when it happened, but I think it started with Firefox 72.0.2), Firefox hangs at startup under Firejail. This happens on two machines with AMD GPUs, but not on three others with Intel GPUs. All five systems are running up-to-date Gentoo Linux unstable.
Trying on a completely empty profile directory, Firefox gets a little bit through its startup:
And then hangs. The process tree in the sandbox looks like this:
And all threads in the GPU process are hung:
As are the ones in the main Firefox process:
I'm not going to be able to do any deeper debugging for the next couple of days, but if nobody else can reproduce it I'll start looking at older versions of Firefox and removing Firejail profile options this weekend.
@creideiki commented on GitHub (Feb 11, 2020):
firejail --noprofile firefoxworks.@creideiki commented on GitHub (Feb 12, 2020):
Firefox 73.0 hangs in the same way.
@Vincent43 commented on GitHub (Feb 12, 2020):
Please try with various
--ignoreflags likefirejail --ignore=seccomp firefox,firejail --ignore=nogroups firefox,firejail --ignore=nonewprivs firefoxand so on. You may also try multiple--ignoreat once.@leogx9r commented on GitHub (Feb 12, 2020):
I've confirmed that disabling seccomp via
firejail --ignore=seccomp firefoxsuccessfully restores the old (intended) behavior.Edit: Tested this with v73.0
@Vincent43 commented on GitHub (Feb 13, 2020):
@leogx9r you had same issue as OP related to amd gpu on gentoo?
@leogx9r commented on GitHub (Feb 13, 2020):
Same issue, different OS. I've experienced this on Arch Linux.
It works fine with NVIDIA GPUs so I'd imagine it may be a kernel bug or an updated package causing it as it only started happening recently, as in within the past week to two.
To further add on to this issue, when using seccomp, startup takes around 10-15 seconds on an SSD in contrast to just under 2 seconds and GPU compositing fails, falling back to basic CPU rendering.
You can check this via
about:support-> Graphics -> Features -> Compositing: "Basic" instead of using WebRender.@Ropid commented on GitHub (Feb 14, 2020):
This behavior showed up for me in Arch right now with Mesa 19.3.4. It works fine if I downgrade Mesa packages to 19.3.3, so I'm thinking the problem is related to a change in Mesa 19.3.4.
@creideiki commented on GitHub (Feb 14, 2020):
On 2020-02-14 12:57, Ropid wrote:
Good catch! I don't have one of my failing systems with me at the
moment, but glancing at the Mesa Git repo between 19.3.3 and 19.3.4
shows me
ed271a9c2fwhich introduced a call to
kcmp, which looks to be blocked by thedefault seccomp rules:
Does it work on Mesa 19.3.4 if you start Firefox with
firejail --ignore=seccomp '--seccomp=!kcmp,!chroot' firefox?@rusty-snake commented on GitHub (Feb 14, 2020):
Yes, it is blocked:
https://github.com/netblue30/firejail/blob/master/etc/templates/syscalls.txt#L36
I don't think that this works,
firejail '--seccomp=!kcmp' firefoxshould be enough to add the exception.@creideiki commented on GitHub (Feb 14, 2020):
On 2020-02-14 13:47, rusty-snake wrote:
I tried that, but that still uses the seccomp rules from the profile:
And
firejail --seccomp.print=$PIDclaims it's still blocked.Compare with this:
@leogx9r commented on GitHub (Feb 14, 2020):
This indeed fixes the issue with the latest mesa version.
@creideiki commented on GitHub (Feb 14, 2020):
I can confirm that
firejail --ignore=seccomp '--seccomp=!kcmp,!chroot' firefoxfixes my original problem as well, on Mesa 20.0.0_rc2.@creideiki commented on GitHub (Feb 21, 2020):
Looking at the Mesa source code, only the AMDGPU code calls
kcmp()as of version 20.0.0. I'm not sure under what circumstances, though - I've tried some OpenGL games and applications, and the only one (besides Firefox) I've seen callkcmp()is VLC.Would the best way forward be inserting
seccomp !kcmpin any profiles where it is an actual problem, or removingkcmpfrom the default list of blocked syscalls?@rusty-snake commented on GitHub (Feb 21, 2020):
Possible all profiles without
no3dare affected?find no no3d
@rusty-snake commented on GitHub (Mar 4, 2020):
FYI: #3267
@SkewedZeppelin commented on GitHub (Mar 19, 2020):
I can reproduce this with many profiles under Fedora 32, which ships Mesa 20.0.1.
@SkewedZeppelin commented on GitHub (Mar 26, 2020):
Here is a hacky patch to use in the meantime
https://gist.github.com/SkewedZeppelin/300447ea70be8aef106b8d8602881134
A proper solution will need to be put in place
@smitsohu
@topimiettinen
@topimiettinen commented on GitHub (Mar 27, 2020):
Instead of allowing kcmp(), would it work to make it return ENOSYS (or EPERM) instead? Manual page mentions that kcmp() is not always available (needs CONFIG_CHECKPOINT_RESTORE), so the drivers should handle that case.
Though if kcmp() is considered safe (comparison of resources of two processes owned by the same user does not seem very dangerous), I wouldn't mind if it was removed.
@Vincent43 commented on GitHub (Mar 27, 2020):
It would be great to change seccomp filter to use EPERM/ENOSYS globally. I think KILL was proven unsustainable at this point and security difference is quite negligible. Moreover if we're going to allow syscalls that cause issues then KILL is less secure in the end.
@creideiki commented on GitHub (Mar 27, 2020):
The problem with that is that the call was introduced to fix a memory leak: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3202
Yes, this makes Mesa's use of it very weird, but I haven't had the time to raise that issue with them.
@topimiettinen commented on GitHub (Mar 27, 2020):
Agreed, also systemd has made the change. I'll make a PR.
@topimiettinen commented on GitHub (Mar 27, 2020):
See #3301.
@rusty-snake commented on GitHub (Jun 4, 2020):
We can remove the kcmp exception from profiles again, since we now EPERM instead of KILL programs.
@ghost commented on GitHub (Jun 4, 2020):
@rusty-snake I count only 3 profiles that currently use !kcmp: dnscrypt-proxy, steam and unbound. I'll test dnscrypt-proxy and unbound but I have never used steam. Can you test that please?
@rusty-snake commented on GitHub (Jun 5, 2020):
I'm not using it either.
@SkewedZeppelin commented on GitHub (Jun 6, 2020):
Even with EPERM this is not fixed.
Vanilla firejail at
821dd6c9on Fedora 32 using AMDGPU graphics breaks many programs.Firefox, Evolution, etc.
I am using https://gist.github.com/SkewedZeppelin/300447ea70be8aef106b8d8602881134 on my personal builds
@kmk3 commented on GitHub (Oct 28, 2020):
I can confirm. Firejail 0.9.64 on Artix using AMDGPU breaks Steam (see #3267)
unless I override the default syscall whitelist with the syscall blacklist
suggested by @rusty-snake:
For reference, this is what it looks like on 19.3.4 (it hasn't changed too much
as of 20.2.1):
Indeed, but since 20.1.1 it seems that other drivers might also be affected:
And the list appears to be increasing...
Has anyone tested seccomp on i965/iris with Mesa >= 20.1.1?
@rusty-snake commented on GitHub (Dec 23, 2020):
What about adding
!kcmptoseccompif noarg_no3dand a AMD-GPU is detected.no3dcomes beforeseccompin profiles.@topimiettinen commented on GitHub (Dec 24, 2020):
Wouldn't it be simpler to skip detecting AMD GPU and allow
kcmpif there's nono3d, or just always allowkcmp? It can be added manually to profiles for extra hardening.@rusty-snake commented on GitHub (Jan 5, 2021):
Since I know that
kcmpis used in chromiums ozone backend (wayland), what would be the drawback on this?@smitsohu commented on GitHub (Jan 6, 2021):
Maybe there could be an option in firejail.config to automatically append syscalls to the default
seccompfilter?This way people could easily return to the current behaviour.
@rusty-snake commented on GitHub (Apr 27, 2021):
Over year and we don't even have a hotfix ...