Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 663784 - =sys-apps/firejail-0.9.54[-suid] Error mkdir: util.c:931 create_empty_dir_as_root: Permission denied
Summary: =sys-apps/firejail-0.9.54[-suid] Error mkdir: util.c:931 create_empty_dir_as_...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Hank Leininger
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2018-08-16 15:17 UTC by Nick
Modified: 2022-02-18 02:44 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info sys-apps/firejail-lts (emerge-info.txt.xz,6.37 KB, application/x-xz)
2020-03-16 14:41 UTC, inasprecali
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick 2018-08-16 15:17:09 UTC
The error occurs when running `firejail` from the terminal (with any args that I tested).

The error is fixed by re-installing with [+suid].
Comment 1 Andy Pettinger 2018-08-25 07:04:27 UTC
I can confirm the same error , which is fixed with suid flag.
Comment 2 Amadeusz Żołnowski (RETIRED) gentoo-dev 2018-10-10 20:42:15 UTC
Can you confirm bug still exists in latest version, please?
Comment 3 Karl-Johan Karlsson 2018-10-11 07:32:17 UTC
It's a different error message, but Firejail 0.9.56 still refuses to run as a regular user when built with USE="-suid":

creideiki@orley ~ $ firejail
Error: cannot create /run/firejail/profile/28807
creideiki@orley ~ $ ls -ld /run/firejail/profile/
drwxr-xr-x 2 root root 80 11 okt 09.28 /run/firejail/profile/

With USE="suid" it can create that file and runs happily.
Comment 4 Amadeusz Żołnowski (RETIRED) gentoo-dev 2018-10-11 19:22:19 UTC
What if you remove recursively "/run/firejail"?
Comment 5 Karl-Johan Karlsson 2018-10-11 19:33:58 UTC
(In reply to Amadeusz Żołnowski from comment #4)
> What if you remove recursively "/run/firejail"?

The I get the old error message:

creideiki@luna ~ $ firejail
Error mkdir: util.c:936 create_empty_dir_as_root: Permission denied

And nothing new is created in /run/firejail/. It is recreated if I run firejail as root, but is again only writeable by root.
Comment 6 Amadeusz Żołnowski (RETIRED) gentoo-dev 2018-10-11 21:03:12 UTC
Would you mind reporting this upstream? netblue30 may ask you for more info. https://github.com/netblue30/firejail/issues
Comment 7 Amadeusz Żołnowski (RETIRED) gentoo-dev 2018-10-11 21:07:10 UTC
What firejail should do, is to create "firejail" directory in "/run/user/$UID/" when run without suid or, perhaps, even always create this dir in "/run/user/$UID".
Comment 8 Evgeny Zinoviev 2018-10-21 22:52:30 UTC
I have the same error.

Has this been reported upstream? I didn't find corresponding issue on github.
Comment 10 inasprecali 2020-03-16 14:40:36 UTC
I can confirm the same exact problem after updating to the latest sys-apps/firejail-lts (firejail-lts-0.9.56.2-r1). Mind you, the *LTS* version, not the "normal" version of the package, as this bug originally referred to.  Should it be reported in a different bug?

Attaches is my output of emerge --info sys-apps/firejail-lts (it's too large to be written directly in the comment).

Please let me know if there is anything wrong with it or if it's a genuine bug.
Comment 11 inasprecali 2020-03-16 14:41:47 UTC
Created attachment 620672 [details]
emerge --info sys-apps/firejail-lts
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-03-17 18:57:01 UTC
(In reply to inasprecali from comment #10)
> I can confirm the same exact problem after updating to the latest
> sys-apps/firejail-lts (firejail-lts-0.9.56.2-r1). Mind you, the *LTS*
> version, not the "normal" version of the package, as this bug originally
> referred to.  Should it be reported in a different bug?
> 
> Attaches is my output of emerge --info sys-apps/firejail-lts (it's too large
> to be written directly in the comment).
> 
> Please let me know if there is anything wrong with it or if it's a genuine
> bug.

Just some background:
* This needs a bit more investigation.  I'm not the maintainer and I don't use firejail.

* In bug 687108, security stabilised and cleaned up firejail-lts, bringing in that new version you're seeing. There's upstream bugs linked in there with more discussion too.

* Some notes from a discussion in security (this is not advice, just thoughts for anyone who wants to pick it up):
>Question is if package should create rundir (maybe via tmpfiles).
>But if multiple user will call firejail and all are sharing same rundir, you must be careful that you don't open another vulnerability.
>Shared rundir isn't seemingly an issue if everything is run as root w/ setuid
Comment 13 Hank Leininger 2020-10-14 16:55:51 UTC
Reading this and the other linked discussions, I think --disable-suid just is not going to work in Gentoo, at least not today. There is a useful suggestion of making a firejail group and making the setuid executable 4710 instead of 4711 (possibly gated by a new USE flag, to avoid silent breaking working installs?). So my inclination would be to make USE=suid no longer optional, but add an acct-group/firejail group. How would that sit with watchers of this bug who still care? :)
Comment 14 Jan Sembera 2020-10-14 18:45:35 UTC
It seems reasonable to me, personally. But I'm just one user of this package.
Comment 15 Larry the Git Cow gentoo-dev 2022-02-18 02:44:26 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f83326db36c6215b3fb69cf9630c5e3b53d32c43

commit f83326db36c6215b3fb69cf9630c5e3b53d32c43
Author:     Hank Leininger <hlein@korelogic.com>
AuthorDate: 2022-02-07 04:40:48 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-02-18 02:38:46 +0000

    sys-apps/firejail: version bump, remove old, Gentoo compat tweaks
    
    Upstream released a security bump. Also, added some fixes and
    workarounds for bits & configs that break on Gentoo.
    
    Signed-off-by: Hank Leininger <hlein@korelogic.com>
    Bug: https://bugs.gentoo.org/832819
    Closes: https://bugs.gentoo.org/694966
    Closes: https://bugs.gentoo.org/663784
    Package-Manager: Portage-3.0.30, Repoman-3.0.3
    Closes: https://github.com/gentoo/gentoo/pull/24102
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/firejail/Manifest                         |  3 +-
 sys-apps/firejail/files/firecfg.config.patch       | 71 ++++++++++++++++
 .../firejail/files/firejail-0.9.68-envlimits.patch | 12 +++
 sys-apps/firejail/files/profile_display.local      |  2 +
 sys-apps/firejail/files/profile_patch.local        |  8 ++
 sys-apps/firejail/files/profile_pdftotext.local    |  2 +
 sys-apps/firejail/files/profile_wget.local         |  5 ++
 sys-apps/firejail/firejail-0.9.64.4.ebuild         | 99 ----------------------
 ...rejail-0.9.66.ebuild => firejail-0.9.68.ebuild} | 27 +++++-
 sys-apps/firejail/firejail-9999.ebuild             |  8 +-
 10 files changed, 128 insertions(+), 109 deletions(-)