Skip to content

0.24.1: preserve read-only grants under Linux confinement - #49

Merged
Sunrisepeak merged 1 commit into
mainfrom
fix/landlock-read-only-confinement
Nov 3, 2026
Merged

Sunrisepeak merged 1 commit into
mainfrom
fix/landlock-read-only-confinement

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Linux confinement in 0.24.0 is advertised for Landlock ABI 1 and 2, whose write restrictions do not cover file truncation. A process can therefore truncate an existing file in a read-only grant through truncate(2) or open(O_RDONLY | O_TRUNC) without using openkal.

Version 0.24.1 requires ABI 3 before advertising confinement or accepting a confined spawn. Unsupported kernels refuse before starting the program. The ABI probe cache also uses atomic reads and writes during concurrent first queries. Regression coverage first proves the granted file can be opened for reading, then requires both raw truncation operations to fail with EACCES and checks that the file retains its length.

Validation:

  • GCC 16.1.0: all 21 local test programs pass.
  • LLVM 22.1.8: all 21 local test programs pass.
  • A controlled policy probe on a Landlock ABI 4 host reproduces the ABI 1 policy gap: the owned 10-byte file is truncated to zero. Adding the ABI 3 restriction refuses the same operation with EACCES and preserves all 10 bytes. This tests the old policy on a current kernel; it is not an old-kernel boot test or a bypass of the current ABI 4 implementation.
  • The full CI conformance, surface and independence checks remain required. The atomic cache follows the existing process-probe atomic pattern; no successful ThreadSanitizer run is claimed because the local runtime fails during startup.

The kernel documentation describes the independent truncate permission: https://docs.kernel.org/userspace-api/landlock.html#truncating-files

Tracks mcpp-community/mcpp#885 (security and concurrency review). Existing published tags and archives remain unchanged.

Full CI run 41615764563 passes both compiler jobs, including conformance, surface and C-library independence checks, at ee4a4a1.

Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
@Sunrisepeak
Sunrisepeak merged commit 81cab91 into main Nov 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant