Skip to content

Landlock#21

Merged
ngc92 merged 3 commits intomasterfrom
defence-against-the-dark-arts-4
Mar 4, 2026
Merged

Landlock#21
ngc92 merged 3 commits intomasterfrom
defence-against-the-dark-arts-4

Conversation

@ngc92
Copy link
Collaborator

@ngc92 ngc92 commented Mar 4, 2026

restrict file-system write access

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Linux Landlock LSM sandbox (csrc/landlock.cpp) that restricts filesystem write access during untrusted kernel evaluation. The sandbox allows read access to the entire filesystem but limits writes to /tmp and /dev. It also consolidates the existing prctl hardening calls (previously in manager.cpp) into the new install_landlock() function. A new exploit test (submission_replace_torch) is added to verify that attempts to write a shadow torch.py file to the current working directory are blocked.

Changes:

  • New csrc/landlock.cpp implementing install_landlock() which sets up a Landlock ruleset (read-only everywhere, read-write in /tmp and /dev) and applies prctl hardening.
  • csrc/manager.cpp replaces the inline prctl calls with a single install_landlock() call.
  • New exploit exploits/submission_replace_torch.py and corresponding entry in exploits/run_all.py to test the defense.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
csrc/landlock.cpp New file implementing the Landlock filesystem sandbox and prctl hardening
csrc/manager.cpp Replaces inline prctl calls with install_landlock()
CMakeLists.txt Adds landlock.cpp to the build
exploits/submission_replace_torch.py New exploit testing file-write-via-cwd attack
exploits/run_all.py Registers the new exploit in the test suite

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ngc92 ngc92 merged commit 283c9b6 into master Mar 4, 2026
3 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.

2 participants