]> git.baikalelectronics.ru Git - kernel.git/commit
seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter()
authorOleg Nesterov <oleg@redhat.com>
Wed, 27 Sep 2017 15:25:30 +0000 (09:25 -0600)
committerKees Cook <keescook@chromium.org>
Thu, 28 Sep 2017 05:51:12 +0000 (22:51 -0700)
commit101201cca6967195df547177dce4331af8ef9cde
tree0b1d31848a156eb1008a3adb65fc716fe446153f
parent7b0a8915e98b4018bc8f48f36ef1430ffe0e58c5
seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter()

As Chris explains, get_seccomp_filter() and put_seccomp_filter() can end
up using different filters. Once we drop ->siglock it is possible for
task->seccomp.filter to have been replaced by SECCOMP_FILTER_FLAG_TSYNC.

Fixes: 6b8c2e3a572e ("seccomp, ptrace: add support for dumping seccomp filters")
Reported-by: Chris Salls <chrissalls5@gmail.com>
Cc: stable@vger.kernel.org # needs s/refcount_/atomic_/ for v4.12 and earlier
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
[tycho: add __get_seccomp_filter vs. open coding refcount_inc()]
Signed-off-by: Tycho Andersen <tycho@docker.com>
[kees: tweak commit log]
Signed-off-by: Kees Cook <keescook@chromium.org>
kernel/seccomp.c