2019-09-25 12:25:49 +00:00
|
|
|
#!/bin/sh
|
2019-10-23 13:39:25 +02:00
|
|
|
#
|
2019-11-06 11:57:25 +01:00
|
|
|
# Linux specific defines and system call maps.
|
2019-09-25 12:25:49 +00:00
|
|
|
|
2021-11-29 15:43:43 +01:00
|
|
|
if [ -z "$TARGET_PLATFORM" ]; then
|
|
|
|
PLATFORM=$(uname -m)
|
|
|
|
else
|
|
|
|
PLATFORM=$TARGET_PLATFORM
|
|
|
|
fi
|
|
|
|
|
2019-10-23 13:50:51 +02:00
|
|
|
BASE=$(dirname $0)
|
2019-09-25 12:25:49 +00:00
|
|
|
|
|
|
|
case "$PLATFORM" in
|
|
|
|
x86_64*)
|
|
|
|
seccomp_audit_arch=AUDIT_ARCH_X86_64
|
2019-11-06 11:57:25 +01:00
|
|
|
syscall_file=$BASE/linux/x86_64_syscall.h.in
|
2019-09-25 12:25:49 +00:00
|
|
|
;;
|
2020-09-03 19:24:26 +02:00
|
|
|
i*86*)
|
|
|
|
>&2 echo "i386 not supported"
|
|
|
|
exit 1
|
|
|
|
;;
|
2019-09-25 12:25:49 +00:00
|
|
|
arm*)
|
|
|
|
seccomp_audit_arch=AUDIT_ARCH_ARM
|
2019-11-06 11:57:25 +01:00
|
|
|
syscall_file=$BASE/linux/arm_syscall.h.in
|
2019-09-25 12:25:49 +00:00
|
|
|
;;
|
|
|
|
aarch64*)
|
|
|
|
seccomp_audit_arch=AUDIT_ARCH_AARCH64
|
2019-11-06 11:57:25 +01:00
|
|
|
syscall_file=$BASE/linux/aarch64_syscall.h.in
|
2019-09-25 12:25:49 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
cat << __EOF
|
|
|
|
/* Auto generated by linux-platform.sh - DO NOT EDIT */
|
Allow configuring seccomp on Linux via the python api.
A new hook in the koreapp class is called right before seccomp
is enabled. This hook receives a Kore seccomp object which has
the following methods:
seccomp.allow("syscall")
seccomp.allow_arg("syscall", arg, value)
seccomp.allow_flag("syscall", arg, flag)
seccomp.allow_mask("syscall", arg, mask)
seccomp.deny("syscall")
seccomp.deny_arg("syscall", arg, value, errno=EACCES)
seccomp.deny_flag("syscall", arg, flag, errno=EACCES)
seccomp.deny_mask("syscall", arg, mask, errno=EACCES)
This allows you to finetune the seccomp filters for your application
from inside your koreapp.
2019-10-04 10:59:48 +02:00
|
|
|
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
|
2019-09-25 12:25:49 +00:00
|
|
|
#define SECCOMP_AUDIT_ARCH $seccomp_audit_arch
|
Allow configuring seccomp on Linux via the python api.
A new hook in the koreapp class is called right before seccomp
is enabled. This hook receives a Kore seccomp object which has
the following methods:
seccomp.allow("syscall")
seccomp.allow_arg("syscall", arg, value)
seccomp.allow_flag("syscall", arg, flag)
seccomp.allow_mask("syscall", arg, mask)
seccomp.deny("syscall")
seccomp.deny_arg("syscall", arg, value, errno=EACCES)
seccomp.deny_flag("syscall", arg, flag, errno=EACCES)
seccomp.deny_mask("syscall", arg, mask, errno=EACCES)
This allows you to finetune the seccomp filters for your application
from inside your koreapp.
2019-10-04 10:59:48 +02:00
|
|
|
|
|
|
|
struct {
|
|
|
|
const char *name;
|
|
|
|
int nr;
|
|
|
|
} kore_syscall_map [] = {
|
|
|
|
__EOF
|
|
|
|
|
2019-11-06 11:57:25 +01:00
|
|
|
sed 's/__NR_//' $syscall_file | awk '/#define/ { syscall = $2; number = $3; printf " { \"%s\", %d },\n", syscall, number }'
|
Allow configuring seccomp on Linux via the python api.
A new hook in the koreapp class is called right before seccomp
is enabled. This hook receives a Kore seccomp object which has
the following methods:
seccomp.allow("syscall")
seccomp.allow_arg("syscall", arg, value)
seccomp.allow_flag("syscall", arg, flag)
seccomp.allow_mask("syscall", arg, mask)
seccomp.deny("syscall")
seccomp.deny_arg("syscall", arg, value, errno=EACCES)
seccomp.deny_flag("syscall", arg, flag, errno=EACCES)
seccomp.deny_mask("syscall", arg, mask, errno=EACCES)
This allows you to finetune the seccomp filters for your application
from inside your koreapp.
2019-10-04 10:59:48 +02:00
|
|
|
|
|
|
|
cat << __EOF
|
|
|
|
{ NULL, 0 }
|
|
|
|
};
|
2019-09-25 12:25:49 +00:00
|
|
|
__EOF
|