lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 14 Mar 2024 13:54:50 +0500
From: Muhammad Usama Anjum <usama.anjum@...labora.com>
To: Kees Cook <keescook@...omium.org>, Eric Biederman <ebiederm@...ssion.com>
Cc: Muhammad Usama Anjum <usama.anjum@...labora.com>,
 Shuah Khan <shuah@...nel.org>, Mark Brown <broonie@...nel.org>,
 linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] selftests/exec: execveat: Improve debug reporting

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@...omium.org>
> ---
> Cc: Eric Biederman <ebiederm@...ssion.com>
> Cc: Shuah Khan <shuah@...nel.org>
> Cc: Mark Brown <broonie@...nel.org>
> Cc: Muhammad Usama Anjum <usama.anjum@...labora.com>
> Cc: linux-mm@...ck.org
> Cc: linux-kselftest@...r.kernel.org
Reviewed-by: Muhammad Usama Anjum <usama.anjum@...labora.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