Skip to content
  • Kees Cook's avatar
    seccomp: split filter prep from check and apply · c8bee430
    Kees Cook authored
    
    
    In preparation for adding seccomp locking, move filter creation away
    from where it is checked and applied. This will allow for locking where
    no memory allocation is happening. The validation, filter attachment,
    and seccomp mode setting can all happen under the future locks.
    
    For extreme defensiveness, I've added a BUG_ON check for the calculated
    size of the buffer allocation in case BPF_MAXINSN ever changes, which
    shouldn't ever happen. The compiler should actually optimize out this
    check since the test above it makes it impossible.
    
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    Reviewed-by: default avatarOleg Nesterov <oleg@redhat.com>
    Reviewed-by: default avatarAndy Lutomirski <luto@amacapital.net>
    c8bee430