blob: d75d41034fd8fbfed13f08e378618c1660be105e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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,
|