Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. AI-generated posters don’t have to be horrible(john.hartnup.uk ↗)
    190comments
  2. Human brain is two separate organs, Stanford Medicine-led research finds(stanford.edu ↗)
    120comments
  3. Laya the open source version of Jev(convaiinnovations.com ↗)
    9comments
  4. “The Secret Life of Circuits” is here(coredump.cx ↗)
    29comments
  5. GPT-6 Astra Solves a WWI German Radio Cipher(prinzai.com ↗)
    87comments
  6. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    111comments
  7. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    462comments
  8. San Francisco Onion Futures Company(onionfutures.com ↗)
    78comments
  9. Communication by means of modulated Johnson noise(pnas.org ↗)
    3comments
  10. Cloudflare Quick Tunnels(cloudflare.com ↗)
    290comments
  11. Show HN: I wrote a custom assembler for CHIP-8 in C++(github.com/tackx ↗)
    discuss
  12. How to Write with an LLM(sockpuppet.org ↗)
    343comments
  13. SDCC – Small Device C Compiler(sourceforge.net ↗)
    20comments
  14. You can run Git on object storage if you re-make packfiles(tigrisdata.com ↗)
    19comments
  15. Science Is Open Software(jepedersen.dk ↗)
    40comments
  16. Saving another 100TB of RAM(cloudflare.com ↗)
    83comments
  17. Why building a Rust LSP is hard(rust-glancer.github.io ↗)
    33comments
  18. From Stonemasons to Carpenters(thelastsoftwareengineer.substack.com ↗)
    1comments
  19. Ctenophores: Wonders of Biology(quantamagazine.org ↗)
    6comments
  20. NASA-IBM Lunar Foundation open-Source Geospatial AI Model(usra.edu ↗)
    4comments
  21. How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip(ieee.org ↗)
    98comments
  22. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    108comments
  23. OpenJev(openjev.com ↗)
    273comments
  24. Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash(cactuscompute.com ↗)
    89comments
  25. Goroutine Leak Profiles(go.dev ↗)
    5comments
  26. Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug(ledger.com ↗)
    73comments
  27. Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)(arxiv.org ↗)
    14comments
  28. Warez: The Infrastructure and Aesthetics of Piracy (2021)(archive.org ↗)
    84comments
  29. Veronese's Dogs(publicdomainreview.org ↗)
    1comments
  30. Inside ZCode: Silently uploading your Git history to the cloud(ferstar.org ↗)
    103comments

Why pledge(2) or, how I learned to love web application sandboxing

108 pointsby 9y agolearnbchs.org
73 comments
9y agoHN ↗

  > allows resource requests or denies them and (hopefully) kills the application

Why is killing the application desirable behaviour over just denying the request?

9y agoHN ↗

Helps debugging.

Though a sysfs/procfs config for this would go a long way.

9y agoHN ↗

There's a school of thought in security that believes you should hard fail at any attempt to violate an invariant. I believe the linux grsec patches do this. They will just crash the kernel if they see something at runtime that they don't like.

9y agoHN ↗

Indeed; if you have the Active Kernel Exploit Response feature enabled in grsec, and a root process triggers a kernel OOPS, it will panic() the kernel.

You can combine this with the panic= kernel command-line argument to set a reboot delay, but for headed (rather than headless) boxes it may be more desirable to keep the panic message up to see what process triggered it.

9y agoHN ↗

If you detect something that can not (well, should not) ever happen, it means that state of the process is no longer within designed bounds.

The process' output can not be trusted, so it should stop processing. Detecting something you never expect to happen is almost tautologically stating the software doesn't know how to recover state.

