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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240804105716.GA2581863@kernel.org>
Date: Sun, 4 Aug 2024 11:57:16 +0100
From: Simon Horman <horms@...nel.org>
To: zhanghao <zhanghao1@...inos.cn>
Cc: bongsu.jeon@...sung.com, krzk@...nel.org,
	syzbot+3da70a0abd7f5765b6ea@...kaller.appspotmail.com,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] nfc: nci: Fix uninit-value in nci_rx_work()

On Sat, Aug 03, 2024 at 08:18:17PM +0800, zhanghao wrote:
> Commit e624e6c3e777 ("nfc: Add a virtual nci device driver")
> calls alloc_skb() with GFP_KERNEL as the argument flags.The
> allocated heap memory was not initialized.This causes KMSAN
> to detect an uninitialized value.
> 
> Reported-by: syzbot+3da70a0abd7f5765b6ea@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=3da70a0abd7f5765b6ea

Hi,

I wonder if the problem reported above is caused by accessing packet
data which is past the end of what is copied in virtual_ncidev_write().
I.e. count is unusually short and this is not being detected.

> Fixes: e624e6c3e777 ("nfc: Add a virtual nci device driver")
> Link: https://lore.kernel.org/all/000000000000747dd6061a974686@google.com/T/
> Signed-off-by: zhanghao <zhanghao1@...inos.cn>
> ---
>  drivers/nfc/virtual_ncidev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nfc/virtual_ncidev.c b/drivers/nfc/virtual_ncidev.c
> index 6b89d596ba9a..ae1592db131e 100644
> --- a/drivers/nfc/virtual_ncidev.c
> +++ b/drivers/nfc/virtual_ncidev.c
> @@ -117,7 +117,7 @@ static ssize_t virtual_ncidev_write(struct file *file,
>  	struct virtual_nci_dev *vdev = file->private_data;
>  	struct sk_buff *skb;
>  
> -	skb = alloc_skb(count, GFP_KERNEL);
> +	skb = alloc_skb(count, GFP_KERNEL|__GFP_ZERO);
>  	if (!skb)
>  		return -ENOMEM;

I'm not sure this helps wrt initialising the memory as immediately below there
is;

	if (copy_from_user(skb_put(skb, count), buf, count)) {
		...

Which I assume will initialise count bytes of skb data.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