Hacker News new | ask | show | jobs
by ptx 19 days ago
Just as another point of comparison, FreeBSD's version seems somewhere in-between. It also enables a Capsicum sandbox before processing any data, akin to what the OpenBSD version does with pledge.

[1] https://github.com/freebsd/freebsd-src/blob/main/usr.bin/yes...

2 comments

Difference is that capsicum is after the fact and mostly about file descriptors. You need to open them in advance and _then_ call capsicum. But it does nothing about syscalls.

Capsicum is really nice if you plan ahead, but pledge/unveil is easy to drop into any existing code base.

Your blog isn't loading at the moment, so I'm not entirely sure what you mean here, but...

> capsicum is after the fact

After the fact in what sense? The program enters capability mode before touching any arguments or doing I/O. You have to set things up before enter capability mode because you can't escape out of it afterwards.

> it does nothing about syscalls

It does quite a lot about syscalls, in that it blocks or limits most of them. As the man page says: "Access to system calls in capability mode is restricted: some system calls requiring global namespace access are unavailable, while others are constrained."

In capability mode, you can use specific syscalls that operate on file descriptors, which limits the program to the specific capabilities it has been granted, e.g. pdkill(2) which is like kill(2) except you can only signal processes for which you have a process descriptor.

And yes, I went into that a while ago on my blog (https://blog.wollwage.com/2026/20260212-daily-source-reading...)