[PR #7129] [MERGED] modif: stop following symlinks to /dev/null on disable #6331

Closed
opened 2026-05-05 10:54:55 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netblue30/firejail/pull/7129
Author: @kmk3
Created: 4/10/2026
Status: Merged
Merged: 4/17/2026
Merged by: @kmk3

Base: masterHead: nofollow-dev-null-symlinks


📝 Commits (1)

  • 362e177 modif: do not follow symlinks to /dev/null on disable

📊 Changes

6 files changed (+101 additions, -10 deletions)

View changed files

📝 src/firejail/fs.c (+26 -10)
📝 src/man/firejail-profile.5.in (+7 -0)
📝 src/man/firejail.1.in (+7 -0)
test/fs/devnull_symlink (+1 -0)
test/fs/disable-devnull-symlink.exp (+57 -0)
📝 test/fs/fs.sh (+3 -0)

📄 Description

When trying to prevent a file or directory in the user home from being
written to, it is not uncommon to replace it with a symlink to
/dev/null.

If this path is also blacklisted (such as by disable-common.inc), the
symlink will be followed, resulting in /dev/null itself being
blacklisted, which can cause issues with (unrelated) programs that have
their output redirected to /dev/null (for example).

To avoid disabling /dev/null, when applying commands from
disable_file() (such as blacklist and read-only), if a file is a
symlink to /dev/null, avoid following the symlink and perform the
operation on the link itself instead.

Using these commands with "/dev/null" directly as the argument (that is,
without going through a symlink) should still work the same way.

It has been confirmed to work on Linux 3.8[1], so it should work on at
least 3.8 and later.

Closes #5803.

[1] https://github.com/netblue30/firejail/pull/7129#issuecomment-4233141574

Reported-by: @fgpietersz
Suggested-by: @Changaco
Tested-by: @Changaco
Tested-by: @Zopolis4


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netblue30/firejail/pull/7129 **Author:** [@kmk3](https://github.com/kmk3) **Created:** 4/10/2026 **Status:** ✅ Merged **Merged:** 4/17/2026 **Merged by:** [@kmk3](https://github.com/kmk3) **Base:** `master` ← **Head:** `nofollow-dev-null-symlinks` --- ### 📝 Commits (1) - [`362e177`](https://github.com/netblue30/firejail/commit/362e177ea9656fb69f3e53898ea0311c886bd963) modif: do not follow symlinks to /dev/null on disable ### 📊 Changes **6 files changed** (+101 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `src/firejail/fs.c` (+26 -10) 📝 `src/man/firejail-profile.5.in` (+7 -0) 📝 `src/man/firejail.1.in` (+7 -0) ➕ `test/fs/devnull_symlink` (+1 -0) ➕ `test/fs/disable-devnull-symlink.exp` (+57 -0) 📝 `test/fs/fs.sh` (+3 -0) </details> ### 📄 Description When trying to prevent a file or directory in the user home from being written to, it is not uncommon to replace it with a symlink to /dev/null. If this path is also blacklisted (such as by disable-common.inc), the symlink will be followed, resulting in /dev/null itself being blacklisted, which can cause issues with (unrelated) programs that have their output redirected to /dev/null (for example). To avoid disabling /dev/null, when applying commands from `disable_file()` (such as `blacklist` and `read-only`), if a file is a symlink to /dev/null, avoid following the symlink and perform the operation on the link itself instead. Using these commands with "/dev/null" directly as the argument (that is, without going through a symlink) should still work the same way. It has been confirmed to work on Linux 3.8[1], so it should work on at least 3.8 and later. Closes #5803. [1] https://github.com/netblue30/firejail/pull/7129#issuecomment-4233141574 Reported-by: @fgpietersz Suggested-by: @Changaco Tested-by: @Changaco Tested-by: @Zopolis4 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 10:54:55 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#6331
No description provided.