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: <4FA345DA4F4AE44899BD2B03EEEC2FA908F81A8E@SACEXCMBX04-PRD.hq.netapp.com>
Date:	Mon, 3 Sep 2012 18:39:10 +0000
From:	"Myklebust, Trond" <Trond.Myklebust@...app.com>
To:	Andi Kleen <andi@...stfloor.org>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Fix memset in NFS zap caches

On Mon, 2012-09-03 at 20:35 +0200, Andi Kleen wrote:
> Fix memset in nfs_zap_caches_locked
> 
> This memset overruns the buffer by 4 bytes on 64bit systems.
> 
> gcc 4.8 correct complains:
> 
> /backup/lsrc/git/linux-lto-2.6/fs/nfs/inode.c: In function
> 'nfs_zap_caches_locked':
> /backup/lsrc/git/linux-lto-2.6/fs/nfs/inode.c:157:41: warning: argument
> to 'sizeof' in 'memset' call is the same pointer type '__be32 *' as the
> destination; expected '__be32' or an explicit length
> [-Wsizeof-pointer-memaccess]
>   memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode)));
>                                          ^
> Add a * to sizeof the correct type.
> 
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> 
> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> index c6e895f..69e7f0f 100644
> --- a/fs/nfs/inode.c
> +++ b/fs/nfs/inode.c
> @@ -154,7 +154,7 @@ static void nfs_zap_caches_locked(struct inode *inode)
>  	nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
>  	nfsi->attrtimeo_timestamp = jiffies;
>  
> -	memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode)));
> +	memset(NFS_COOKIEVERF(inode), 0, sizeof(*NFS_COOKIEVERF(inode)));
>  	if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))
>  		nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE;
>  	else

Hi Andi,

No, this is a gcc bug.

NFS_COOKIEVERF(inode) resolves to an array, so the current code is
correct. The above change will cause the 2nd half of the array to remain
uninitialised...

Cheers
  Trond


-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@...app.com
www.netapp.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