Hacker News new | ask | show | jobs
by badalex 3881 days ago
For fun I made a perl web app use this. Much simpler than systace or seccomp.

I use the path argument as simple form of chroot(2). Previously I had to create a vnd (think loopback device if you are coming from linux) to chroot nicely. On code updates, some process had to rsync static assets into the chroot (I preload all of the needed perl, then chroot()). On linux, the same app uses containers/namespaces. Leveraging read only bind mounts for static assets, seccomp, and various prctrl fiddling. All that ends up being a few hundred lines of code. With pledge is really just a few lines to call the syscall. Much easier to reason about.

Even if you end up having to allow most syscalls, the path argument alone IMHO makes it worth it.