linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] selftests/lkdtm: Use /bin/sh not $SHELL
@ 2021-06-19  2:58 Kees Cook
  2021-06-23 12:39 ` Guillaume Tucker
  2021-06-23 14:35 ` [selftests/lkdtm] 84d8cf25b0: kernel_BUG_at_drivers/misc/lkdtm/bugs.c kernel test robot
  0 siblings, 2 replies; 11+ messages in thread
From: Kees Cook @ 2021-06-19  2:58 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Kees Cook, Guillaume Tucker, stable, linux-kselftest, linux-kernel

Some environments do not set $SHELL when running tests. There's no need
to use $SHELL here anyway, so just replace it with hard-coded path
instead. Additionally avoid using bash-isms in the command, so that
regular /bin/sh can be used.

Suggested-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 tools/testing/selftests/lkdtm/run.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/lkdtm/run.sh b/tools/testing/selftests/lkdtm/run.sh
index bb7a1775307b..0f9f22ac004b 100755
--- a/tools/testing/selftests/lkdtm/run.sh
+++ b/tools/testing/selftests/lkdtm/run.sh
@@ -78,8 +78,9 @@ dmesg > "$DMESG"
 
 # Most shells yell about signals and we're expecting the "cat" process
 # to usually be killed by the kernel. So we have to run it in a sub-shell
-# and silence errors.
-($SHELL -c 'cat <(echo '"$test"') >'"$TRIGGER" 2>/dev/null) || true
+# to avoid terminating this script. Leave stderr alone, just in case
+# something _else_ happens.
+(/bin/sh -c '(echo '"$test"') | cat >'"$TRIGGER") || true
 
 # Record and dump the results
 dmesg | comm --nocheck-order -13 "$DMESG" - > "$LOG" || true
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-06-24  7:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-19  2:58 [PATCH v2] selftests/lkdtm: Use /bin/sh not $SHELL Kees Cook
2021-06-23 12:39 ` Guillaume Tucker
2021-06-23 13:43   ` David Laight
2021-06-23 16:18     ` Kees Cook
2021-06-23 16:27       ` David Laight
2021-06-23 22:46         ` Kees Cook
2021-06-24  7:21           ` David Laight
2021-06-23 14:38   ` Kees Cook
2021-06-23 15:19     ` Guillaume Tucker
2021-06-23 14:35 ` [selftests/lkdtm] 84d8cf25b0: kernel_BUG_at_drivers/misc/lkdtm/bugs.c kernel test robot
2021-06-23 14:30   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).