This, of course, relies on an architecture where another process will take care of making sure an error is bubbled to the place it needs to go, pulling failsafe, etc... I will grant some environments and/or designs make this easier than others (eg. Erlang's error handling is all about letting processes die).

9y agoHN ↗

Because everyone in dev and ops ignores warnings.

Only stuff that crashes is investigated.

9y agoHN ↗

The author writes from the perspective of writing a CGI-based web app. Here, every request becomes a new OS process, so killing the application is killing the request.

9y agoHN ↗

If an application is making a request it hasn't marked as being one it is going to make, then chances are, there is a big problem that needs dealt with. In such a situation, crashing as soon as possible means that there's a better chance that all of the relevant data is there to pore through. If you just deny the call, then it could be many hundred of functions later, possibly with relevant data being freed up, and your job of picking through your program's entrails becomes all the more difficult.

9y agoHN ↗

Since the author is using cgi:

However, this is definitely something in the crosshairs of ksql(3): forking a process, like kcgi(3) does, that handles the database I/O and communicates with the master over pipes.

If they do this, then they can just use seccomp SECCOMP_SET_MODE_STRICT, which is the first thing described in the seccomp man page and in the Wikipedia page. And is also the original/first mode of seccomp to be available.

I believe capsicum would likewise be trivial to use: You can just immediately lock things down completely. (Perhaps just cap_enter() is sufficient?)

9y agoHN ↗

If a program just needs to communicate over open sockets, cap_enter() will restrict the program from opening more sockets.

But the existing fds aren't restricted. You can use caph_limit_stream(fd, CAPH_READ/CAPH_WRITE) to restrict existing sockets down to only what is needed for stdio routines.

9y agoHN ↗

SECCOMP_SET_MODE_STRICT is pretty hard to use - you cannot allocate memory for example.

9y agoHN ↗

I did not realize that. Given that, I was incorrect when I said that the author (or anyone) could easily use seccomp MODE_STRICT.

Capsicum may still be easy to use. And seccomp-bpf is not that complex either.

9y agoHN ↗

pledge(2) is great. However, BCHS sucks.

No. Do not write your webapp in C. I'm serious here. Write it in Python, write it in TCL, write it in Lisp. But write it an environment that is at least semi-manged.

FFIs are pretty good. You can call pledge from your app. But don't write your app in C. If you're doing anything serious, it's a bad idea.

9y agoHN ↗

Well... there is at least some sense in writing a webapp in C. If you rely on operating system primitives for security (processes, Unix filesystem permissions, seccomp/pledge/capsicum) instead of language features (bounds checking, garbage collection, etc.) then just maybe you could get performance gains while still being secure.

But in reality writing applications in a hosted environment/virtual machine is more performant than writing it in C and locking it down with operating system features. And of course more secure.

The author's efforts would be better spent on improving the performance of OS-based security (processes, filesystems), than attempting to use that security as it stands. There are all kinds of tricks that could be implemented to improve things...

9y agoHN ↗

If you are using CGI, then you probably already don't care about performance.

On top of that, the CPU throughput overhead of using a compiled managed language is typically less than a factor of 2, which, combined with the fact that the majority of web applications are not compute bound means the number of webapps that it would make any sense to write in C is nearly zero.

Pretty much all pithy advice (such as "Don't write your webapps in C") has an implicit exception "Unless you fully understand why I made this recommendation and have good reasons for why they don't apply."

That exception is not made explicit because 1) It would make the advice less pithy and 2) Then those who would most benefit from the advice convince themselves that it doesn't apply to them.

9y agoHN ↗

"If you are using CGI, then you probably already don't care about performance."

So...I think you're missing a few pieces of the puzzle with this statement. The statement is a truism that is right almost always, but it has exceptions, and this is one of those exceptions.

CGI is slow when startup time for your app is slow, because of a VM, because of the library loading overhead, because of environment setup, because of some thing that isn't really the fault of CGI per se. CGI can be fast, or at least fast enough, if startup time for your app is very fast. An app written in C, statically linked, could potentially start and respond faster than many dynamic language apps could even when running in an app server. C is fast. C is small. C is also particularly error-prone, would be a little verbose for web apps, and does not have a good ecosystem of support libraries for web apps, but even if running it without an app server in a CGI mode it could be fast enough for most deployments.

The CGI interface is not why CGI apps are slow. CGI apps are slow because startup of many modern language environments is slow. C is a language that doesn't have to be slow in that context. (Though, it could be faster still by using an FCGI or other app server model and having your C web app running all the time, so it just has to answer requests over a socket or whatever...though async programming in C is also hard to get right for inexperienced programmers.)

9y agoHN ↗

Huh. I wonder what the start time is on the language I'm using for CGI work. (I'm using CHICKEN, which is a compiled Scheme R5RS implementation with numerous extensions).

9y agoHN ↗

Probably fine for some things, since it is compiled, and, as I understand it is pretty fast. I don't know a lot about the internals of chicken, but since it's a Scheme wouldn't it need some kind of VM for macros and memory management and such? That'd impose some kind of startup overhead that C wouldn't have. But, then again, Perl can start fast enough for some things (though most Perl web app developers use some sort of app server, because they rely on a bunch of libraries that would increase startup time remarkably if it had to happen for every request).

