[alternative-merged] selftests-mm-dont-needlessly-use-sudo-to-obtain-root-in-run_vmtestssh.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The quilt patch titled
     Subject: selftests/mm: don't needlessly use sudo to obtain root in run_vmtests.sh
has been removed from the -mm tree.  Its filename was
     selftests-mm-dont-needlessly-use-sudo-to-obtain-root-in-run_vmtestssh.patch

This patch was dropped because an alternative patch was or shall be merged

------------------------------------------------------
From: Mark Brown <broonie@xxxxxxxxxx>
Subject: selftests/mm: don't needlessly use sudo to obtain root in run_vmtests.sh
Date: Fri, 09 Feb 2024 20:21:52 +0000

When opening yama/ptrace_scope we unconditionally use sudo to ensure we
are running as root, resulting in failures if running in a minimal root
filesystem where sudo is not installed.  Since automated test systems will
typically just run all of kselftest as root (and many kselftests rely on
this for full functionality) add a check to see if we're already root and
only invoke sudo if not.

Since I am unclear what the intended effect of the command being run is I
have not added any error handling for the case where we fail to obtain
root.

Link: https://lkml.kernel.org/r/20240209-kselftest-mm-check-deps-v1-1-19b09b151522@xxxxxxxxxx
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
Cc: Shuah Khan <shuah@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 tools/testing/selftests/mm/run_vmtests.sh |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

--- a/tools/testing/selftests/mm/run_vmtests.sh~selftests-mm-dont-needlessly-use-sudo-to-obtain-root-in-run_vmtestssh
+++ a/tools/testing/selftests/mm/run_vmtests.sh
@@ -237,6 +237,17 @@ run_test() {
 
 echo "TAP version 13" | tap_output
 
+HAVE_ROOT=0
+if [ "$(id -u)" = "0" ]; then
+	AS_ROOT=
+	HAVE_ROOT=1
+elif [ "$(command -v sudo)" != "" ]; then
+	AS_ROOT=sudo
+	HAVE_ROOT=1
+else
+	echo # WARNING: Unable to run as root
+fi
+
 CATEGORY="hugetlb" run_test ./hugepage-mmap
 
 shmmax=$(cat /proc/sys/kernel/shmmax)
@@ -351,7 +362,8 @@ CATEGORY="hmm" run_test bash ./test_hmm.
 # MADV_POPULATE_READ and MADV_POPULATE_WRITE tests
 CATEGORY="madv_populate" run_test ./madv_populate
 
-(echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope 2>&1) | tap_prefix
+# FIXME: What if we can't get root?
+(echo 0 | ${AS_ROOT} tee /proc/sys/kernel/yama/ptrace_scope 2>&1) | tap_prefix
 CATEGORY="memfd_secret" run_test ./memfd_secret
 
 # KSM KSM_MERGE_TIME_HUGE_PAGES test with size of 100
_

Patches currently in -mm which might be from broonie@xxxxxxxxxx are

selftests-mm-log-skipped-compaction-test-as-a-skip.patch
selftests-mm-log-a-consistent-test-name-for-check_compaction.patch





[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux