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: <20250424162805.GI3042781@horms.kernel.org>
Date: Thu, 24 Apr 2025 17:28:05 +0100
From: Simon Horman <horms@...nel.org>
To: Heiko Carstens <hca@...ux.ibm.com>
Cc: Alexandra Winter <wintera@...ux.ibm.com>,
	Thorsten Winkler <twinkler@...ux.ibm.com>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Vasily Gorbik <gor@...ux.ibm.com>,
	Alexander Gordeev <agordeev@...ux.ibm.com>,
	Christian Borntraeger <borntraeger@...ux.ibm.com>,
	Sven Schnelle <svens@...ux.ibm.com>, netdev@...r.kernel.org,
	linux-s390@...r.kernel.org
Subject: Re: [PATCH net-next] s390: ism: Pass string literal as format
 argument of dev_set_name()

On Thu, Apr 17, 2025 at 01:08:14PM +0200, Heiko Carstens wrote:
> On Thu, Apr 17, 2025 at 11:28:23AM +0100, Simon Horman wrote:
> > GCC 14.2.0 reports that passing a non-string literal as the
> > format argument of dev_set_name() is potentially insecure.
> > 
> > drivers/s390/net/ism_drv.c: In function 'ism_probe':
> > drivers/s390/net/ism_drv.c:615:2: warning: format not a string literal and no format arguments [-Wformat-security]
> >   615 |  dev_set_name(&ism->dev, dev_name(&pdev->dev));
> >       |  ^~~~~~~~~~~~
> > 
> > It seems to me that as pdev is a PCIE device then the dev_name
> > call above should always return the device's BDF, e.g. 00:12.0.
> > That this should not contain format escape sequences. And thus
> > the current usage is safe.
> > 
> > But, it seems better to be safe than sorry. And, as a bonus, compiler
> > output becomes less verbose by addressing this issue.
> > 
> > Compile tested only.
> > No functional change intended.
> > 
> > Signed-off-by: Simon Horman <horms@...nel.org>
> > ---
> >  drivers/s390/net/ism_drv.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> It might make sense to say that -Wformat-security was explicitly enabled in
> order to trigger this (probably with KCFLAGS=-Wformat-security ?), since this
> warning is by default disabled.
> 
> Just mentioning this, since I was wondering why I haven't seen this.

Thanks Heiko,

Yes, you are right on both counts. I should have mentioned this.
And I did compile with KCFLAGS=-Wformat-security.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