Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1696632 > unrolled thread

[PATCH 0/2] selftests: capabilities: convert to TAP13 ksft framework

Started byShuah Khan <shuahkh@osg.samsung.com>
First post2017-07-26 00:10 +0200
Last post2017-07-26 00:10 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] selftests: capabilities: convert to TAP13 ksft framework Shuah Khan <shuahkh@osg.samsung.com> - 2017-07-26 00:10 +0200
    [PATCH 1/2] selftests: capabilities: fix to run Non-root +ia, sgidroot => i test Shuah Khan <shuahkh@osg.samsung.com> - 2017-07-26 00:10 +0200

#1696632 — [PATCH 0/2] selftests: capabilities: convert to TAP13 ksft framework

FromShuah Khan <shuahkh@osg.samsung.com>
Date2017-07-26 00:10 +0200
Subject[PATCH 0/2] selftests: capabilities: convert to TAP13 ksft framework
Message-ID<u7gbD-eH-3@gated-at.bofh.it>
This patch series consists of a fix to run a skipped test and converting
to TAP13 ksft framework. I found this skipped test while I was testing the
TAP13 changes.

Next up is converting err() and errx() to appropriate ksft_ routines as
needed and appropriate. The output from non-root user run reflects the
pending work.

Output after conversion when root runs the test:
------------------------------------------------

TAP version 13
# [RUN]	+++ Tests with uid == 0 +++
# [NOTE]	Using global UIDs for tests
# [RUN]	Root => ep
# validate_cap:: Capabilities after execve were correct
ok 1 Passed
# Check cap_ambient manipulation rules
ok 2 PR_CAP_AMBIENT_RAISE failed on non-inheritable cap
ok 3 PR_CAP_AMBIENT_RAISE failed on non-permitted cap
ok 4 PR_CAP_AMBIENT_RAISE worked
ok 5 Basic manipulation appears to work
# [RUN]	Root +i => eip
# validate_cap:: Capabilities after execve were correct
ok 6 Passed
# [RUN]	UID 0 +ia => eipa
# validate_cap:: Capabilities after execve were correct
ok 7 Passed
# [RUN]	Root +ia, suidroot => eipa
# validate_cap:: Capabilities after execve were correct
ok 8 Passed
# [RUN]	Root +ia, suidnonroot => ip
# validate_cap:: Capabilities after execve were correct
ok 9 Passed
# [RUN]	Root +ia, sgidroot => eipa
# validate_cap:: Capabilities after execve were correct
ok 10 Passed
# [RUN]	Root, gid != 0, +ia, sgidroot => eip
# validate_cap:: Capabilities after execve were correct
ok 11 Passed
# [RUN]	Root +ia, sgidnonroot => eip
# validate_cap:: Capabilities after execve were correct
ok 12 Passed
Pass 12 Fail 0 Xfail 0 Xpass 0 Skip 0
1..12
# ==================================================
# [RUN]	+++ Tests with uid != 0 +++
# [NOTE]	Using global UIDs for tests
# [RUN]	Non-root => no caps
# validate_cap:: Capabilities after execve were correct
ok 1 Passed
# Check cap_ambient manipulation rules
ok 2 PR_CAP_AMBIENT_RAISE failed on non-inheritable cap
ok 3 PR_CAP_AMBIENT_RAISE failed on non-permitted cap
ok 4 PR_CAP_AMBIENT_RAISE worked
ok 5 Basic manipulation appears to work
# [RUN]	Non-root +i => i
# validate_cap:: Capabilities after execve were correct
ok 6 Passed
# [RUN]	UID 1 +ia => eipa
# validate_cap:: Capabilities after execve were correct
ok 7 Passed
# [RUN]	Non-root +ia, sgidnonroot => i
# validate_cap:: Capabilities after execve were correct
ok 8 Passed
# [RUN]	Non-root +ia, sgidroot => i
# validate_cap:: Capabilities after execve were correct
ok 9 Passed
Pass 9 Fail 0 Xfail 0 Xpass 0 Skip 0
1..9

Output after conversion when a non-root user runs the test:
-----------------------------------------------------------

TAP version 13
# [RUN]	+++ Tests with uid == 0 +++
test_execve: must be root or be able to create a userns
# Child failed
# ==================================================
# [RUN]	+++ Tests with uid != 0 +++
test_execve: must be root or be able to create a userns
# Child failed

Shuah Khan (2):
  selftests: capabilities: fix to run Non-root +ia, sgidroot => i test
  selftests: capabilities: convert the test to use TAP13 ksft framework

 tools/testing/selftests/capabilities/test_execve.c | 88 +++++++++++++---------
 .../testing/selftests/capabilities/validate_cap.c  | 15 ++--
 2 files changed, 64 insertions(+), 39 deletions(-)

-- 
2.11.0

[toc] | [next] | [standalone]


#1696633 — [PATCH 1/2] selftests: capabilities: fix to run Non-root +ia, sgidroot => i test

FromShuah Khan <shuahkh@osg.samsung.com>
Date2017-07-26 00:10 +0200
Subject[PATCH 1/2] selftests: capabilities: fix to run Non-root +ia, sgidroot => i test
Message-ID<u7gbE-eH-27@gated-at.bofh.it>
In reply to#1696632
do_tests() runs sgidnonroot test without fork_wait(). As a result the
last test "Non-root +ia, sgidroot => i test" is left out. Fix it.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 tools/testing/selftests/capabilities/test_execve.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/capabilities/test_execve.c b/tools/testing/selftests/capabilities/test_execve.c
index 763f37fecfb8..7f2e999839c2 100644
--- a/tools/testing/selftests/capabilities/test_execve.c
+++ b/tools/testing/selftests/capabilities/test_execve.c
@@ -380,7 +380,8 @@ static int do_tests(int uid, const char *our_path)
 						true, true, true, false);
 	} else {
 		printf("[RUN]\tNon-root +ia, sgidnonroot => i\n");
-		exec_other_validate_cap("./validate_cap_sgidnonroot",
+		if (fork_wait())
+			exec_other_validate_cap("./validate_cap_sgidnonroot",
 					false, false, true, false);
 
 		if (fork_wait()) {
-- 
2.11.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web