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]
Message-Id: <20250113201351.3f48cc86f06a7dc01d497872@linux-foundation.org>
Date: Mon, 13 Jan 2025 20:13:51 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: liuye <liuye@...inos.cn>
Cc: shuah@...nel.org, jeffxu@...gle.com, isaacmanjarres@...gle.com,
 lorenzo.stoakes@...cle.com, gthelen@...gle.com, sauravshah.31@...il.com,
 linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests/memfd/memfd_test: Fix possible NULL pointer
 dereference

On Tue, 14 Jan 2025 11:21:15 +0800 liuye <liuye@...inos.cn> wrote:

>     If name is NULL, a NULL pointer may be accessed in printf.
> 
> ...
>
> --- a/tools/testing/selftests/memfd/memfd_test.c
> +++ b/tools/testing/selftests/memfd/memfd_test.c
> @@ -171,7 +171,7 @@ static void mfd_fail_new(const char *name, unsigned int flags)
>  	r = sys_memfd_create(name, flags);
>  	if (r >= 0) {
>  		printf("memfd_create(\"%s\", %u) succeeded, but failure expected\n",
> -		       name, flags);
> +		       name ? name : "NULL", flags);
>  		close(r);
>  		abort();

Well huh.  I though printf() would emit "(null)" in this situation, but
my super-sophisticated test case says "core dumped".

#include <stdio.h>
#include <stdlib.h>

int main()
{
	printf("%s\n", (char *)0);
	exit(0);
}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