Will Drewry acf3b2c71e seccomp: add SECCOMP_RET_ERRNO
This change adds the SECCOMP_RET_ERRNO as a valid return value from a
seccomp filter.  Additionally, it makes the first use of the lower
16-bits for storing a filter-supplied errno.  16-bits is more than
enough for the errno-base.h calls.

Returning errors instead of immediately terminating processes that
violate seccomp policy allow for broader use of this functionality
for kernel attack surface reduction.  For example, a linux container
could maintain a whitelist of pre-existing system calls but drop
all new ones with errnos.  This would keep a logically static attack
surface while providing errnos that may allow for graceful failure
without the downside of do_exit() on a bad call.

This change also changes the signature of __secure_computing.  It
appears the only direct caller is the arm entry code and it clobbers
any possible return value (register) immediately.

Signed-off-by: Will Drewry <wad@chromium.org>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Eric Paris <eparis@redhat.com>

v18: - fix up comments and rebase
     - fix bad var name which was fixed in later revs
     - remove _int() and just change the __secure_computing signature
v16-v17: ...
v15: - use audit_seccomp and add a skip label. (eparis@redhat.com)
     - clean up and pad out return codes (indan@nul.nu)
v14: - no change/rebase
v13: - rebase on to 88ebdda6159ffc15699f204c33feb3e431bf9bdc
v12: - move to WARN_ON if filter is NULL
       (oleg@redhat.com, luto@mit.edu, keescook@chromium.org)
     - return immediately for filter==NULL (keescook@chromium.org)
     - change evaluation to only compare the ACTION so that layered
       errnos don't result in the lowest one being returned.
       (keeschook@chromium.org)
v11: - check for NULL filter (keescook@chromium.org)
v10: - change loaders to fn
 v9: - n/a
 v8: - update Kconfig to note new need for syscall_set_return_value.
     - reordered such that TRAP behavior follows on later.
     - made the for loop a little less indent-y
 v7: - introduced
Signed-off-by: James Morris <james.l.morris@oracle.com>
2012-04-14 11:13:21 +10:00
..
2012-03-28 13:56:35 -07:00
2012-03-28 20:59:45 -07:00
2012-03-30 17:31:56 -07:00
2012-04-04 10:09:30 -07:00
2012-03-28 12:34:33 -07:00
2012-03-20 21:29:46 -04:00
2012-03-21 17:55:01 -07:00
2012-03-16 20:35:02 +00:00
2012-03-16 20:35:02 +00:00
2012-02-28 16:02:54 +01:00
2012-03-29 15:38:31 +10:30
2012-03-23 16:58:38 -07:00
2012-03-20 21:29:37 -04:00
2012-03-20 21:29:53 -04:00
2012-02-20 19:46:36 +11:00
2012-03-28 18:30:03 +01:00
2012-04-05 15:30:34 -07:00
2012-02-28 17:10:21 +00:00
2012-03-28 14:08:46 -07:00
2012-03-26 21:47:19 +02:00
2012-03-26 21:47:19 +02:00
2012-03-26 21:47:19 +02:00
2012-03-26 21:47:19 +02:00
2012-03-26 21:47:19 +02:00
2012-03-26 21:47:19 +02:00
2012-03-28 15:58:21 -07:00
2012-03-27 22:45:26 -04:00
2012-03-08 10:50:35 -08:00
2012-03-21 17:54:57 -07:00
2012-03-23 08:53:47 -07:00
2012-03-08 10:50:35 -08:00
2012-02-29 15:35:41 -06:00
2012-03-15 21:41:34 +01:00
2012-03-03 15:04:45 -05:00
2012-03-28 17:19:28 -07:00
2012-04-03 17:23:23 -04:00
2012-03-05 15:26:47 -05:00
2012-03-21 17:54:58 -07:00
2012-03-21 17:55:01 -07:00
2012-03-16 21:49:24 +01:00
2012-03-20 11:16:20 -07:00
2012-03-20 21:29:38 -04:00
2012-03-28 18:30:03 +01:00
2012-04-14 11:13:19 +10:00
2012-04-14 11:13:21 +10:00
2012-03-08 11:38:50 -08:00
2012-03-12 22:19:13 +01:00
2012-03-28 15:58:21 -07:00
2012-03-06 11:01:33 +02:00
2012-03-19 16:53:08 -04:00
2012-03-22 19:43:43 -07:00
2012-03-28 18:30:03 +01:00
2012-03-27 16:30:09 -07:00
2012-03-31 08:09:50 +05:30
2012-03-08 10:50:35 -08:00
2012-03-28 18:30:03 +01:00