Do you write command line apps with CHICKEN? Are they super fast to start, like instant (comparable to something written in C or small Perl scripts)? If so, then CGI could probably be fast enough for some use cases. If you can perceive the startup time, then no, it'd be kinda sucky when used with CGI.

9y agoHN ↗

wouldn't it need some kind of VM for macros and memory management and such?

Not a VM: it's compiled. It needs to bind to libchicken, and it needs to do some things that native C programs wouldn't.

Also, you wouldn't need a VM for macros: they're a compile-time feature, and don't even exist at runtime.

Yeah, it's not humanly noticable.

9y agoHN ↗

For what it's worth, SBCL (which essentially in all ways completely unrelated to chicken other than them both being native compiled dynamic languages) can startup a minimal runtime and exit in 3.8ms on my system. it goes up to about 5ms for a moderate sized application (which includes some dynamically linked libraries that must be loaded).

on the same system:

/bin/true starts up in 0.5ms

/usr/bin/env perl starts up in 2.4ms

/usr/bin/perl starts up in 1.8ms

If you want to run your own benchmarks, just use time and something like this small program (I ran with 1000 iterations):

    #include <sys/types.h>
    #include <sys/wait.h>
    #include <stdlib.h>
    #include <unistd.h>
    
    int main(int argc, char *argv[])
    {
        int i;
        int iter=atoi(argv[1]);
        for(i=0;i<iter;++i) {
            pid_t pid=fork();
            if(pid) {
                waitpid(pid,NULL,0);
            }
            else {
                execl(argv[2],argv[2],NULL);
            }
        }
        return 0;
    }
9y agoHN ↗

All web apps are CPU bound. At a certain point, your backend is done and it's up to the web app to compute a return value (similarly for the part that calculates the backend request). That part of the request is cpu bound.

9y agoHN ↗

just maybe you could get performance gains

Not too sure about that -- Erlang/OTP-based web applications have very good performance (and transparent scaling) with a fraction of the code of a hand-rolled C-based web application. I honestly think web applications are a place where everything but assembly is better than C.

9y agoHN ↗

If you're considering writing it in C, you probably have some reason why you don't want to use a scripting language. To that end, I'd suggest using something like Rust instead of C.

9y agoHN ↗

Maybe I'm writing it in C because I like the language, enjoy using it and am good with it? And I know it works everywhere I want it, even years later? I hate to be told what I should or shouldn't use.

9y agoHN ↗

And your users will certainly enjoy all the security issues your code will have.

9y agoHN ↗

Not the person you replied to, but I'm actually quite conflicted on this count. I enjoy C, both aesthetically and for its performance, yet I care a lot about security, so I feel obligated to avoid C for anything important. I'm a big fan of Rust, but it's nowhere near replicating what I like about C.

9y agoHN ↗

Someone with say 10-20 years of experience in a language will write a more secure program then someone just started in any language ... And even if you program in a "safe" language, you still make bugs, and all those bugs passed the compiler/parser, so your language obviously didn't help you there. There are a lot of code written in C in the wild, witch means there are also a lot of bad code.

9y agoHN ↗

There are business logic bugs, and there are memory corruption bugs. One of those leads to RCEs a lot more often than the other. One of those is a lot easier for the compiler to prevent than the other.

9y agoHN ↗

Yes, but there are ways to prevent most memory corruption bugs, even, if you're using an OS with a non-terrible malloc implementation. The gnu malloc that most people know is a terrible antiquity that should have been replaced decades ago -- mallocs like OpenBSD's make a lot of memory corruption bugs a lot harder to exploit.

9y agoHN ↗

But not harder to have exist in the first place.

9y agoHN ↗

Someone who capably sets out to write their web application back-end in C most likely is aware of any security issues. If they exist in the finished product, their presence is going to be due to laziness, not ignorance.

9y agoHN ↗

Given the fact that virtually every significant piece of C software has some sort of vulnerability in it, this comment is demonstrably false.

9y agoHN ↗

virtually every significant piece of C software has some sort of vulnerability in it

The GNU 'echo' program is pretty significant, in the sense it's installed widely, and used widely. What sort of vulnerability exists?

9y agoHN ↗

