Blame SOURCES/kvm-seccomp-fix-killing-of-whole-process-instead-of-thre.patch

c687bc
From 08dc2a4dc481916fae9597220ad0faf3f6ed70c1 Mon Sep 17 00:00:00 2001
c687bc
From: Eduardo Otubo <otubo@redhat.com>
c687bc
Date: Mon, 16 Nov 2020 15:15:38 -0500
c687bc
Subject: [PATCH 1/5] seccomp: fix killing of whole process instead of thread
c687bc
MIME-Version: 1.0
c687bc
Content-Type: text/plain; charset=UTF-8
c687bc
Content-Transfer-Encoding: 8bit
c687bc
c687bc
RH-Author: Eduardo Otubo <otubo@redhat.com>
c687bc
Message-id: <20201116151538.22254-1-otubo@redhat.com>
c687bc
Patchwork-id: 99654
c687bc
O-Subject: [RHEL-8.3.0/RHEL-8.4.0 qemu-kvm PATCH] seccomp: fix killing of whole process instead of thread
c687bc
Bugzilla: 1880546
c687bc
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
c687bc
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
c687bc
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
c687bc
c687bc
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1890885
c687bc
BRANCH: rhel-8.3.0
c687bc
UPSTREAM: Merged
c687bc
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=1890885
c687bc
c687bc
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1880546
c687bc
BRANCH: rhel-8.4.0
c687bc
UPSTREAM: Merged
c687bc
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=33125023
c687bc
c687bc
From: Daniel P. Berrangé <berrange@redhat.com>
c687bc
c687bc
Back in 2018 we introduced support for killing the whole QEMU process
c687bc
instead of just one thread, when a seccomp rule is violated:
c687bc
c687bc
  commit bda08a5764d470f101fa38635d30b41179a313e1
c687bc
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
c687bc
  Date:   Wed Aug 22 19:02:48 2018 +0200
c687bc
c687bc
    seccomp: prefer SCMP_ACT_KILL_PROCESS if available
c687bc
c687bc
Fast forward a year and we introduced a patch to avoid killing the
c687bc
process for resource control syscalls tickled by Mesa.
c687bc
c687bc
  commit 9a1565a03b79d80b236bc7cc2dbce52a2ef3a1b8
c687bc
  Author: Daniel P. Berrangé <berrange@redhat.com>
c687bc
  Date:   Wed Mar 13 09:49:03 2019 +0000
c687bc
c687bc
    seccomp: don't kill process for resource control syscalls
c687bc
c687bc
Unfortunately a logic bug effectively reverted the first commit
c687bc
mentioned so that we go back to only killing the thread, not the whole
c687bc
process.
c687bc
c687bc
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
c687bc
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
c687bc
Acked-by: Eduardo Otubo <otubo@redhat.com>
c687bc
(cherry picked from commit e474e3aacf4276eb0781d11c45e2fab996f9dc56)
c687bc
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
c687bc
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
c687bc
---
c687bc
 qemu-seccomp.c | 3 ++-
c687bc
 1 file changed, 2 insertions(+), 1 deletion(-)
c687bc
c687bc
diff --git a/qemu-seccomp.c b/qemu-seccomp.c
c687bc
index e0a1829b3dd..8325ecb766e 100644
c687bc
--- a/qemu-seccomp.c
c687bc
+++ b/qemu-seccomp.c
c687bc
@@ -136,8 +136,9 @@ static uint32_t qemu_seccomp_get_action(int set)
c687bc
 
c687bc
             if (qemu_seccomp(SECCOMP_GET_ACTION_AVAIL, 0, &action) == 0) {
c687bc
                 kill_process = 1;
c687bc
+            } else {
c687bc
+                kill_process = 0;
c687bc
             }
c687bc
-            kill_process = 0;
c687bc
         }
c687bc
         if (kill_process == 1) {
c687bc
             return SCMP_ACT_KILL_PROCESS;
c687bc
-- 
c687bc
2.27.0
c687bc