tests: enhance invalid address decoding check in seccomp-strict.test

* tests/seccomp-strict.c (main): Change the type of addr variable
containg the invalid address from unsigned long to kernel_ulong_t,
print it using %#llx format.
This commit is contained in:
Дмитрий Левин 2016-12-28 22:33:38 +00:00
parent 2add5258ec
commit 54f2397c84

View File

@ -41,18 +41,18 @@ main(void)
static const char text1[] = static const char text1[] =
"seccomp(SECCOMP_SET_MODE_STRICT, 0, NULL) = 0\n"; "seccomp(SECCOMP_SET_MODE_STRICT, 0, NULL) = 0\n";
static const char text2[] = "+++ exited with 0 +++\n"; static const char text2[] = "+++ exited with 0 +++\n";
const unsigned long addr = (unsigned long) 0xfacefeeddeadbeef; const kernel_ulong_t addr = (kernel_ulong_t) 0xfacefeeddeadbeefULL;
long rc; long rc;
rc = syscall(__NR_seccomp, -1L, -1L, addr); rc = syscall(__NR_seccomp, -1L, -1L, addr);
printf("seccomp(%#x /* SECCOMP_SET_MODE_??? */, %u, %#lx)" printf("seccomp(%#x /* SECCOMP_SET_MODE_??? */, %u, %#llx)"
" = %ld %s (%m)\n", -1, -1, addr, rc, errno2name()); " = %s\n", -1, -1, (unsigned long long) addr, sprintrc(rc));
fflush(stdout); fflush(stdout);
rc = syscall(__NR_seccomp, 0, 0, 0); rc = syscall(__NR_seccomp, 0, 0, 0);
if (rc) { if (rc) {
printf("seccomp(SECCOMP_SET_MODE_STRICT, 0, NULL)" printf("seccomp(SECCOMP_SET_MODE_STRICT, 0, NULL) = %s\n",
" = %ld %s (%m)\n", rc, errno2name()); sprintrc(rc));
fflush(stdout); fflush(stdout);
rc = 0; rc = 0;
} else { } else {