virtually, adverb [ as submodifier ] nearly; almost: the disease destroyed virtually all the vineyards in Orange County | the college became virtually bankrupt.

9y agoHN ↗

You don't get points for internet pedantry. Especially when it should be obvious that you're choosing to use a definition of "significant" that doesn't match what I was using in my comment.

9y agoHN ↗

Then you shouldn't like BCHS or pledge because the author likewise tells you that you should use it and not other things. Regardless of that, this page is all about making the web apps secure. The BCHS page talks something similar. Then, within all this, they recommend a language that goes out of its way to make apps insecure when alternatives exist that don't. Big communities behind some these days.

Recommending against C for web apps is wise in this context.

9y agoHN ↗

Then you shouldn't like BCHS or pledge because the author likewise tells you that you should use it and not other things.

What a non sequitur. That I do not like being told what to (not) use has no bearing whatsoever on whether I can like or dislike the thing that someone somewhere is advocating for or against.

9y agoHN ↗

That was partly my point. You bring up you don't like being told what you should or shouldn't use. Yet, you use a product doing exactly that of your own free will. You probably started to after someone shared a link to affect your decision-making. So, a pointless counter in reply to up-thread recommendations.

9y agoHN ↗

Do we speak a different language? Because again I just do not understand how any of what you're saying follows.

Yes, I use C. Is the programming language telling me to use this or that? No, I am telling it to do this or that.

And no, I am not using it because somebody told me to. I am using it because (as I said above), I like it, I enjoy using it, I am good with it, and feel like it's a good fit for the values I hold. Opinions shared by other people may have affected my perception, but I am not using the language because somebody tells me to.

9y agoHN ↗

Then maybe you need to do a better job of shielding yourself from other peoples' opinions? It sounds like might be a little too sensitive and temperamental to engage in mutually beneficial discourse. Please remove yourself.

9y agoHN ↗

Not even the Plan 9 People use C for web development. And the plan 9 folks _really_ like c.

9y agoHN ↗

Another choice is SaferCPlusPlus[1] (optionally with a framework like Wt[2]).

Using a higher level language (than C) arguably has the drawback of "hiding complexity" in exchange for better productivity and scalability. But languages like Rust and C++ (with SaferCPlusPlus) retain much of the intrinsic performance and memory efficiency of C, without introducing an additional runtime layer. That may allow you to employ extra (diverse) layers of sandboxing/jailing and other security/correctness solutions.

[1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus

[2] https://www.webtoolkit.eu/wt

9y agoHN ↗

BCHS needs a higher level api that is simple to use.

9y agoHN ↗

The author dismisses capsicum without much thought. Really, any application you've already restructured to be sandboxed under pledge(2) is trivial to capsicumize.

9y agoHN ↗

Do you know of any good guides for doing that? I tried capsicum at some point but got lost.

9y agoHN ↗

That is probably the reason for the quick uptake of pledge in OpenBSD's tree. A lot of their software had already been restructured or rewritten for privilege separation. But looking at a few capsicum diffs in the FreeBSD codebase I'm not sure I'd call those trivial. You can do more with capscium so there is more code to deal with those abilities. But even simple cases hit 20+ lines of code with multiple failure states to deal with. Compared to the usual two line pledge diffs that's quite a bit more work to do.

9y agoHN ↗

Compared to the usual two line pledge diffs that's quite a bit more work to do.

I don't think you're comparing apples and oranges. OpenBSD has just already done the restructuring as a separate commit; in FreeBSD you see it all at the same time, so it looks bigger. Capsicum for simple stuff is only a few lines, especially with the "helper" subroutines.

In some cases we can get more functionality with the same restriction, or more restriction than OpenBSD due to more specific constraints. So there's more code, but it also does more. It can be a trade-off.

9y agoHN ↗

That statement was comparing capsicum being applied to programs that were also pledged in around 2 lines of code. A few of the programs on the wiki as examples of capsicum applications originated from OpenBSD so they were primed and ready to go. Even those best cases are much more involved than pledge.

To use the example of the unix tr utility, the change to use pledge required the standard two line diff.

  if (pledge("stdio", NULL) == -1)
		  err(1, "pledge");

tr.c was the one of the earliest programs pledged (back when it was called tame). The original diff was a one liner before they start doing the "pledge or error out".

http://marc.info/?l=openbsd-tech&m=144070638327053

  +	tame(TAME_STDIO, NULL);

The capsicum diff required the following

https://reviews.freebsd.org/D7928 https://reviews.freebsd.org/file/data/4exxbzvuc3dayrvdj6qe/P...

  +	cap_rights_t rights;
  +	unsigned long cmd;

(...)

  +	cap_rights_init(&rights, CAP_FSTAT, CAP_IOCTL, CAP_READ);
  +	if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS)
  +		err(1, "unable to limit rights for stdin");
  +	cap_rights_init(&rights, CAP_FSTAT, CAP_IOCTL, CAP_WRITE);
  +	if (cap_rights_limit(STDOUT_FILENO, &rights) < 0 && errno != ENOSYS)
  +		err(1, "unable to limit rights for stdout");
  +	if (cap_rights_limit(STDERR_FILENO, &rights) < 0 && errno != ENOSYS)
  +		err(1, "unable to limit rights for stderr");
  +
  +	/* Required for isatty(3). */
  +	cmd = TIOCGETA;
  +	if (cap_ioctls_limit(STDIN_FILENO, &cmd, 1) < 0 && errno != ENOSYS)
  +		err(1, "unable to limit ioctls for stdin");
  +	if (cap_ioctls_limit(STDOUT_FILENO, &cmd, 1) < 0 && errno != ENOSYS)
  +		err(1, "unable to limit ioctls for stdout");
  +	if (cap_ioctls_limit(STDERR_FILENO, &cmd, 1) < 0 && errno != ENOSYS)
  +		err(1, "unable to limit ioctls for stderr");
  +
  +	if (cap_enter() < 0 && errno != ENOSYS)
  +		err(1, "unable to enter capability mode");

