Skip to content

Commit 1710742

Browse files
committed
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 <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Kees Cook <[email protected]> --- Cc: Eric Biederman <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Mark Brown <[email protected]> Cc: [email protected] Cc: [email protected]
1 parent d3f0d7b commit 1710742

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/exec/execveat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ static int run_tests(void)
393393
static void prerequisites(void)
394394
{
395395
int fd;
396-
const char *script = "#!/bin/sh\nexit $*\n";
396+
const char *script = "#!/bin/bash\nexit $*\n";
397397

398398
/* Create ephemeral copies of files */
399399
exe_cp("execveat", "execveat.ephemeral");

0 commit comments

Comments
 (0)