News for hackers. Stuff that matters.
Re:Landrun: Sandbox any Linux process using Landlock, no roo... by __turbobrew__ on Saturday March 22, 2025 @03:19PM (#43447930)
> but nobody uses it because the API is ... hard!

OpenBSD really got it right with pledge and unveil.

Re:Landrun: Sandbox any Linux process using Landlock, no roo... by gnoack on Saturday March 22, 2025 @04:00PM (#43448213)
OpenBSD did get it right, but they also have a more relaxed scheme for backwards compatibility across releases. Linux's strict ABI compatibility guarantees complicate matters slightly, but with the right supporting library it becomes tolerable.

See the example at the top of the Readme at https://github.com/landlock-lsm/go-landlock

(Full disclosure, I am the author of that library)

FWIW, I do hope that we can motivate people to use Landlock in the same way as people use pledge on OpenBSD, as a lightweight self-sandboxing mechanism that requires fewer architectural changes to your program and results in more constrained sandboxes than Linux namespaces and other mechanisms do.

Re:Landrun: Sandbox any Linux process using Landlock, no roo... by __turbobrew__ on Saturday March 22, 2025 @04:31PM (#43448402)
As far as I know the ABI for pledge and unveil really haven’t changed since release? What is stopping linux from creating NEW security primitives which are easy to use? We have wireguard in the linux kernel as a recent addition. Wireguard shows that new simple primitives can be added to the kernel, it requires someone with “good taste” to do the implementation without sacrificing usability.
Re:Landrun: Sandbox any Linux process using Landlock, no roo... by l0kod on Saturday March 22, 2025 @05:44PM (#43448884)
BSD systems ship a kernel and user space, which simplifies a lot of things. Linux is more flexible but it comes at a cost. Adding new security features can also be challenging for other reasons. Anyway, Landlock is one of these new security primitives, and it is gaining new features over time.

The Landlock interface must not change the underlying semantic of what is allowed or denied, otherwise it could break apps build for an older or a newer kernel. However, these apps should still use all the available security features. This is challenging.

Landlock provides a way to define fine-grained security policies. I would not say the kernel interface is complex (rather flexible), but what really matter are the user space library interfaces and how they can safely abstract complexity.

Re:Landrun: Sandbox any Linux process using Landlock, no roo... by __turbobrew__ on Saturday March 22, 2025 @06:37PM (#43449210)
I know how linux and bsd work. I still have yet to find a satisfactory answer to why linux cannot create security primitives which are useful — like wireguard. I understand that landlock tries to abstract complexity, but why do we need to design complex user interfaces? Pledge and unveil are just simple syscalls, there is no magic secret sauce on BSDs which enable these syscalls. It is true that bsd userspace has been compiled to bake in plege and unviel syscalls, but that is totally separate from the usability of the interfaces.
Re:Landrun: Sandbox any Linux process using Landlock, no roo... by l0kod on Saturday March 22, 2025 @08:00PM (#43449715)
For instance, with Pledge, the "dns" promise is implemented with hardcoded path in the kernel. Linux is complex because it is versatile and flexible. Controlling access to such features requires some complexity and the kernel might not be enough.

About interfaces, another example is that Unveil is configured with path names but Landlock uses file descriptors instead (more flexible).

Also, these OpenBSD primitives only apply to the current executed binary, there is no nested sandboxes because the goal is not to create this kind of secure environment but mainly to secure a trusted binary.

Re:Landrun: Sandbox any Linux process using Landlock, no roo... by mkj on Sunday March 23, 2025 @12:46AM (#43450955)
For a given linux libc function (what a program calls), the underlying kernel syscall might change over time or vary for other reasons. Since the landlock/seccomp filters are at the kernel level, that breaks programs which only interact with libc calls and don't expect different behaviour.
Re:Landrun: Sandbox any Linux process using Landlock, no roo... by yellowapple on Sunday March 23, 2025 @01:18AM (#43451047)
The underlying kernel syscall should never change, though, right? Pretty sure that's the sort of userspace-backwards-compatibility-breaking change that would result in one of Linus' famous angry emails.
Re:Landrun: Sandbox any Linux process using Landlock, no roo... by mkj on Sunday March 23, 2025 @01:51AM (#43451123)
Things like clock_gettime64() to handle dates past 2038.

Calling clock_gettime() in libc will call the newer syscall (assuming __TIME_BITS=64 is set). But Linux has kept backwards compat, old programs can still call the old syscall.

If you wrote your seccomp rule for your program before clock_gettime64 existed, it'd break when glibc switched. I guess that implies each language stdlib should have their own seccomp etc wrappers.

For landlock, the equivalent is that glibc reads various files in /etc varying per libc version or system settings, so landlock rules need to account for that.

Re:Landrun: Sandbox any Linux process using Landlock, no roo... by __turbobrew__ on Sunday March 23, 2025 @04:25PM (#43455634)
> Since the landlock/seccomp filters are at the kernel level

That arguably shows that seccomp is operating at the wrong abstraction level, or the kernel needs another higher level api. With pledge, you operate on capabilities and as new functionality is added to the kernel it is categorized under existing capabilities (for example, if your program pledges not to use networking you can assume that it should not be able to use new networking syscalls added to the kernel in the future).

Re:Landrun: Sandbox any Linux process using Landlock, no roo... by l0kod on Tuesday March 25, 2025 @01:08PM (#43473546)
Seccomp is not an access control system, but Landlock is. Seccomp limits the kernel attack surface and Landlock enforces an access control. They are complementary.

With Landlock, the access control is at the right layer, and the semantic is guaranteed to be the same even if the kernel gets new syscalls. Landlock is the closest thing to Pledge/Unveil we can get with the Linux constraints (and it is gaining new features).

Re:Landrun: Sandbox any Linux process using Landlock, no roo... by mulle_nat on Saturday March 22, 2025 @04:14PM (#43448290)
I have been using https://github.com/marty1885/landlock-unveil on Linux for about two years now on my stock Ubuntu kernel. I am not sure, why this hasn't become more popular. It's also rootless sandboxing (and it does `unveil` like OpenBSD I guess). I use it to confine builds of third party software with success.
Re:Landrun: Sandbox any Linux process using Landlock, no roo... by bjconlan on Saturday March 22, 2025 @07:57PM (#43449696)
This is where I need to shout out to everyone's favorite developer Justine for keeping Linux cool:

https://justine.lol/pledge/

Which also points to landlock-make[0] or vice-versa (the original project that made me aware of the kernel functionality (although didn't realize it also isolated network which is great).

[0]https://justine.lol/make/

Re:Landrun: Sandbox any Linux process using Landlock, no roo... by charcircuit on Saturday March 22, 2025 @11:37PM (#43450719)
I disagree. Android's model of starting with a strong sandbox and having apps request permission to acces things outside of it has been much more successful in getting apps to be sandboxed.

Defaults are important.

Re:Landrun: Sandbox any Linux process using Landlock, no roo... by zzo38computer on Saturday March 22, 2025 @11:42PM (#43450747)
I think that isn't good enough either (but at least they tried).

My operating system design is: programs start with nothing other than the ability to perform deterministic computation and to send/receive messages with the capabilities it receives in the initial message. It is not allowed to know what these capabilities refer to; they may be proxies set up by the user, network resources, or something else, and is not necessarily what it asked for. All I/O including the ability to determine the current date/time or how much time has passed, requires the use of capabilities. (Due to this, a program with no capabilities left can be terminated automatically by the operating system (unless a debugger is attached; it is also necessary that the program cannot notice the debugger attached to it), since it is no longer capable of any I/O.)

Re:Landrun: Sandbox any Linux process using Landlock, no roo... by charcircuit on Sunday March 23, 2025 @12:26AM (#43450902)
Is argue it is good enough, but yes it could have gone farther. But ultimately permissions for things like audio would be automatically granted so in the end you end up around the same place.