From 06d87c5605ba8229f2a3a0f257621bcf6e8c4330 Mon Sep 17 00:00:00 2001
From: Paul Moore <pmoore@redhat.com>
Date: Wed, 30 Apr 2014 19:54:46 +0200
Subject: [PATCH 03/13] seccomp: add shmctl(), mlock(), and munlock() to the syscall whitelist

RH-Author: Paul Moore <pmoore@redhat.com>
Message-id: <20140430195446.13069.14348.stgit@localhost>
Patchwork-id: 58635
O-Subject: [RHEL7 qemu-kvm PATCH] seccomp: add shmctl(), mlock(), and munlock() to the syscall whitelist
Bugzilla: 1026314
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Bandan Das <bsd@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1026314
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=7405978
Upstream: Upstream, see commit ID below
Testing: Tested, see BZ

Minor differences from upstream patch due to a slowly diverging
codebase.

	commit e3f9bb011ae24a594310fa4917754945dc832f8f
	Author: Paul Moore <pmoore@redhat.com>
	Date:   Wed Feb 26 10:25:01 2014 -0500

	seccomp: add shmctl(), mlock(), and munlock() to the syscall whitelist

	Additional testing reveals that PulseAudio requires shmctl() and the
	mlock()/munlock() syscalls on some systems/configurations.  As before,
	on systems that do require these syscalls, the problem can be seen with
	the following command line:

	# qemu -monitor stdio  -sandbox on \
		-device intel-hda -device hda-duplex

	Signed-off-by: Paul Moore <pmoore@redhat.com>
	Signed-off-by: Eduardo Otubo <otubo@linux.vnet.ibm.com>
---
 qemu-seccomp.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 qemu-seccomp.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/qemu-seccomp.c b/qemu-seccomp.c
index 3a2fbed..cca1070 100644
--- a/qemu-seccomp.c
+++ b/qemu-seccomp.c
@@ -242,7 +242,10 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = {
     { SCMP_SYS(fchmod), 240 },
     { SCMP_SYS(shmget), 240 },
     { SCMP_SYS(shmat), 240 },
-    { SCMP_SYS(shmdt), 240 }
+    { SCMP_SYS(shmdt), 240 },
+    { SCMP_SYS(shmctl), 240 },
+    { SCMP_SYS(mlock), 240 },
+    { SCMP_SYS(munlock), 240 }
 };
 
 int seccomp_start(void)
-- 
1.7.1