aboutsummaryrefslogtreecommitdiff
path: root/src/xz/sandbox.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-02-26Build: Fix Linux Landlock feature test in Autotools and CMake builds.Jia Tan1-1/+1
The previous Linux Landlock feature test assumed that having the linux/landlock.h header file was enough. The new feature tests also requires that prctl() and the required Landlock system calls are supported.
2024-02-23xz: Fix Capsicum sandbox compile error.Jia Tan1-2/+2
user_abort_pipe[] was still being used instead of the parameters.
2024-02-22xz: Landlock: Fix error message if input file is a directory.Lasse Collin1-1/+14
If xz is given a directory, it should look like this: $ xz /usr/bin xz: /usr/bin: Is a directory, skipping The Landlock rules didn't allow opening directories for reading: $ xz /usr/bin xz: /usr/bin: Permission denied The simplest fix was to allow opening directories for reading. While it's a bit silly to allow it solely for the error message, it shouldn't make the sandbox significantly weaker. The single-file use case (like when called from GNU tar) is still as strict as possible: all Landlock restrictions are enabled before (de)compression starts.
2024-02-17xz: Use stricter pledge(2) and Landlock sandbox.Lasse Collin1-0/+32
This makes these sandboxing methods stricter when no files are created or deleted. That is, it's a middle ground between the initial sandbox and the strictest single-file-to-stdout sandbox: this allows opening files for reading but output has to go to stdout.
2024-02-17xz: Support Landlock ABI version 4.Lasse Collin1-5/+20
Linux 6.7 added support for ABI version 4 which restricts TCP connections which xz won't need and thus those can be forbidden now. Since the ABI version is handled at runtime, supporting version 4 won't cause any compatibility issues. Note that new enough kernel headers are required to get version 4 support enabled at build time.
2024-02-17xz: Move sandboxing code to sandbox.c and improve Landlock sandbox.Lasse Collin1-0/+295
Landlock is now always used just like pledge(2) is: first in more permissive mode and later (under certain common conditions) in a strict mode that doesn't allow opening more files. I put pledge(2) first in sandbox.c because it's the simplest API to use and still somewhat fine-grained for basic applications. So it's the simplest thing to understand for anyone reading sandbox.c.