mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-27 23:41:42 +00:00
Merge pull request #32 from QingdaoU/allow_time
allow clock_gettime syscall
This commit is contained in:
commit
9421828a11
@ -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;
|
||||
|
@ -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)
|
||||
|
7
tests/test_src/integration/time.c
Normal file
7
tests/test_src/integration/time.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main () {
|
||||
clock();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user