No one would dispute that capsicum is more capable but is significantly more complex. Pledge trades finer control over capabilities for the ability to have a "work or die" usage model. Capsicum requires that you be aware of all the potential failure cases and account for them.

9y agoHN ↗

The capsicum diff [to tr] required the following ...

This is a slightly out of date example. We've since added simplifying wrappers for stdio.

The current equivalent of if pledge("stdio", ...) / err is:

    if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
      err();

Some examples: https://reviews.freebsd.org/D8307

a "work or die" usage model

This is an option (or will shortly become an option) in capsicum.

9y agoHN ↗

Go (golang) is a great language for web applications and has comparatively small syscall coverage making it easy to sandbox with seccomp(2). It also has most of the protections of a fully managed language, makes making raw syscalls easy, and can be used without libc. If you don't use cgo or SWIG (pure Go and Go assembly are fine), building statically linked pure Go binaries without libc is just a couple of commandline flags. If you don't import the net package or a few other problematic packages, no commandline flags are required.

9y agoHN ↗

too bad you can't do it from within the application itself. some of the security-related system calls (e.g. unshare) expect the application to be single-threaded or at least require acute awareness of threading. go's automatic threading makes this difficult.

9y agoHN ↗

Apart from the 'easy to sandbox' (also debatable, as that depends way more on the functionality of the application than on what it is written in, but let's ignore that) does that matter much? pledge isn't only, or even primarily, a defense against you accidentally making syscalls you don't want to make, but a defense against malware that, having invaded your application's process, attempts to make such syscalls pretending to be you. That's code you didn't write, making the programming language choice moot.

9y agoHN ↗

Not really. An effective sandbox is restrictive. Managed languages tend to use a more limited set of system calls than non-managed languages because most libraries don't make any system calls of their own. The Go runtime and standard library use a more limited set of system calls than most alternatives, so a more limited set of sandbox filters are required.

Injected instructions are more likely to invoke their own system calls, so you are more likely to catch it if you have a more restrictive set of filters.

9y agoHN ↗

"Managed languages tend to use a more limited set of system calls than non-managed languages because most libraries don't make any system calls of their own"

I have a hard time understanding how that could be true. A library either needs to use OS functionality, or it doesn't. If it needs to, managed languages cannot avoid doing so, and if it doesn't, why would non-managed languages make them, more so since a major argument for the most popular of them, C, is performance?

The only argument I can see is that managed language libraries could use (fewer) other libraries or the runtime to make such calls. Neither decreases the number of system calls made by any program.

9y agoHN ↗

Does pledge(2) still enable its simple programming interface by allowing certain default actions based on a filesystem hierarchy layout, statically defined in the kernel/libc/somewhere? The first presented versions of tame(2) had this iirc.

9y agoHN ↗

If I followed the tech@ list properly, I believe OpenBSD has added a specialized socket type for the "dns" pledge. That allows removing the code that permit certain socket calls iif /etc/resolv.conf has been opened.

There are other things in the works related to pledge. For example, they're going to ship a native local stub resolver that will be a functional extension of libc, permitting them to remove and simplify code from libc. That would allow sandboxing networked services without necessarily requiring any filesystem access after invoking pledge, while still permitting DNS to seamlessly work even after configuration changes. (The trick is that most client resolvers, third-party and in libc, default to 127.0.0.1:53 if /etc/resolv.conf is unavailable.)

9y agoHN ↗

The difference between pledge and seccomp is not just a matter of fine-grainedness. There's some of that, but I'd say there's also a difference in philosophy: sandboxing resources versus sandboxing kernel attack surfaces.

At one end of the spectrum is the macOS sandbox, which pretty much only restricts how the process is allowed to interact with the outside world. It's not actually simplistic like the article claims; that's just the public API. If you look at the raw sandbox profiles, which Apple writes for daemons and such, it's quite fine-grained: sandbox profiles can specify which paths can be read and which can be written (with an arbitrary number of allow/deny rules, each of which can match on an arbitrary regular expression), which network ports can be opened or listened to, which preferences can be read or written, which IPC services can be accessed, and so on... there are a ton of categories. If you're on macOS, look in /usr/share/sandbox and /System/Library/Sandbox/Profiles to see what they look like. However, sandboxing only occurs when a given syscall's kernel implementation explicitly calls for it, and even the most locked-down process can access hundreds of syscalls and Mach kernel IPC calls, which based on their intended purpose should be harmless. And most of them really are harmless, but all it takes is a small oversight in one of them for an attacker to potentially corrupt memory in the kernel and gain control over the system. *

At the other end is Linux seccomp, which is designed to allow minimizing kernel attack surface. Chrome's renderer processes only get access to a tiny set of syscalls, and even the arguments to the syscalls are locked down, corresponding as closely as possible to what the process actually uses. (This is possible in part because Chrome has an unsandboxed master process that handles things like reading files for it. The renderer sandbox doesn't even allow open(2).) Thus Chrome is protected from most vulnerabilities in the Linux kernel, because there's just no way to get to the buggy code in question from within the sandbox. This isn't perfect: I've found multiple Linux kernel bugs (only one exploitable so far) that are accessible from the sandbox. And of course it doesn't make Chrome immune to privilege escalation, since attacking the kernel directly isn't the only option; IPC communication with the master process is a much larger attack surface. But that's basically unavoidable, and the situation for Chrome is still a big improvement over other operating systems. Unfortunately, as the article says, it takes quite a lot of work to adapt to new applications.

