aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lxd/__NR_mknod.patch
diff options
context:
space:
mode:
Diffstat (limited to 'testing/lxd/__NR_mknod.patch')
-rw-r--r--testing/lxd/__NR_mknod.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/testing/lxd/__NR_mknod.patch b/testing/lxd/__NR_mknod.patch
new file mode 100644
index 0000000000..d75d41034f
--- /dev/null
+++ b/testing/lxd/__NR_mknod.patch
@@ -0,0 +1,64 @@
+From a181ed43172755cf9fcd3e1068f914c373e7091b Mon Sep 17 00:00:00 2001
+From: Christian Brauner <christian.brauner@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@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,
+