seccomp: hoist struct seccomp_data recalculation higher
authorTycho Andersen <tycho@tycho.ws>
Sun, 9 Dec 2018 18:24:11 +0000 (11:24 -0700)
committerKees Cook <keescook@chromium.org>
Wed, 12 Dec 2018 00:28:40 +0000 (16:28 -0800)
commitdb5113911abaa7eb20cf115d4339959c1aecea95
treeb9ea1290236b3ce1ac93163c929557210349f332
parentccda4af0f4b92f7b4c308d3acc262f4a7e3affad
seccomp: hoist struct seccomp_data recalculation higher

In the next patch, we're going to use the sd pointer passed to
__seccomp_filter() as the data to pass to userspace. Except that in some
cases (__seccomp_filter(SECCOMP_RET_TRACE), emulate_vsyscall(), every time
seccomp is inovked on power, etc.) the sd pointer will be NULL in order to
force seccomp to recompute the register data. Previously this recomputation
happened one level lower, in seccomp_run_filters(); this patch just moves
it up a level higher to __seccomp_filter().

Thanks Oleg for spotting this.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
CC: Kees Cook <keescook@chromium.org>
CC: Andy Lutomirski <luto@amacapital.net>
CC: Oleg Nesterov <oleg@redhat.com>
CC: Eric W. Biederman <ebiederm@xmission.com>
CC: "Serge E. Hallyn" <serge@hallyn.com>
Acked-by: Serge Hallyn <serge@hallyn.com>
CC: Christian Brauner <christian@brauner.io>
CC: Tyler Hicks <tyhicks@canonical.com>
CC: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Signed-off-by: Kees Cook <keescook@chromium.org>
kernel/seccomp.c