diff --git a/src/rules/c_cpp.c b/src/rules/c_cpp.c index 2f5a164..52980ec 100644 --- a/src/rules/c_cpp.c +++ b/src/rules/c_cpp.c @@ -11,7 +11,7 @@ int c_cpp_seccomp_rules(struct config *_config) { SCMP_SYS(arch_prctl), SCMP_SYS(brk), SCMP_SYS(access), SCMP_SYS(exit_group), SCMP_SYS(close), SCMP_SYS(readlink), - SCMP_SYS(uname)}; + SCMP_SYS(uname), SCMP_SYS(sysinfo)}; int syscalls_whitelist_length = sizeof(syscalls_whitelist) / sizeof(int); scmp_filter_ctx ctx = NULL; // load seccomp rules diff --git a/tests/Python_and_core/testcase/seccomp/test.py b/tests/Python_and_core/testcase/seccomp/test.py index 5a1c7c1..09e8a26 100644 --- a/tests/Python_and_core/testcase/seccomp/test.py +++ b/tests/Python_and_core/testcase/seccomp/test.py @@ -80,3 +80,10 @@ class SeccompTest(base.BaseTestCase): result = _judger.run(**config) self.assertEqual(result["result"], _judger.RESULT_RUNTIME_ERROR) self.assertEqual(result["signal"], 31) + + def test_sysinfo(self): + config = self.base_config + config["exe_path"] = self._compile_c("sysinfo.c") + result = _judger.run(**config) + + self.assertEqual(result["result"], _judger.RESULT_SUCCESS) diff --git a/tests/test_src/seccomp/sysinfo.c b/tests/test_src/seccomp/sysinfo.c new file mode 100644 index 0000000..7791265 --- /dev/null +++ b/tests/test_src/seccomp/sysinfo.c @@ -0,0 +1,8 @@ +// maybe used in qsort function +#include +#include + +int main() { + printf("%ld", sysconf(_SC_PAGE_SIZE)); + return 0; +}