From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PULL 4/4] seccomp: fix blocking of setns/execveat/unshare
Date: Tue, 6 Oct 2026 09:34:51 +0100 [thread overview]
Message-ID: <20261006083451.956881-5-berrange@redhat.com> (raw)
In-Reply-To: <20261006083451.956881-1-berrange@redhat.com>
The initializer for these syscalls missed the seccomp action
field, so it got the default action which was to kill the calling
thread, instead of returning an errno value, which the other
equivalent syscalls use.
Since we don't ever intend to use a seccomp filter without a
defined action, use an assert to validate that action is always
set to non-zero.
Reported-by: Igor Santos-Grueiro (gitlab:@igorsantosgrueiro)
Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/4600
Fixes: 4638057110 (seccomp: block setns, unshare and execveat syscalls)
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
system/qemu-seccomp.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/system/qemu-seccomp.c b/system/qemu-seccomp.c
index f8e1238b914..3889d48b4f2 100644
--- a/system/qemu-seccomp.c
+++ b/system/qemu-seccomp.c
@@ -249,10 +249,13 @@ static const struct QemuSeccompSyscall denylist[] = {
0, NULL, SCMP_ACT_ERRNO(ENOSYS) },
#endif
#ifdef __SNR_execveat
- { SCMP_SYS(execveat), QEMU_SECCOMP_SET_SPAWN },
+ { SCMP_SYS(execveat), QEMU_SECCOMP_SET_SPAWN,
+ ARRAY_SIZE(clone_arg_none), clone_arg_none, SCMP_ACT_ERRNO(EPERM) },
#endif
- { SCMP_SYS(setns), QEMU_SECCOMP_SET_SPAWN },
- { SCMP_SYS(unshare), QEMU_SECCOMP_SET_SPAWN },
+ { SCMP_SYS(setns), QEMU_SECCOMP_SET_SPAWN,
+ ARRAY_SIZE(clone_arg_none), clone_arg_none, SCMP_ACT_ERRNO(EPERM) },
+ { SCMP_SYS(unshare), QEMU_SECCOMP_SET_SPAWN,
+ ARRAY_SIZE(clone_arg_none), clone_arg_none, SCMP_ACT_ERRNO(EPERM) },
/* resource control */
{ SCMP_SYS(setpriority), QEMU_SECCOMP_SET_RESOURCECTL,
0, NULL, SCMP_ACT_ERRNO(EPERM) },
@@ -337,6 +340,12 @@ static int seccomp_start(uint32_t seccomp_opts, Error **errp)
if (!(seccomp_opts & denylist[i].set)) {
continue;
}
+ /*
+ * action == 0 is SCMP_ACT_KILL_THREAD which is not
+ * something we ever want to use. Validate it to protect
+ * against missing struct field initializers
+ */
+ assert(denylist[i].action);
action = qemu_seccomp_update_action(denylist[i].action);
rc = seccomp_rule_add_array(ctx, action, denylist[i].num,
--
2.55.0
next prev parent reply other threads:[~2026-10-07 9:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 8:34 [PULL 0/4] Misc fixes patches Daniel P. Berrangé
2026-10-06 8:34 ` [PULL 1/4] hw/usb: Fix USB MTP Use-After-Free in usb_mtp_deletefn List Iteration Daniel P. Berrangé
2026-10-06 8:34 ` [PULL 2/4] io: prevent unbounded read of websocket data from client Daniel P. Berrangé
2026-10-06 8:34 ` [PULL 3/4] io: cork TLS writes to avoid small TLS records Daniel P. Berrangé
2026-10-06 8:34 ` Daniel P. Berrangé [this message]
2026-10-09 7:57 ` [PULL 0/4] Misc fixes patches Richard Henderson
2026-10-10 7:29 ` Michael Tokarev
2026-10-12 8:07 ` Daniel P. Berrangé
2026-10-12 10:07 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261006083451.956881-5-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.