mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3948] firejail --join=foobar fails with Error: cannot read /proc file #2468
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#2468
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 @simonfxr on GitHub (Feb 6, 2021).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3948
Bug and expected behavior
After updating firejail to 0.9.64.2 trying to join a firejail (either by name or by pid) always fails with:
Reproduce
Steps to reproduce the behavior:
firejail --noprofile --name=foobar /bin/bashfirejail --join=foobar /bin/bash, it fails withEnvironment
Additional context
Other context about the problem like related errors to understand the problem.
Checklist
https://github.com/netblue30/firejail/issues/1139)--profile=PROFILENAMEis used to set the right profile.LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 PROGRAMto get english error-messages.browser-allow-drm yes/browser-disable-u2f noinfirejail.configto allow DRM/U2F in browsers.@fjthrowaway commented on GitHub (Feb 24, 2021):
I can confirm the problem, it's still an issue with kernel 5.11
5.10.12 was the last working kernel
@fjthrowaway commented on GitHub (Feb 26, 2021):
Found a workaround.
Add "lsm=lockdown,yama,apparmor" to /etc/default/grub (GRUB_CMDLINE_LINUX)
then update grub: sudo grub-mkconfig -o /boot/grub/grub.cfg
This will disable bpf (was enabled by default in 5.10.13 on Arch).
@simonfxr commented on GitHub (Feb 27, 2021):
@fjthrowaway I tried your workaround and is working for me as well, thanks a lot!
@ghost commented on GitHub (Jul 19, 2021):
UPDATE: seems like the workaround is no longer needed on the latest Arch Linux kernel (5.12.15-arch1-1). The
cannot read /proc fileerror is gone. Instead there's a new error thrown -process ID out of range- but joining seems to be working regardless:@simonfxr @fjthrowaway Can you confirm these observations? I realize this isn't a proper fix, but at least disabling
bpfis no longer needed (which IMO constitutes a bit of progress).@smitsohu Anything that can be done to drop that new error message?
@smitsohu commented on GitHub (Jul 19, 2021):
Good question. When we print
Child process initialized in n.n mswe are mostly done with the sandbox and about to hand over to the sandboxed application, so it looks like bash or a tool invoked by bash prints the error.Can you reproduce the message with
firejail --shell=none --join=foobar /bin/shor--shell=different_shell?Maybe the all lower case error message already points in some direction...
@smitsohu commented on GitHub (Jul 19, 2021):
Stupid me, that's
ps. It is coming from here:https://gitlab.com/procps-ng/procps/-/blob/v3.3.17/ps/parser.c#L83-L92
Question is why
psis called with an invalid pid.@ghost commented on GitHub (Jul 22, 2021):
Running that doesn't show the error message. So it looks like
bashtriggers it somehow. Didn't find the time to really debug this further for now. But thanks for providing hints to do that in the very near future.@ferreum commented on GitHub (Feb 18, 2022):
I'm still seeing this problem on Arch Linux with kernel 5.16.9-arch1-1 and firejail version 0.9.68, with the same reproduction steps as OP. Same symptoms, only printing this:
It seems to be related to apparmor. If I remove the
security=apparmorkernel parameter I can join other jails just fine.Interestingly, apparmor profiles don't seem to matter: If I run
aa-teardown, or reboot without loading them, joining still results in the same error, as long assecurity=apparmoris in the kernel command line.To double-check,
aa-statusdoesn't list anything besides the module being loaded:These are my active LSM when joining doesn't work:
Without
security=apparmor, when joining works, only the apparmor module is removed from lsm.@ghost commented on GitHub (Feb 18, 2022):
According to the Arch wiki
capabilityshould be omitted. Additionally apparmor needs to come before bpf in the lsm=foo,bar,blah param, at least that's how I understand both the wiki page and kernel documentation. Have you tried addinglsm=landlock,lockdown,yama,apparmor,bpfyet (in that order)?@ferreum commented on GitHub (Feb 18, 2022):
Thanks @glitsj16, that helped me fix it! I replaced
security=apparmorwithlsm=landlock,lockdown,yama,apparmor,bpfand I can now use--joinwhile having apparmor enabled. My/sys/kernel/security/lsmis nowcapability,landlock,lockdown,yama,apparmor,bpf. Shows it's wise to stick with the Arch wiki instructions.My mistake was not using
lsm=at all, so I didn't statecapability. Thecapabilitymodule is always returned by/sys/kernel/security/lsmaccording to the docs.security=apparmorunfortunately results in the wrong order.At the risk of going off topic in my defence, the
lsm=parameter was where I started out. Eventually I triedsecurity=apparmorinstead, because that's what the kernel.org pages described everywhere without mentioninglsm=at all, and things seemed to work fine despite the changed order. Of course I didn't notice the--joinissue until much later. I saw an advantage in not restating the whole list; I guess withlsm=, if the default list changes in the future, we would end up excluding modules that would otherwise be loaded? The wiki also only states apparmor has to be the first "major" module, but the kernel.org page linked as reference didn't help me understand which are major modules. It doesn't mention the importance of bpf in particular. Also, I somehow completely overread the Kconfig link…Anyways, it seems this issue is resolved now, or does anyone else have this issue with
--join?@ghost commented on GitHub (Feb 20, 2022):
That's indeed a fair observation. I retested this with a few different kernels on Arch Linux and without explicitly adding the lsm= kernel param AppArmor is not active (even though the module is loaded). As of writing the current default does not include apparmor - regardless of having
apparmor=1 security=apparmor:You can always write a simple shell script that checks /sys/kernel/security/lsm on login and notify-send's a warning if apparmor is missing/not in the appropriate order. Very hackish, but sometimes such is life... At least you'll be aware of the situation and can act appropriately.
IMO we can close this for now. There's a known workaround and people can always reopen when the problem turns up again.