mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-29 00:11:41 +00:00
add sysinfo to syscall whitelist
This commit is contained in:
parent
9826ecc678
commit
cb9f0ab4c1
@ -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
|
||||
|
@ -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)
|
||||
|
8
tests/test_src/seccomp/sysinfo.c
Normal file
8
tests/test_src/seccomp/sysinfo.c
Normal file
@ -0,0 +1,8 @@
|
||||
// maybe used in qsort function
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("%ld", sysconf(_SC_PAGE_SIZE));
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user