feat: sync language name with runner

This commit is contained in:
Paul Pan 2022-10-09 20:19:25 +08:00
parent b66a52f4df
commit b1ae874394
3 changed files with 14 additions and 6 deletions

View File

@ -16,7 +16,7 @@ static __attribute__((constructor)) void inject(void) {
LOG_INFO("Setting up sandbox for %s(%d)", comm, getpid());
register_lang_c();
register_lang_c_cpp();
setup_rlimit();
setup_seccomp();
}

View File

@ -1,6 +1,6 @@
#ifndef WOJ_SANDBOX_LANG_H
#define WOJ_SANDBOX_LANG_H
void register_lang_c(void);
void register_lang_c_cpp(void);
#endif // WOJ_SANDBOX_LANG_H

View File

@ -4,7 +4,7 @@
#include <seccomp.h>
void setup_lang_c(scmp_filter_ctx ctx) {
void setup_lang_c_cpp(scmp_filter_ctx ctx) {
int white[] = {
SCMP_SYS(read), // 0
SCMP_SYS(write), // 1
@ -29,8 +29,16 @@ void setup_lang_c(scmp_filter_ctx ctx) {
}
struct rule lang_c_rule = {
.name = "lang_c",
.setup = setup_lang_c,
.name = "c",
.setup = setup_lang_c_cpp,
};
void register_lang_c(void) { register_rule(&lang_c_rule); }
struct rule lang_cpp_rule = {
.name = "cpp",
.setup = setup_lang_c_cpp,
};
void register_lang_c_cpp(void) {
register_rule(&lang_c_rule);
register_rule(&lang_cpp_rule);
}