[lxc-devel] [lxd/master] seccomp: define __NR_mknod if missing

brauner on Github lxc-bot at linuxcontainers.org
Thu Jun 13 23:07:07 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190613/5af7771b/attachment-0001.bin>
-------------- next part --------------
From a181ed43172755cf9fcd3e1068f914c373e7091b Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 14 Jun 2019 01:05:52 +0200
Subject: [PATCH] seccomp: define __NR_mknod if missing

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/seccomp.go | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/lxd/seccomp.go b/lxd/seccomp.go
index 0afad7cacc..071859d6a2 100644
--- a/lxd/seccomp.go
+++ b/lxd/seccomp.go
@@ -109,6 +109,48 @@ static int device_allowed(dev_t dev, mode_t mode)
 	return -EPERM;
 }
 
+#ifndef __NR_mknod
+	#ifdef __x86_64__
+		#define __NR_mknod 133
+	#elif defined __arm__
+		#define __NR_mknod 14
+	#elif defined __aarch64__
+		#define __NR_mknod 14
+	#elif defined __s390__
+		#define __NR_mknod 14
+	#elif defined __s390x__
+		#define __NR_mknod 14
+	#elif __mips__ && _MIPSEB && _MIPS_SIM ==_ABIO32
+		#define __NR_mknod 14
+	#elif __mips__ && _MIPSEL && _MIPS_SIM==_ABIO32
+		#define __NR_mknod 14
+	#elif __mips__ && _MIPSEB && _MIPS_SIM==_ABI64
+		#define __NR_mknod 131
+	#elif __mips__ && _MIPSEL && _MIPS_SIM==_ABI64
+		#define __NR_mknod 131
+	#elif __mips__ && _MIPSEB && _MIPS_SIM==_ABIN32
+		#define __NR_mknod 131
+	#elif __mips__ && _MIPSEL && _MIPS_SIM==_ABIN32
+		#define __NR_mknod 131
+	#elif defined __i386__
+		#define __NR_mknod 14
+	#elif defined __alpha__
+		#define __NR_mknod 14
+	#elif defined __ia64__
+		#define __NR_mknod 13
+	#elif defined __m68k__
+		#define __NR_mknod 14
+	#elif defined __sparc__
+		#define __NR_mknod 14
+	#elif defined __powerpc__
+		#define __NR_mknod 14
+	#elif defined __sh__
+		#define __NR_mknod 14
+	#else
+		#warning "__NR_mknod unknown for your architecture"
+	#endif
+#endif
+
 static int seccomp_notify_mknod_set_response(int fd_mem, struct seccomp_notify_proxy_msg *msg,
 					     char *buf, size_t size,
 					     mode_t *mode, dev_t *dev,


More information about the lxc-devel mailing list