diff options
author | Kees Cook <keescook@chromium.org> | 2024-03-06 03:06:01 +0300 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2024-03-06 03:06:01 +0300 |
commit | 17107429947b5d8a15f6dcef15c287eeade97258 (patch) | |
tree | 4e33256c8e6677d9ba1adaa00ed9e053eba4c5ae /tools/testing/selftests/exec | |
parent | d3f0d7bbaefd3465e95da2500640732a5cc8bedf (diff) | |
download | linux-17107429947b5d8a15f6dcef15c287eeade97258.tar.xz |
selftests/exec: Perform script checks with /bin/bash
It seems some shells linked to /bin/sh don't have consistent behavior
with error codes on execution failures. Explicitly use /bin/bash so that
"not found" errors are correctly generated. Repeating the comment from
the test:
/*
* Execute as a long pathname relative to "/". If this is a script,
* the interpreter will launch but fail to open the script because its
* name ("/dev/fd/5/xxx....") is bigger than PATH_MAX.
*
* The failure code is usually 127 (POSIX: "If a command is not found,
* the exit status shall be 127."), but some systems give 126 (POSIX:
* "If the command name is found, but it is not an executable utility,
* the exit status shall be 126."), so allow either.
*/
Reported-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Closes: https://lore.kernel.org/lkml/02c8bf8e-1934-44ab-a886-e065b37366a7@collabora.com/
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
Diffstat (limited to 'tools/testing/selftests/exec')
-rw-r--r-- | tools/testing/selftests/exec/execveat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/exec/execveat.c b/tools/testing/selftests/exec/execveat.c index bf79d664c8e6..0546ca24f2b2 100644 --- a/tools/testing/selftests/exec/execveat.c +++ b/tools/testing/selftests/exec/execveat.c @@ -393,7 +393,7 @@ static int run_tests(void) static void prerequisites(void) { int fd; - const char *script = "#!/bin/sh\nexit $*\n"; + const char *script = "#!/bin/bash\nexit $*\n"; /* Create ephemeral copies of files */ exe_cp("execveat", "execveat.ephemeral"); |