RE: [next-20250226]Build Failure
From: Michael Kelley <hidden>
Date: 2025-03-01 05:44:16
Also in:
lkml
From: Kees Cook <kees@kernel.org> Sent: Friday, February 28, 2025 9:46 AM
On Thu, Feb 27, 2025 at 03:15:35PM +0100, Christophe Leroy wrote:quoted
Le 27/02/2025 à 15:05, Michael Kelley a écrit :quoted
From: Christophe Leroy <redacted> Sent: Thursday, February 27, 2025 2:43 AMquoted
Le 27/02/2025 à 02:38, Stephen Rothwell a écrit :quoted
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. ChristopheFWIW, 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-kees@kernel.org/ (local) This matches what you found, namely:quoted
I don't get it with gcc 10.3 nor 11.3 nor 12.4 nor 13.2 nor 14.2These have both nonstring and __builtin_has_attribute()quoted
I don't get it either with gcc 5.5 or 7.5These 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