]> git.ipfire.org Git - thirdparty/qemu.git/commit
seccomp: set the seccomp filter to all threads
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 22 Aug 2018 17:02:50 +0000 (19:02 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 2 Apr 2019 18:11:49 +0000 (13:11 -0500)
commitf43a6b314aa506afd70b56767ba704ddd5cbde2e
tree962718a772e8c383f5fbec39f5fae9db37fdc006
parent9d01327689a786beba7aabab76816f689aa2565f
seccomp: set the seccomp filter to all threads

When using "-seccomp on", the seccomp policy is only applied to the
main thread, the vcpu worker thread and other worker threads created
after seccomp policy is applied; the seccomp policy is not applied to
e.g. the RCU thread because it is created before the seccomp policy is
applied and SECCOMP_FILTER_FLAG_TSYNC isn't used.

This can be verified with
for task in /proc/`pidof qemu`/task/*; do cat $task/status | grep Secc ; done
Seccomp: 2
Seccomp: 0
Seccomp: 0
Seccomp: 2
Seccomp: 2
Seccomp: 2

Starting with libseccomp 2.2.0 and kernel >= 3.17, we can use
seccomp_attr_set(ctx, > SCMP_FLTATR_CTL_TSYNC, 1) to update the policy
on all threads.

libseccomp requirement was bumped to 2.2.0 in previous patch.
libseccomp should fail to set the filter if it can't honour
SCMP_FLTATR_CTL_TSYNC (untested), and thus -sandbox will now fail on
kernel < 3.17.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Eduardo Otubo <otubo@redhat.com>
(cherry picked from commit 70dfabeaa79ba4d7a3b699abe1a047c8012db114)
*CVE-2018-15746
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qemu-seccomp.c