The inherent fragility of seccomp()
The inherent fragility of seccomp()
Posted Nov 10, 2017 22:45 UTC (Fri) by juliank (guest, #45896)In reply to: The inherent fragility of seccomp() by luto
Parent article: The inherent fragility of seccomp()
One problem with ENOSYS is that you can get weird behaviour in programs due to them not checking errors properly. It's much easier to detect issues when trapping, you can even write a signal handler that writes the blocked syscall to stdout (well, to fd 1 :D) [or just look at a backtrace]. My approach would be too have a list of syscalls, mark the good ones, add traps for all other syscalls in the list, and return -ENOSYS from all other (new) syscalls (or EINVAL for stuff like prctl). This way you have a defined baseline. You can even regularly trap new syscalls if you continue maintaining the software.
The backtrace thing with the trap signal is especially useful for stuff like NSS modules and preloaded libraries.