cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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