Skip to contentSkip to conversation

Kselftest next update for Linux 6.8-rc1

GIT PULL Merged Shuah Khan 2 participants 2 messages Jan 9, 2024 – Jan 10, 2024

Subsystems (4)
lore
Share & tools
lore

Shuah Khan

author maintainer
#0 lore raw

Hi Linus,

Please pull the following Kselftest update for Linux 6.8-rc1.

This kselftest update for Linux 6.8-rc1 consists of enhancements to reporting test results, fixes to root and user run behavior and fixing ksft_print_msg() calls.

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit b85ea95d086471afb4ad062012a4d73cd328fa86:

Linux 6.7-rc1 (2023-11-12 16:19:07 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-next-6.8-rc1

for you to fetch changes up to ee9793be08b1a1c29308a099c01790a3befb390a:

tracing/selftests: Add ownership modification tests for eventfs (2023-12-22 10:01:41 -0700)

----------------------------------------------------------------
linux_kselftest-next-6.8-rc1

This kselftest update for Linux 6.8-rc1 consists of enhancements to reporting test results, fixes to root and user run behavior and fixing ksft_print_msg() calls.

----------------------------------------------------------------
Atul Kumar Pant (1):
selftests: sched: Remove initialization to 0 for a static variable

Mark Brown (3):
kselftest/vDSO: Make test name reporting for vdso_abi_test tooling friendly kselftest/vDSO: Fix message formatting for clock_id logging kselftest/vDSO: Use ksft_print_msg() rather than printf in vdso_test_abi

Osama Muhammad (1):
selftests: prctl: Add prctl test for PR_GET_NAME

Steven Rostedt (Google) (1):
tracing/selftests: Add ownership modification tests for eventfs

Swarup Laxman Kotiaklapudi (1):
selftests: capabilities: namespace create varies for root and normal user

angquan yu (3):
selftests:breakpoints: Fix Format String Warning in breakpoint_test selftests/breakpoints: Fix format specifier in ksft_print_msg in step_after_suspend_test.c selftests:x86: Fix Format String Warnings in lam.c

 .../selftests/breakpoints/breakpoint_test.c        |   4 +-
 .../breakpoints/step_after_suspend_test.c          |   2 +-
 tools/testing/selftests/capabilities/test_execve.c |   6 +-
 .../ftrace/test.d/00basic/test_ownership.tc        | 114 +++++++++++++++++++++
 tools/testing/selftests/prctl/set-process-name.c   |  32 ++++++
 tools/testing/selftests/sched/cs_prctl_test.c      |   2 +-
 tools/testing/selftests/vDSO/vdso_test_abi.c       |  72 +++++++------
 tools/testing/selftests/x86/lam.c                  |   4 +-
 8 files changed, 192 insertions(+), 44 deletions(-)
 create mode 100644 tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc

----------------------------------------------------------------

tools/testing/selftests/breakpoints/breakpoint_test.c +2 -2
index 3266cc9293fe..d46962a24724 100644
@@ -284,9 +284,9 @@ static void check_success(const char *msg)
 	nr_tests++;
 
 	if (ret)
-		ksft_test_result_pass(msg);
+		ksft_test_result_pass("%s", msg);
 	else
-		ksft_test_result_fail(msg);
+		ksft_test_result_fail("%s", msg);
 }
 
 static void launch_instruction_breakpoints(char *buf, int local, int global)
