Skip to content

Commit

Permalink
bugfix: do not interact with dbus directory if dbus proxy is disabled
Browse files Browse the repository at this point in the history
Fix a failing assert when running `firejail` inside:
`firejail --chroot=somedir --noprofile`

firejail: ../../src/firejail/util.c:1039: create_empty_dir_as_root:
Assertion `(s.st_mode & 07777) == (mode)' failed.

The assert is checking whether the newly created `/run/firejail/dbus`
empty directory, has the correct mode set, which in this case is `0755`.
The issue is that, since the directory already exists and has the mode
`0400`, because of the first ran chroot command, the assert fails.

This commit circumvents this issue, by making `firejail` ignore the dbug
directory entirely, in the `src/firejail/preproc.c` file when compiling
the project using `configure --disable-dbusproxy`.
There's also really no need for `firejail` to care about that directory
if `--disable-dbusproxy` is used.
  • Loading branch information
powerjungle committed Feb 1, 2025
1 parent 1a576d1 commit c011879
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/firejail/preproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ void preproc_build_firejail_dir_locked(void) {
// only root should be able to lock files in this directory
create_empty_dir_as_root(RUN_FIREJAIL_SANDBOX_DIR, 0700);

#ifdef HAVE_DBUSPROXY
create_empty_dir_as_root(RUN_FIREJAIL_DBUS_DIR, 0755);
fs_remount(RUN_FIREJAIL_DBUS_DIR, MOUNT_NOEXEC, 0);
#endif

create_empty_dir_as_root(RUN_RO_DIR, S_IRUSR);
fs_remount(RUN_RO_DIR, MOUNT_READONLY, 0);
Expand Down

0 comments on commit c011879

Please sign in to comment.