<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/tools/testing/selftests/exec/execveat.c, branch v6.12.80</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>selftests/exec: Fix grammar in an error message.</title>
<updated>2024-07-31T17:42:30+00:00</updated>
<author>
<name>Chang Yu</name>
<email>marcus.yu.56@gmail.com</email>
</author>
<published>2024-07-24T04:21:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=37ee7d1995701c1819e1cc984bdd111fe23c7f5f'/>
<id>37ee7d1995701c1819e1cc984bdd111fe23c7f5f</id>
<content type='text'>
Replace "not ... nor" in the error message with "neither ... nor".

Signed-off-by: Chang Yu &lt;marcus.yu.56@gmail.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace "not ... nor" in the error message with "neither ... nor".

Signed-off-by: Chang Yu &lt;marcus.yu.56@gmail.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests/exec: execveat: Improve debug reporting</title>
<updated>2024-03-18T18:19:37+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2024-03-13T18:56:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=0ef58ccb6178b1a40edfd027d8a11a52fa629215'/>
<id>0ef58ccb6178b1a40edfd027d8a11a52fa629215</id>
<content type='text'>
Children processes were reporting their status, duplicating the
parent's. Remove that, and add some additional details about the test
execution.

Reviewed-by: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Link: https://lore.kernel.org/r/20240313185606.work.073-kees@kernel.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Children processes were reporting their status, duplicating the
parent's. Remove that, and add some additional details about the test
execution.

Reviewed-by: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Link: https://lore.kernel.org/r/20240313185606.work.073-kees@kernel.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests/exec: Perform script checks with /bin/bash</title>
<updated>2024-03-06T00:06:01+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2024-03-06T00:06:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=17107429947b5d8a15f6dcef15c287eeade97258'/>
<id>17107429947b5d8a15f6dcef15c287eeade97258</id>
<content type='text'>
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 &lt;usama.anjum@collabora.com&gt;
Closes: https://lore.kernel.org/lkml/02c8bf8e-1934-44ab-a886-e065b37366a7@collabora.com/
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
---
Cc: Eric Biederman &lt;ebiederm@xmission.com&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: Mark Brown &lt;broonie@kernel.org&gt;
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;usama.anjum@collabora.com&gt;
Closes: https://lore.kernel.org/lkml/02c8bf8e-1934-44ab-a886-e065b37366a7@collabora.com/
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
---
Cc: Eric Biederman &lt;ebiederm@xmission.com&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: Mark Brown &lt;broonie@kernel.org&gt;
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests/exec: Convert execveat test to generate KTAP output</title>
<updated>2023-10-05T20:50:03+00:00</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2023-09-28T14:38:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=47903c1d153d5178d54ea086e2bfa5298506f04f'/>
<id>47903c1d153d5178d54ea086e2bfa5298506f04f</id>
<content type='text'>
Currently the execveat test does not produce KTAP output but rather a
custom format. This means that we only get a pass/fail for the suite, not
for each individual test that the suite does. Convert to using the standard
kselftest output functions which result in KTAP output being generated.

The main trick with this is that, being an exec() related test, the
program executes itself and returns specific exit codes to verify
success meaning that we need to only use the top level kselftest
header/summary functions when invoked directly rather than when run as
part of a test.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently the execveat test does not produce KTAP output but rather a
custom format. This means that we only get a pass/fail for the suite, not
for each individual test that the suite does. Convert to using the standard
kselftest output functions which result in KTAP output being generated.

