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] [day] [month] [year] [list]
Message-ID: <20240705152138.GF1095183@kernel.org>
Date: Fri, 5 Jul 2024 16:21:38 +0100
From: Simon Horman <horms@...nel.org>
To: Przemek Kitszel <przemyslaw.kitszel@...el.com>
Cc: Boris Pismenny <borisp@...dia.com>,
	John Fastabend <john.fastabend@...il.com>, netdev@...r.kernel.org,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH net-next] net: tls: Pass union tls_crypto_context pointer
 to memzero_explicit

On Fri, Jul 05, 2024 at 03:54:59PM +0200, Przemek Kitszel wrote:
> On 7/5/24 15:41, Simon Horman wrote:
> > Pass union tls_crypto_context pointer, rather than struct
> > tls_crypto_info pointer, to memzero_explicit().
> > 
> > The address of the pointer is the same before and after.
> > But the new construct means that the size of the dereferenced pointer type
> > matches the size being zeroed. Which aids static analysis.
> > 
> > As reported by Smatch:
> > 
> >    .../tls_main.c:842 do_tls_setsockopt_conf() error: memzero_explicit() 'crypto_info' too small (4 vs 56)
> > 
> > No functional change intended.
> > Compile tested only.
> > 
> > Signed-off-by: Simon Horman <horms@...nel.org>
> 
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
> one small nitpick only

...

> > @@ -710,7 +713,7 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval,
> >   	return 0;
> >   err_crypto_info:
> > -	memzero_explicit(crypto_info, sizeof(union tls_crypto_context));
> > +	memzero_explicit(crypto_ctx, sizeof(union tls_crypto_context));
> 
> nit: That's a good fix to aid static analyzers, and reviewers.
> Now it's also easy to follow the standard style and pass
> sizeof(*crypto_ctx) instead of the type.

Thanks, that is a good suggestion.
I'll incorporate it in a v2.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