aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-23 16:19:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-23 16:19:27 -0500
commita2931547eee19201856a89406397ecc1f978deaf (patch)
tree4084b6ac5af7870fc1b5960393111825302c20b8
parent1ec218373b8ebda821aec00bb156a9c94fad9cd4 (diff)
parent2ce47b44b25d8fb0114ff117813742adbefec8ff (diff)
Merge tag 'linux-kselftest-4.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest fixes from Shuah Khan: "This update consists of one minor documentation fix and a fix to an existing test" * tag 'linux-kselftest-4.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/seccomp: Get page size from sysconf tools:testing/selftests: fix typo in futex/README
-rw-r--r--tools/testing/selftests/futex/README2
-rw-r--r--tools/testing/selftests/seccomp/seccomp_bpf.c11
2 files changed, 8 insertions, 5 deletions
diff --git a/tools/testing/selftests/futex/README b/tools/testing/selftests/futex/README
index 3224a049b196..0558bb9ce0a6 100644
--- a/tools/testing/selftests/futex/README
+++ b/tools/testing/selftests/futex/README
@@ -27,7 +27,7 @@ o The build system shall remain as simple as possible, avoiding any archive or
27o Where possible, any helper functions or other package-wide code shall be 27o Where possible, any helper functions or other package-wide code shall be
28 implemented in header files, avoiding the need to compile intermediate object 28 implemented in header files, avoiding the need to compile intermediate object
29 files. 29 files.
30o External dependendencies shall remain as minimal as possible. Currently gcc 30o External dependencies shall remain as minimal as possible. Currently gcc
31 and glibc are the only dependencies. 31 and glibc are the only dependencies.
32o Tests return 0 for success and < 0 for failure. 32o Tests return 0 for success and < 0 for failure.
33 33
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index e38cc54942db..882fe83a3554 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -492,6 +492,9 @@ TEST_SIGNAL(KILL_one_arg_six, SIGSYS)
492 pid_t parent = getppid(); 492 pid_t parent = getppid();
493 int fd; 493 int fd;
494 void *map1, *map2; 494 void *map1, *map2;
495 int page_size = sysconf(_SC_PAGESIZE);
496
497 ASSERT_LT(0, page_size);
495 498
496 ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); 499 ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
497 ASSERT_EQ(0, ret); 500 ASSERT_EQ(0, ret);
@@ -504,16 +507,16 @@ TEST_SIGNAL(KILL_one_arg_six, SIGSYS)
504 507
505 EXPECT_EQ(parent, syscall(__NR_getppid)); 508 EXPECT_EQ(parent, syscall(__NR_getppid));
506 map1 = (void *)syscall(sysno, 509 map1 = (void *)syscall(sysno,
507 NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, fd, PAGE_SIZE); 510 NULL, page_size, PROT_READ, MAP_PRIVATE, fd, page_size);
508 EXPECT_NE(MAP_FAILED, map1); 511 EXPECT_NE(MAP_FAILED, map1);
509 /* mmap2() should never return. */ 512 /* mmap2() should never return. */
510 map2 = (void *)syscall(sysno, 513 map2 = (void *)syscall(sysno,
511 NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, fd, 0x0C0FFEE); 514 NULL, page_size, PROT_READ, MAP_PRIVATE, fd, 0x0C0FFEE);
512 EXPECT_EQ(MAP_FAILED, map2); 515 EXPECT_EQ(MAP_FAILED, map2);
513 516
514 /* The test failed, so clean up the resources. */ 517 /* The test failed, so clean up the resources. */
515 munmap(map1, PAGE_SIZE); 518 munmap(map1, page_size);
516 munmap(map2, PAGE_SIZE); 519 munmap(map2, page_size);
517 close(fd); 520 close(fd);
518} 521}
519 522