The main trick with this is that, being an exec() related test, the
program executes itself and returns specific exit codes to verify
success meaning that we need to only use the top level kselftest
header/summary functions when invoked directly rather than when run as
part of a test.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests/exec: Verify execve of non-regular files fail</title>
<updated>2020-05-22T15:29:00+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2020-05-18T04:47:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=61016db15b8e20f371352db6a75b044ec3183fe7'/>
<id>61016db15b8e20f371352db6a75b044ec3183fe7</id>
<content type='text'>
Add a named pipe as an exec target to make sure that non-regular
files are rejected by execve() with EACCES. This can help verify
commit 73601ea5b7b1 ("fs/open.c: allow opening only regular files
during execve()").

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a named pipe as an exec target to make sure that non-regular
files are rejected by execve() with EACCES. This can help verify
commit 73601ea5b7b1 ("fs/open.c: allow opening only regular files
during execve()").

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166</title>
<updated>2019-05-30T18:26:39+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2019-05-27T06:55:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=4f19048fd0a0036e02443237952db5bfa5b5cdf0'/>
<id>4f19048fd0a0036e02443237952db5bfa5b5cdf0</id>
<content type='text'>
Based on 1 normalized pattern(s):

  licensed under the terms of the gnu gpl license version 2

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 62 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Reviewed-by: Kate Stewart &lt;kstewart@linuxfoundation.org&gt;
Reviewed-by: Richard Fontana &lt;rfontana@redhat.com&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.929121379@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Based on 1 normalized pattern(s):

  licensed under the terms of the gnu gpl license version 2

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 62 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Reviewed-by: Kate Stewart &lt;kstewart@linuxfoundation.org&gt;
Reviewed-by: Richard Fontana &lt;rfontana@redhat.com&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.929121379@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests: exec: return Kselftest Skip code for skipped tests</title>
<updated>2018-05-30T21:21:52+00:00</updated>
<author>
<name>Shuah Khan (Samsung OSG)</name>
<email>shuah@kernel.org</email>
</author>
<published>2018-05-03T00:24:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=964224d7a861955a07080e3acff481f6ff772546'/>
<id>964224d7a861955a07080e3acff481f6ff772546</id>
<content type='text'>
When execveat test is skipped because of unmet dependencies and/or
unsupported configuration, it exits with error which is treated as
a fail by the Kselftest framework. This leads to false negative
result even when the test could not be run.

Change it to return kselftest skip code when a test gets skipped to
clearly report that the test could not be run.

Change it to use ksft_exit_skip() when kernel doesn't support execveat.

Signed-off-by: Shuah Khan (Samsung OSG) &lt;shuah@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When execveat test is skipped because of unmet dependencies and/or
unsupported configuration, it exits with error which is treated as
a fail by the Kselftest framework. This leads to false negative
result even when the test could not be run.

Change it to return kselftest skip code when a test gets skipped to
clearly report that the test could not be run.

Change it to use ksft_exit_skip() when kernel doesn't support execveat.

Signed-off-by: Shuah Khan (Samsung OSG) &lt;shuah@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests/exec: include cwd in long path calculation</title>
<updated>2017-11-15T15:01:42+00:00</updated>
<author>
<name>Steve Muckle</name>
<email>smuckle.linux@gmail.com</email>
</author>
<published>2017-10-13T04:44:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=2d80c92d6cae986e8f3f04e64dbea9883680ae1c'/>
<id>2d80c92d6cae986e8f3f04e64dbea9883680ae1c</id>
<content type='text'>
When creating a pathname close to PATH_MAX to test execveat, factor in
the current working directory path otherwise we end up with an absolute
path that is longer than PATH_MAX. While execveat() may succeed, subsequent
calls to the kernel from the runtime environment which are required to
successfully execute the test binary/script may fail because of this.

To keep the semantics of the test the same, rework the relative pathname
part of the test to be relative to the root directory so it isn't
decreased by the length of the current working directory path.

Signed-off-by: Steve Muckle &lt;smuckle.linux@gmail.com&gt;
Signed-off-by: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When creating a pathname close to PATH_MAX to test execveat, factor in
the current working directory path otherwise we end up with an absolute
path that is longer than PATH_MAX. While execveat() may succeed, subsequent
calls to the kernel from the runtime environment which are required to
successfully execute the test binary/script may fail because of this.

To keep the semantics of the test the same, rework the relative pathname
part of the test to be relative to the root directory so it isn't
decreased by the length of the current working directory path.

Signed-off-by: Steve Muckle &lt;smuckle.linux@gmail.com&gt;
Signed-off-by: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests/exec: Check if the syscall exists and bail if not</title>
<updated>2015-03-11T16:15:19+00:00</updated>
<author>
<name>Michael Ellerman</name>
<email>mpe@ellerman.id.au</email>
</author>
<published>2015-02-03T03:53:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=9a0b57451ae8142c74d65bddb6d7765818babbed'/>
<id>9a0b57451ae8142c74d65bddb6d7765818babbed</id>
<content type='text'>
On systems which don't implement sys_execveat(), this test produces a
lot of output.

Add a check at the beginning to see if the syscall is present, and if
not just note one error and return.

When we run on a system that doesn't implement the syscall we will get
ENOSYS back from the kernel, so change the logic that handles
__NR_execveat not being defined to also use ENOSYS rather than -ENOSYS.

Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Acked-by: David Drysdale &lt;drysdale@google.com&gt;
Signed-off-by: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On systems which don't implement sys_execveat(), this test produces a
lot of output.

Add a check at the beginning to see if the syscall is present, and if
not just note one error and return.

When we run on a system that doesn't implement the syscall we will get
ENOSYS back from the kernel, so change the logic that handles
__NR_execveat not being defined to also use ENOSYS rather than -ENOSYS.

Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Acked-by: David Drysdale &lt;drysdale@google.com&gt;
Signed-off-by: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests/exec: allow shell return code of 126</title>
<updated>2015-01-06T19:54:54+00:00</updated>
<author>
<name>David Drysdale</name>
<email>drysdale@google.com</email>
</author>
<published>2015-01-06T08:23:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=cd805f367633f6540aa287751c270973b7e4cdc9'/>
<id>cd805f367633f6540aa287751c270973b7e4cdc9</id>
<content type='text'>
When the shell fails to invoke a script because its path name
is too long (ENAMETOOLONG), most shells return 127 to indicate
command not found.  However, some systems report 126 (which POSIX
suggests should indicate a non-executable file) for this case,
so allow that too.

Reported-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Signed-off-by: David Drysdale &lt;drysdale@google.com&gt;
Tested-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Signed-off-by: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the shell fails to invoke a script because its path name
is too long (ENAMETOOLONG), most shells return 127 to indicate
command not found.  However, some systems report 126 (which POSIX
suggests should indicate a non-executable file) for this case,
so allow that too.

Reported-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Signed-off-by: David Drysdale &lt;drysdale@google.com&gt;
Tested-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Signed-off-by: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
