forked from rootless-containers/slirp4netns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
seccomparch.h
66 lines (62 loc) · 2.42 KB
/
seccomparch.h
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
65
66
/* SPDX-License-Identifier: LGPL-2.1+ */
#ifndef SLIRP4NETNS_SECCOMPARCH_H
#define SLIRP4NETNS_SECCOMPARCH_H
#include <stdint.h>
#include <seccomp.h>
/*
* seccomp_extra_archs derived from systemd seccomp_local_archs
* but does NOT contain native archs:
* https://github.com/systemd/systemd/blob/v245/src/shared/seccomp-util.c#L25-L95
* .
*/
const uint32_t seccomp_extra_archs[] = {
#if defined(__x86_64__) && \
defined(__ILP32__) /* X32 ( https://en.wikipedia.org/wiki/X32_ABI ) */
SCMP_ARCH_X86, SCMP_ARCH_X86_64,
#elif defined(__x86_64__) && !defined(__ILP32__) /* X86_64 */
SCMP_ARCH_X86, SCMP_ARCH_X32,
#elif defined(__i386__) /* X86 */
/* NONE */
#elif defined(__aarch64__) /* AARCH64 */
SCMP_ARCH_ARM,
#elif defined(__arm__) /* ARM */
/* NONE */
#elif defined(__mips__) && __BYTE_ORDER == __BIG_ENDIAN && \
_MIPS_SIM == _MIPS_SIM_ABI32 /* MIPS */
SCMP_ARCH_MIPSEL,
#elif defined(__mips__) && __BYTE_ORDER == __LITTLE_ENDIAN && \
_MIPS_SIM == _MIPS_SIM_ABI32 /* MIPSEL */
SCMP_ARCH_MIPS,
#elif defined(__mips__) && __BYTE_ORDER == __BIG_ENDIAN && \
_MIPS_SIM == _MIPS_SIM_ABI64 /* MIPS64 */
SCMP_ARCH_MIPSEL, SCMP_ARCH_MIPS, SCMP_ARCH_MIPSEL64N32,
SCMP_ARCH_MIPS64N32, SCMP_ARCH_MIPSEL64,
#elif defined(__mips__) && __BYTE_ORDER == __LITTLE_ENDIAN && \
_MIPS_SIM == _MIPS_SIM_ABI64 /* MIPSEL64 */
SCMP_ARCH_MIPS, SCMP_ARCH_MIPSEL, SCMP_ARCH_MIPS64N32,
SCMP_ARCH_MIPSEL64N32, SCMP_ARCH_MIPS64,
#elif defined(__mips__) && __BYTE_ORDER == __BIG_ENDIAN && \
_MIPS_SIM == _MIPS_SIM_NABI32 /* MIPS64N32 */
SCMP_ARCH_MIPSEL, SCMP_ARCH_MIPS, SCMP_ARCH_MIPSEL64,
SCMP_ARCH_MIPS64, SCMP_ARCH_MIPSEL64N32,
#elif defined(__mips__) && __BYTE_ORDER == __LITTLE_ENDIAN && \
_MIPS_SIM == _MIPS_SIM_NABI32 /* MIPSEL64N32 */
SCMP_ARCH_MIPS, SCMP_ARCH_MIPSEL, SCMP_ARCH_MIPS64,
SCMP_ARCH_MIPSEL64, SCMP_ARCH_MIPS64N32,
#elif defined(__powerpc64__) && __BYTE_ORDER == __BIG_ENDIAN /* PPC64 */
SCMP_ARCH_PPC, SCMP_ARCH_PPC64LE,
#elif defined(__powerpc64__) && __BYTE_ORDER == __LITTLE_ENDIAN /* PPC64LE */
SCMP_ARCH_PPC, SCMP_ARCH_PPC64,
#elif defined(__powerpc__) /* PPC */
/* NONE */
#elif defined(__s390x__) /* S390X */
SCMP_ARCH_S390,
#elif defined(__s390__) /* S390 */
/* NONE */
#endif
(uint32_t)-1
};
/* seccomp_extra_archs_items can be 0 */
const int seccomp_extra_archs_items =
sizeof(seccomp_extra_archs) / sizeof(seccomp_extra_archs[0]) - 1;
#endif