diff --git a/src/rules/c_cpp.c b/src/rules/c_cpp.c index fd77c53..dc92453 100644 --- a/src/rules/c_cpp.c +++ b/src/rules/c_cpp.c @@ -16,7 +16,8 @@ int _c_cpp_seccomp_rules(struct config *_config, bool allow_write_file) { SCMP_SYS(access), SCMP_SYS(exit_group), SCMP_SYS(close), SCMP_SYS(readlink), SCMP_SYS(sysinfo), SCMP_SYS(write), - SCMP_SYS(writev), SCMP_SYS(lseek)}; + SCMP_SYS(writev), SCMP_SYS(lseek), + SCMP_SYS(clock_gettime)}; int syscalls_whitelist_length = sizeof(syscalls_whitelist) / sizeof(int); scmp_filter_ctx ctx = NULL; diff --git a/tests/Python_and_core/testcase/integration/test.py b/tests/Python_and_core/testcase/integration/test.py index 4a6f6d2..a977f75 100644 --- a/tests/Python_and_core/testcase/integration/test.py +++ b/tests/Python_and_core/testcase/integration/test.py @@ -327,3 +327,11 @@ class IntegrationTest(base.BaseTestCase): result = _judger.run(**config) self.assertEqual(result["result"], _judger.RESULT_SUCCESS) + + def test_get_time(self): + config = self.base_config + config["exe_path"] = self._compile_c("time.c") + config["seccomp_rule_name"] = "c_cpp" + + result = _judger.run(**config) + self.assertEqual(result["result"], _judger.RESULT_SUCCESS) diff --git a/tests/test_src/integration/time.c b/tests/test_src/integration/time.c new file mode 100644 index 0000000..624d451 --- /dev/null +++ b/tests/test_src/integration/time.c @@ -0,0 +1,7 @@ +#include +#include + +int main () { + clock(); + return 0; +} \ No newline at end of file