tools/testing/selftests/breakpoints/step_after_suspend_test.c +1 -1
index 2cf6f10ab7c4..b8703c499d28 100644
@@ -89,7 +89,7 @@ int run_test(int cpu)
 
 	wpid = waitpid(pid, &status, __WALL);
 	if (wpid != pid) {
-		ksft_print_msg("waitpid() failed: $s\n", strerror(errno));
+		ksft_print_msg("waitpid() failed: %s\n", strerror(errno));
 		return KSFT_FAIL;
 	}
 	if (WIFEXITED(status)) {
tools/testing/selftests/capabilities/test_execve.c +1 -5
index e3a352b020a7..7cde07a5df78 100644
@@ -88,11 +88,7 @@ static bool create_and_enter_ns(uid_t inner_uid)
 	outer_uid = getuid();
 	outer_gid = getgid();
 
-	/*
-	 * TODO: If we're already root, we could skip creating the userns.
-	 */
-
-	if (unshare(CLONE_NEWNS) == 0) {
+	if (outer_uid == 0 && unshare(CLONE_NEWNS) == 0) {
 		ksft_print_msg("[NOTE]\tUsing global UIDs for tests\n");
 		if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) != 0)
 			ksft_exit_fail_msg("PR_SET_KEEPCAPS - %s\n",
tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc new file +114 -0

114 lines not on this page · raw message

tools/testing/selftests/prctl/set-process-name.c +32 -0
index 3bc5e0e09eb9..562f707ba771 100644
@@ -12,6 +12,7 @@
 #define CHANGE_NAME "changename"
 #define EMPTY_NAME ""
 #define TASK_COMM_LEN 16
+#define MAX_PATH_LEN 50
 
 int set_name(char *name)
 {
@@ -47,6 +48,35 @@ int check_null_pointer(char *check_name)
 	return res;
 }
 
+int check_name(void)
+{
+
+	int pid;
+
+	pid = getpid();
+	FILE *fptr = NULL;
+	char path[MAX_PATH_LEN] = {};
+	char name[TASK_COMM_LEN] = {};
+	char output[TASK_COMM_LEN] = {};
+	int j;
+
+	j = snprintf(path, MAX_PATH_LEN, "/proc/self/task/%d/comm", pid);
+	fptr = fopen(path, "r");
+	if (!fptr)
+		return -EIO;
+
+	fscanf(fptr, "%s", output);
+	if (ferror(fptr))
+		return -EIO;
+
+	int res = prctl(PR_GET_NAME, name, NULL, NULL, NULL);
+
+	if (res < 0)
+		return -errno;
+
+	return !strcmp(output, name);
+}
+
 TEST(rename_process) {
 
 	EXPECT_GE(set_name(CHANGE_NAME), 0);
@@ -57,6 +87,8 @@ TEST(rename_process) {
 
 	EXPECT_GE(set_name(CHANGE_NAME), 0);
 	EXPECT_LT(check_null_pointer(CHANGE_NAME), 0);
+
+	EXPECT_TRUE(check_name());
 }
 
 TEST_HARNESS_MAIN
tools/testing/selftests/sched/cs_prctl_test.c +1 -1
index 3e1619b6bf2d..7ba057154343 100644
@@ -72,7 +72,7 @@ struct child_args {
 
 static struct child_args procs[MAX_PROCESSES];
 static int num_processes = 2;
-static int need_cleanup = 0;
+static int need_cleanup;
 
 static int _prctl(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4,
 		  unsigned long arg5)
tools/testing/selftests/vDSO/vdso_test_abi.c +39 -33

151 lines not on this page · raw message

tools/testing/selftests/x86/lam.c +2 -2
index 8f9b06d9ce03..215b8150b7cc 100644
@@ -817,7 +817,7 @@ static void run_test(struct testcases *test, int count)
 
 		/* return 3 is not support LA57, the case should be skipped */
 		if (ret == 3) {
-			ksft_test_result_skip(t->msg);
+			ksft_test_result_skip("%s", t->msg);
 			continue;
 		}
 
@@ -826,7 +826,7 @@ static void run_test(struct testcases *test, int count)
 		else
 			ret = !(t->expected);
 
-		ksft_test_result(ret, t->msg);
+		ksft_test_result(ret, "%s", t->msg);
 	}
 }
 
merge bot Merged
#1 lore raw
The pull request you sent on Tue, 9 Jan 2024 12:21:35 -0700:

The pull request you sent on Tue, 9 Jan 2024 12:21:35 -0700:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-next-6.8-rc1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ab27740f76654ed58dd32ac0ba0031c18a6dea3b

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html