woj-sandbox/rules/lang_c_cpp.c

32 lines
757 B
C
Raw Permalink Normal View History

2022-10-02 14:09:25 +08:00
#include "rules.h"
#include <seccomp.h>
2022-10-09 20:19:25 +08:00
void setup_lang_c_cpp(scmp_filter_ctx ctx) {
2024-01-01 17:31:21 +08:00
// some more syscall(s) that glibc uses
2022-10-02 16:06:27 +08:00
int white[] = {
2022-10-20 15:44:03 +08:00
SCMP_SYS(clone), // 56
2022-10-04 14:30:11 +08:00
SCMP_SYS(futex), // 202
2024-01-01 17:31:21 +08:00
SCMP_SYS(set_tid_address), // 218
2022-10-20 15:44:03 +08:00
SCMP_SYS(set_robust_list), // 273
SCMP_SYS(get_robust_list), // 274
2024-01-01 17:31:21 +08:00
SCMP_SYS(rseq), // 334
2022-10-02 16:06:27 +08:00
};
2024-01-01 17:31:21 +08:00
ADD_RULE_LIST(white, SCMP_ACT_ALLOW);
2022-10-02 14:09:25 +08:00
}
struct rule lang_c_rule = {
2022-10-09 20:19:25 +08:00
.name = "c",
.setup = setup_lang_c_cpp,
2022-10-02 14:09:25 +08:00
};
2022-10-09 20:19:25 +08:00
struct rule lang_cpp_rule = {
.name = "cpp",
.setup = setup_lang_c_cpp,
};
2024-01-01 17:31:21 +08:00
void __attribute__((constructor(101))) register_lang_c_cpp(void) {
2022-10-09 20:19:25 +08:00
register_rule(&lang_c_rule);
register_rule(&lang_cpp_rule);
}