Blame SOURCES/kvm-seccomp-use-SIGSYS-signal-instead-of-killing-the-thr.patch

ae23c9
From fb1bf29b909f8443aae0171e3b9c8bc369e0a641 Mon Sep 17 00:00:00 2001
ae23c9
From: Eduardo Otubo <otubo@redhat.com>
ae23c9
Date: Fri, 28 Sep 2018 07:56:36 +0100
ae23c9
Subject: [PATCH 2/6] seccomp: use SIGSYS signal instead of killing the thread
ae23c9
MIME-Version: 1.0
ae23c9
Content-Type: text/plain; charset=UTF-8
ae23c9
Content-Transfer-Encoding: 8bit
ae23c9
ae23c9
RH-Author: Eduardo Otubo <otubo@redhat.com>
ae23c9
Message-id: <20180928075639.16746-3-otubo@redhat.com>
ae23c9
Patchwork-id: 82314
ae23c9
O-Subject: [RHEL-8 qemu-kvm PATCH 2/5] seccomp: use SIGSYS signal instead of killing the thread
ae23c9
Bugzilla: 1618356
ae23c9
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ae23c9
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
ae23c9
From: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
ae23c9
commit 6f2231e9b0931e1998d9ed0c509adf7aedc02db2
ae23c9
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
Date:   Wed Aug 22 19:02:47 2018 +0200
ae23c9
ae23c9
    seccomp: use SIGSYS signal instead of killing the thread
ae23c9
ae23c9
    The seccomp action SCMP_ACT_KILL results in immediate termination of
ae23c9
    the thread that made the bad system call. However, qemu being
ae23c9
    multi-threaded, it keeps running. There is no easy way for parent
ae23c9
    process / management layer (libvirt) to know about that situation.
ae23c9
ae23c9
    Instead, the default SIGSYS handler when invoked with SCMP_ACT_TRAP
ae23c9
    will terminate the program and core dump.
ae23c9
ae23c9
    This may not be the most secure solution, but probably better than
ae23c9
    just killing the offending thread. SCMP_ACT_KILL_PROCESS has been
ae23c9
    added in Linux 4.14 to improve the situation, which I propose to use
ae23c9
    by default if available in the next patch.
ae23c9
ae23c9
    Related to:
ae23c9
    https://bugzilla.redhat.com/show_bug.cgi?id=1594456
ae23c9
ae23c9
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
ae23c9
    Acked-by: Eduardo Otubo <otubo@redhat.com>
ae23c9
ae23c9
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 qemu-seccomp.c | 2 +-
ae23c9
 1 file changed, 1 insertion(+), 1 deletion(-)
ae23c9
ae23c9
diff --git a/qemu-seccomp.c b/qemu-seccomp.c
ae23c9
index 845a333..b88fa05 100644
ae23c9
--- a/qemu-seccomp.c
ae23c9
+++ b/qemu-seccomp.c
ae23c9
@@ -120,7 +120,7 @@ int seccomp_start(uint32_t seccomp_opts)
ae23c9
             continue;
ae23c9
         }
ae23c9
 
ae23c9
-        rc = seccomp_rule_add_array(ctx, SCMP_ACT_KILL, blacklist[i].num,
ae23c9
+        rc = seccomp_rule_add_array(ctx, SCMP_ACT_TRAP, blacklist[i].num,
ae23c9
                                     blacklist[i].narg, blacklist[i].arg_cmp);
ae23c9
         if (rc < 0) {
ae23c9
             goto seccomp_return;
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9