4 ms·
Special casing 0-byte executables is not necessarily the best solution, either. It's a special case after all, and one that's essentially only there to support
by anyfoo 8y ago
Special casing 0-byte executables is not necessarily the best solution, either. It's a special case after all, and one that's essentially only there to support /bin/true. This may create security gotchas or inadvertent bugs resulting from the "codeless" address space that gets created (or not created if you implement it that way, with its own set of potential gotchas). I'm not saying it necessarily does create problems, but it can.
- temac 8y agoAnd it would actually change the historical and current behavior of exec returning ENOEXEC for 0 bytes executables (see also https://news.ycombinator.com/item?id=19081124 https://news.ycombinator.com/item?id=19081124 ) . So I am changing my mind: a binary true is better. I still prefer truths as small as possible, though :)
- burfog 8y agoIt can be an extra-special 0-byte executable though, running far faster than anything else, like so: /proc/bin/true /proc/bin/false The exec doesn't even need to create page tables or run any non-kernel code. This is a benchmark-winning design.