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]
Date:   Tue, 2 Feb 2021 22:51:01 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Pavel Machek <pavel@....cz>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Marc Kleine-Budde <mkl@...gutronix.de>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.4 24/28] can: dev: prevent potential information leak
 in can_fill_info()

On Tue, Feb 02, 2021 at 10:05:39PM +0300, Dan Carpenter wrote:
> On Tue, Feb 02, 2021 at 07:53:17PM +0100, Pavel Machek wrote:
> > Hi!
> > 
> > > From: Dan Carpenter <dan.carpenter@...cle.com>
> > > 
> > > [ Upstream commit b552766c872f5b0d90323b24e4c9e8fa67486dd5 ]
> > > 
> > > The "bec" struct isn't necessarily always initialized. For example, the
> > > mcp251xfd_get_berr_counter() function doesn't initialize anything if the
> > > interface is down.
> > 
> > Well, yes... and = {} does not neccessarily initialize all of the
> > structure... for example padding.
> > 
> > It is really simple
> > 
> > struct can_berr_counter {
> > 	__u16 txerr;
> > 	__u16 rxerr;
> > };
> > 
> > but maybe something like alpha uses padding in such case, and memset
> > would be better?
> 
> I'm pretty sure nothing uses padding in this situation.  If it does then
> we need to re-work a bunch of code.

Not necessarily related but in theory a "= {};" assignment is a GCC
extension and it is supposed to zero out struct holes.  If the code
does "= {0};" then that's standard C, and will not necessarily fill
struct holes but I think GCC tries to.  The other complication is that
some GCC versions have bugs related to this?  We had a long thread about
this last August.

https://lore.kernel.org/lkml/20200801144030.GM24045@ziepe.ca/

Anyway, this code has no holes so it's not affected.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