-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C library #38
Comments
https://github.com/gnoack/landlock-examples/blob/main/landlock_compat.h I've tried to find out what a "minimal" C library would need to look like, by growing it from the surrounding CLI tool examples. The way I see this, we have two main complications:
To determine the right ruleset, you can source a ruleset in one of these ways:
Based on these rulesets, you can build the least common denominator between these with a helper function that applies bitwise-AND on the struct. In previous versions, I've played with helper functions that do more of that at the same time, but I'm currently leaning towards exposing a bit more of Landlock's internals, but providing some more orthogonal helper functions and good documentation. The helpers offer the following things:
Apart from that, it's still slightly annoying that syscalls need to be called with And yes, I should absolutely move this into the kernel samples directory or into the landlock-lsm Github organization. :) |
Great idea! I like this
Yes, this C library should declare the Landlock syscalls with proper names.
As explain above, this C library should live close to the kernel source code, in the same Git repository, but we should make it easy to synchronize with a dedicated GitHub repository that would be used by downstream. |
While we have good libraries (e.g. Rust, Go, Haskell...) we need a C library. I'd like this library to be light and only provide a set of small helpers for common use cases (e.g. drop all access rights according to a Landlock ABI version).
We already wrote most of the mechanic with the sandboxer tool and tests, and we could move some part of this code into a standalone library.
This C library should live close to the kernel source code, in the same Git repository, because:
To ease consumption of this C library, we should also have a dedicated repository in this GitHub organization, synchronized with the code hosted by the kernel repository, similar to libbpf (but simpler).
The text was updated successfully, but these errors were encountered: