36 ms·
Newbie question: For porting to Linux, can't you just remove (#ifdef out, or something) the pledge and unveil calls? You would no longer get the guarantees, but
by tom_mellior 7y ago
Newbie question: For porting to Linux, can't you just remove (#ifdef out, or something) the pledge and unveil calls? You would no longer get the guarantees, but aren't these similar to assertions in that once you have a well-tested program you can have some certainty that you wouldn't violate the pledges?
- hsaliak 7y agoThe goal of something like pledge/unveil is to harden a carefully written program from being exploited, so it has a role to play at runtime. Asserts are used for program invariants, so checking them at runtime is less important. So the big problem with ifdefing them out is that you no longer get these guarantees. Linux has seccomp that is similar in functionality, so the guarantees can be ported over - it's just going to take effort.
- wahern 7y agoseccomp doesn't support file paths, while pledge and unveil do. That makes a huge difference.