Commit 4b95dc87 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'linux_kselftest-next-6.10-rc1' of...

Merge tag 'linux_kselftest-next-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest updates from Shuah Khan:

 - make framework and tests reporting KTAP compliant

 - make ktap_helpers and power_supply test POSIX compliant

 - add ksft_exit_fail_perror() to include errono in string form

 - avoid clang reporting false positive static analysis errors about
   functions that exit and never return. ksft_exit* functions are marked
   __noreturn to address this problem

 - add mechanism for reporting a KSFT_ result code

 - fix build warnings related missing headers and unused variables

 - fix clang build failures

 - cleanups to resctrl test

 - add host arch for LLVM builds

* tag 'linux_kselftest-next-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (44 commits)
  selftests/sgx: Include KHDR_INCLUDES in Makefile
  selftests: Compile kselftest headers with -D_GNU_SOURCE
  selftests/resctrl: fix clang build warnings related to abs(), labs() calls
  selftests/ftrace: Fix checkbashisms errors
  selftests/ftrace: Fix BTFARG testcase to check fprobe is enabled correctly
  selftests/capabilities: fix warn_unused_result build warnings
  selftests: filesystems: add missing stddef header
  selftests: kselftest_deps: fix l5_test() empty variable
  selftests: default to host arch for LLVM builds
  selftests/resctrl: fix clang build failure: use LOCAL_HDRS
  selftests/binderfs: use the Makefile's rules, not Make's implicit rules
  Documentation: kselftest: fix codeblock
  selftests: kselftest: Make ksft_exit functions return void instead of int
  selftests: x86: ksft_exit_pass() does not return
  selftests: timers: ksft_exit functions do not return
  selftests: sync: ksft_exit_pass() does not return
  selftests/resctrl: ksft_exit_skip() does not return
  selftests: pidfd: ksft_exit functions do not return
  selftests/mm: ksft_exit functions do not return
  selftests: membarrier: ksft_exit_pass() does not return
  ...
parents 896d3fce 2c3b8f8f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ expected time it takes to run a test. If you have control over the systems
which will run the tests you can configure a test runner on those systems to
use a greater or lower timeout on the command line as with the `-o` or
the `--override-timeout` argument. For example to use 165 seconds instead
one would use:
one would use::

   $ ./run_kselftest.sh --override-timeout 165

+2 −2
Original line number Diff line number Diff line
@@ -161,11 +161,11 @@ ifneq ($(KBUILD_OUTPUT),)
  # $(realpath ...) resolves symlinks
  abs_objtree := $(realpath $(abs_objtree))
  BUILD := $(abs_objtree)/kselftest
  KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include
  KHDR_INCLUDES := -D_GNU_SOURCE -isystem ${abs_objtree}/usr/include
else
  BUILD := $(CURDIR)
  abs_srctree := $(shell cd $(top_srcdir) && pwd)
  KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include
  KHDR_INCLUDES := -D_GNU_SOURCE -isystem ${abs_srctree}/usr/include
  DEFAULT_INSTALL_HDR_PATH := 1
endif

+9 −3
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ static bool create_and_enter_ns(uid_t inner_uid)
{
	uid_t outer_uid;
	gid_t outer_gid;
	int i;
	int i, ret;
	bool have_outer_privilege;

	outer_uid = getuid();
@@ -97,7 +97,10 @@ static bool create_and_enter_ns(uid_t inner_uid)
			ksft_exit_fail_msg("setresuid - %s\n", strerror(errno));

		// Re-enable effective caps
		capng_get_caps_process();
		ret = capng_get_caps_process();
		if (ret == -1)
			ksft_exit_fail_msg("capng_get_caps_process failed\n");

		for (i = 0; i < CAP_LAST_CAP; i++)
			if (capng_have_capability(CAPNG_PERMITTED, i))
				capng_update(CAPNG_ADD, CAPNG_EFFECTIVE, i);
@@ -207,6 +210,7 @@ static void exec_validate_cap(bool eff, bool perm, bool inh, bool ambient)

static int do_tests(int uid, const char *our_path)
{
	int ret;
	bool have_outer_privilege = create_and_enter_ns(uid);

	int ourpath_fd = open(our_path, O_RDONLY | O_DIRECTORY);
@@ -250,7 +254,9 @@ static int do_tests(int uid, const char *our_path)
			ksft_exit_fail_msg("chmod - %s\n", strerror(errno));
	}

	capng_get_caps_process();
	ret = capng_get_caps_process();
	if (ret == -1)
		ksft_exit_fail_msg("capng_get_caps_process failed\n");

	/* Make sure that i starts out clear */
	capng_update(CAPNG_DROP, CAPNG_INHERITABLE, CAP_NET_BIND_SERVICE);
+6 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ static bool bool_arg(char **argv, int i)
int main(int argc, char **argv)
{
	const char *atsec = "";
	int ret;

	/*
	 * Be careful just in case a setgid or setcapped copy of this
@@ -44,7 +45,11 @@ int main(int argc, char **argv)
		atsec = " (AT_SECURE is not set)";
#endif

	capng_get_caps_process();
	ret = capng_get_caps_process();
	if (ret == -1) {
		ksft_print_msg("capng_get_caps_process failed\n");
		return 1;
	}

	if (capng_have_capability(CAPNG_EFFECTIVE, CAP_NET_BIND_SERVICE) != bool_arg(argv, 1)) {
		ksft_print_msg("Wrong effective state%s\n", atsec);
+6 −1
Original line number Diff line number Diff line
@@ -95,9 +95,14 @@ static int call_clone3(uint64_t flags, size_t size, enum test_mode test_mode)
			getpid(), pid);

	if (waitpid(-1, &status, __WALL) < 0) {
		ksft_print_msg("Child returned %s\n", strerror(errno));
		ksft_print_msg("waitpid() returned %s\n", strerror(errno));
		return -errno;
	}
	if (!WIFEXITED(status)) {
		ksft_print_msg("Child did not exit normally, status 0x%x\n",
			       status);
		return EXIT_FAILURE;
	}
	if (WEXITSTATUS(status))
		return WEXITSTATUS(status);

Loading