From: Kees Cook <k...@kernel.org> Sent: Friday, February 28, 2025 9:46 AM
> 
> On Thu, Feb 27, 2025 at 03:15:35PM +0100, Christophe Leroy wrote:
> >
> >
> > Le 27/02/2025 à 15:05, Michael Kelley a écrit :
> > > From: Christophe Leroy <christophe.le...@csgroup.eu> Sent: Thursday, 
> > > February 27, 2025 2:43 AM
> > > >
> > > > Le 27/02/2025 à 02:38, Stephen Rothwell a écrit :
> > > > > Hi Venkat,
> > > > >
> > > > > CC Kees Cook for advice.  This is a result of the tests added in 
> > > > > commit
> > > > >
> > > > >     bbeb38b8487a ("string.h: Validate memtostr*()/strtomem*() 
> > > > > arguments more carefully")
> > > > >
> > > > > from the kspp tree.
> > > > >
> > > > > I note that the comment about memtostr() says "Copy a possibly
> > > > > non-NUL-term string".
> > > >
> > > > Can you tell more about your config and your environment ?
> > > >
> > > > I just tested with ppc64_defconfig and ppc64le_defconfig, with gcc 12.4,
> > > > gcc 13.2 and gcc 14.2 and didn't get that build error.
> > > >
> > > > Christophe
> > >
> > > FWIW, I see the same build failures related to __must_be_noncstr()
> > > when building natively on x86 and on arm64. In both cases, it's an
> > > Ubuntu 20.04 installation with gcc 9.4.0 and binutils 2.34.
> > >
> >
> > Looks like I get that problem only with GCC 8.5 and GCC 9.5.
> 
> Okay, I've figured this out, and sent an updated patch:
> https://lore.kernel.org/lkml/20250228174130.it.875-k...@kernel.org/ 
> 
> This matches what you found, namely:
> 
> > I don't get it with gcc 10.3 nor 11.3 nor 12.4 nor 13.2 nor 14.2
> 
> These have both nonstring and __builtin_has_attribute()
> 
> > I don't get it either with gcc 5.5 or 7.5
> 
> These have neither.
> 
> The problem was in the span of time when nonstring got introduced, but
> __builtin_has_attribute() hadn't been yet (GCC 8 and 9). I had accounted
> for having neither, but not for missing one. :|
> 

The new patch solves the problem I was seeing with gcc 9.4.0 on
x86 and arm64.

Thanks!

Michael

Reply via email to