OpenBSD pledge seems somewhere in between. Unlike the other two, I don't have personal experience using it, but based on the manpage - an empty "promises" set restricts the process to _exit(2), which like seccomp should protect against kernel flaws. However, if you supply "stdio", suddenly the process gets access to 69 system calls, which is not terrible (many of the calls in the set are very basic and unlikely to contain bugs) but not as minimal as one might want. There are a bunch of random functionality lockdowns, which is good - for example, ioctl operations are locked down, "setsockopt(2) has been reduced in functionality substantially"... on the other hand, the promise categories generally seem more aligned to 'resources the program might want to access' than 'kernel API surface the program might need to use'.

Overall, definitely not bad, and I'd like to see something comparable on Linux, but I'd be more comfortable if OpenBSD also supported a more fine-grained sandbox.

* (Okay, that's a little unfair to macOS, since there are some sandbox filters that lock down kernel attack surface, such as the ioctl filter and the IOKit filters - the latter of which has been tightened over time. But that still leaves a ton of surface exposed.)

9y agoHN ↗

Would you say Chrome is more sandboxed on Linux due to seccomp than on Windows 10?

9y agoHN ↗

I'm confused about what exactly 'sandboxing' entails here. Seems to be limiting syscalls and file system interactions. But what about process heap and cpu usage? Are these handled by either seccomp or capsicum?

9y agoHN ↗

No, capsicum is a security sandbox. Resource usage is not governed by capsicum. For that you can use traditional ulimits or RCTL for finer-grained control (similar to Linux cgroups).