* [PATCH] selftests/exec: execveat: Improve debug reporting
@ 2024-03-13 18:56 Kees Cook
2024-03-14 8:54 ` Muhammad Usama Anjum
0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2024-03-13 18:56 UTC (permalink / raw)
To: Eric Biederman
Cc: Kees Cook, Shuah Khan, Mark Brown, Muhammad Usama Anjum,
linux-mm, linux-kselftest, linux-kernel, linux-hardening
Children processes were reporting their status, duplicating the
parent's. Remove that, and add some additional details about the test
execution.
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: Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
---
tools/testing/selftests/exec/execveat.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/exec/execveat.c b/tools/testing/selftests/exec/execveat.c
index 0546ca24f2b2..6418ded40bdd 100644
--- a/tools/testing/selftests/exec/execveat.c
+++ b/tools/testing/selftests/exec/execveat.c
@@ -98,10 +98,9 @@ static int check_execveat_invoked_rc(int fd, const char *path, int flags,
if (child == 0) {
/* Child: do execveat(). */
rc = execveat_(fd, path, argv, envp, flags);
- ksft_print_msg("execveat() failed, rc=%d errno=%d (%s)\n",
+ ksft_print_msg("child execveat() failed, rc=%d errno=%d (%s)\n",
rc, errno, strerror(errno));
- ksft_test_result_fail("%s\n", test_name);
- exit(1); /* should not reach here */
+ exit(errno);
}
/* Parent: wait for & check child's exit status. */
rc = waitpid(child, &status, 0);
@@ -226,11 +225,14 @@ static int check_execveat_pathmax(int root_dfd, const char *src, int is_script)
* "If the command name is found, but it is not an executable utility,
* the exit status shall be 126."), so allow either.
*/
- if (is_script)
+ if (is_script) {
+ ksft_print_msg("Invoke script via root_dfd and relative filename\n");
fail += check_execveat_invoked_rc(root_dfd, longpath + 1, 0,
127, 126);
- else
+ } else {
+ ksft_print_msg("Invoke exec via root_dfd and relative filename\n");
fail += check_execveat(root_dfd, longpath + 1, 0);
+ }
return fail;
}
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests/exec: execveat: Improve debug reporting
2024-03-13 18:56 [PATCH] selftests/exec: execveat: Improve debug reporting Kees Cook
@ 2024-03-14 8:54 ` Muhammad Usama Anjum
2024-03-26 20:46 ` Shuah Khan
0 siblings, 1 reply; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-03-14 8:54 UTC (permalink / raw)
To: Kees Cook, Eric Biederman
Cc: Muhammad Usama Anjum, Shuah Khan, Mark Brown, linux-mm,
linux-kselftest, linux-kernel, linux-hardening
On 3/13/24 11:56 PM, Kees Cook wrote:
> Children processes were reporting their status, duplicating the
> parent's. Remove that, and add some additional details about the test
> execution.
>
> 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: Muhammad Usama Anjum <usama.anjum@collabora.com>
> Cc: linux-mm@kvack.org
> Cc: linux-kselftest@vger.kernel.org
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> tools/testing/selftests/exec/execveat.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/exec/execveat.c b/tools/testing/selftests/exec/execveat.c
> index 0546ca24f2b2..6418ded40bdd 100644
> --- a/tools/testing/selftests/exec/execveat.c
> +++ b/tools/testing/selftests/exec/execveat.c
> @@ -98,10 +98,9 @@ static int check_execveat_invoked_rc(int fd, const char *path, int flags,
> if (child == 0) {
> /* Child: do execveat(). */
> rc = execveat_(fd, path, argv, envp, flags);
> - ksft_print_msg("execveat() failed, rc=%d errno=%d (%s)\n",
> + ksft_print_msg("child execveat() failed, rc=%d errno=%d (%s)\n",
> rc, errno, strerror(errno));
> - ksft_test_result_fail("%s\n", test_name);
> - exit(1); /* should not reach here */
> + exit(errno);
> }
> /* Parent: wait for & check child's exit status. */
> rc = waitpid(child, &status, 0);
> @@ -226,11 +225,14 @@ static int check_execveat_pathmax(int root_dfd, const char *src, int is_script)
> * "If the command name is found, but it is not an executable utility,
> * the exit status shall be 126."), so allow either.
> */
> - if (is_script)
> + if (is_script) {
> + ksft_print_msg("Invoke script via root_dfd and relative filename\n");
> fail += check_execveat_invoked_rc(root_dfd, longpath + 1, 0,
> 127, 126);
> - else
> + } else {
> + ksft_print_msg("Invoke exec via root_dfd and relative filename\n");
> fail += check_execveat(root_dfd, longpath + 1, 0);
> + }
>
> return fail;
> }
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests/exec: execveat: Improve debug reporting
2024-03-14 8:54 ` Muhammad Usama Anjum
@ 2024-03-26 20:46 ` Shuah Khan
2024-03-26 22:40 ` Kees Cook
0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2024-03-26 20:46 UTC (permalink / raw)
To: Muhammad Usama Anjum, Kees Cook, Eric Biederman
Cc: Shuah Khan, Mark Brown, linux-mm, linux-kselftest, linux-kernel,
linux-hardening, Shuah Khan
On 3/14/24 02:54, Muhammad Usama Anjum wrote:
> On 3/13/24 11:56 PM, Kees Cook wrote:
>> Children processes were reporting their status, duplicating the
>> parent's. Remove that, and add some additional details about the test
>> execution.
>>
>> 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: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> Cc: linux-mm@kvack.org
>> Cc: linux-kselftest@vger.kernel.org
> Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>
Applied to linux-kselftest fixes for the next rc.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests/exec: execveat: Improve debug reporting
2024-03-26 20:46 ` Shuah Khan
@ 2024-03-26 22:40 ` Kees Cook
2024-03-27 16:19 ` Shuah Khan
0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2024-03-26 22:40 UTC (permalink / raw)
To: Shuah Khan
Cc: Muhammad Usama Anjum, Eric Biederman, Shuah Khan, Mark Brown,
linux-mm, linux-kselftest, linux-kernel, linux-hardening
On Tue, Mar 26, 2024 at 02:46:02PM -0600, Shuah Khan wrote:
> On 3/14/24 02:54, Muhammad Usama Anjum wrote:
> > On 3/13/24 11:56 PM, Kees Cook wrote:
> > > Children processes were reporting their status, duplicating the
> > > parent's. Remove that, and add some additional details about the test
> > > execution.
> > >
> > > 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: Muhammad Usama Anjum <usama.anjum@collabora.com>
> > > Cc: linux-mm@kvack.org
> > > Cc: linux-kselftest@vger.kernel.org
> > Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> >
>
> Applied to linux-kselftest fixes for the next rc.
This is already part of the execve tree...
--
Kees Cook
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests/exec: execveat: Improve debug reporting
2024-03-26 22:40 ` Kees Cook
@ 2024-03-27 16:19 ` Shuah Khan
0 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2024-03-27 16:19 UTC (permalink / raw)
To: Kees Cook
Cc: Muhammad Usama Anjum, Eric Biederman, Shuah Khan, Mark Brown,
linux-mm, linux-kselftest, linux-kernel, linux-hardening,
Shuah Khan
On 3/26/24 16:40, Kees Cook wrote:
> On Tue, Mar 26, 2024 at 02:46:02PM -0600, Shuah Khan wrote:
>> On 3/14/24 02:54, Muhammad Usama Anjum wrote:
>>> On 3/13/24 11:56 PM, Kees Cook wrote:
>>>> Children processes were reporting their status, duplicating the
>>>> parent's. Remove that, and add some additional details about the test
>>>> execution.
>>>>
>>>> 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: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>>> Cc: linux-mm@kvack.org
>>>> Cc: linux-kselftest@vger.kernel.org
>>> Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>>
>>
>> Applied to linux-kselftest fixes for the next rc.
>
> This is already part of the execve tree...
>
Thanks. I will go drop it.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-03-27 16:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 18:56 [PATCH] selftests/exec: execveat: Improve debug reporting Kees Cook
2024-03-14 8:54 ` Muhammad Usama Anjum
2024-03-26 20:46 ` Shuah Khan
2024-03-26 22:40 ` Kees Cook
2024-03-27 16:19 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox