[GH-ISSUE #6088] The tracing mechanism does not always properly handle an existing ld.so.preload file #3172

Open
opened 2026-05-05 09:47:56 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @mardy on GitHub (Nov 14, 2023).
Original GitHub issue: https://github.com/netblue30/firejail/issues/6088

Firejail version: 0.9.72

If the user has a non-empty file /etc/ld.so.preload in his/her host machine, and it doesn't contain a whitespace at the end, firejail will generate an invalid /etc/ld.so.preload file inside the sandbox, that will have the last existing path concatenated with the tracing library, with no spaces in between. The result is that neither library will be loaded.

I can provide a patch to fix this, but first I'd like to know if the preferred approach is just to unconditionally add a newline (or a space) before adding our tracing library, or if you prefer to seek to the end of the ld.so.preload file, check whether the last character is a whitespace, and only in that case add a space (I'd vote for the first option -- less code and headaches).

Originally created by @mardy on GitHub (Nov 14, 2023). Original GitHub issue: https://github.com/netblue30/firejail/issues/6088 Firejail version: 0.9.72 If the user has a non-empty file `/etc/ld.so.preload` in his/her host machine, and it doesn't contain a whitespace at the end, firejail will generate an invalid `/etc/ld.so.preload` file inside the sandbox, that will have the last existing path concatenated with the tracing library, with no spaces in between. The result is that neither library will be loaded. I can provide a patch to fix this, but first I'd like to know if the preferred approach is just to unconditionally add a newline (or a space) before adding our tracing library, or if you prefer to seek to the end of the `ld.so.preload` file, check whether the last character is a whitespace, and only in that case add a space (I'd vote for the first option -- less code and headaches).
gitea-mirror added the
needinfo
label 2026-05-05 09:47:56 -06:00
Author
Owner

@kmk3 commented on GitHub (Nov 14, 2023):

If the user has a non-empty file /etc/ld.so.preload in his/her host
machine, and it doesn't contain a whitespace at the end, firejail will
generate an invalid /etc/ld.so.preload file inside the sandbox, that will
have the last existing path concatenated with the tracing library, with no
spaces in between. The result is that neither library will be loaded.

By "doesn't contain a whitespace at the end" do you mean that the original file
is missing a line terminator (0x0a) at the end or that it actually needs an
extra space (0x20)?

Please provide a hexdump of the original file and of the one that firejail
generates.

Example:

xxd /etc/ld.so.preload
<!-- gh-comment-id:1810237020 --> @kmk3 commented on GitHub (Nov 14, 2023): > If the user has a non-empty file `/etc/ld.so.preload` in his/her host > machine, and it doesn't contain a whitespace at the end, firejail will > generate an invalid `/etc/ld.so.preload` file inside the sandbox, that will > have the last existing path concatenated with the tracing library, with no > spaces in between. The result is that neither library will be loaded. By "doesn't contain a whitespace at the end" do you mean that the original file is missing a line terminator (0x0a) at the end or that it actually needs an extra space (0x20)? Please provide a hexdump of the original file and of the one that firejail generates. Example: ```sh xxd /etc/ld.so.preload ```
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#3172
No description provided.