Re: [PATCH] s390: disable -Warray-bounds

Kees Cook
2022-06-09T00:39:44Z

On June 8, 2022 4:59:29 PM PDT, Linus Torvalds <torvalds@linux-foundation.org> wrote:
>On Wed, Jun 8, 2022 at 2:33 PM Kees Cook <keescook@chromium.org> wrote:
>>
>> I and others have been working through a bunch of them, though yes,
>> they're not all fixed yet. I've been trying to track it here[1], but
>> many of those fixes are only in -next.
>
>Hmm. Even with that disabled, I get a few warnings I *really* would
>want to get rid of.

Yup! :)

>
>The one in ipuv3-crtc.c seems valid about "address used as boolean is
>always true".
>
>The 'dangling-pointer' warning does seem interesting, but not when the
>compiler does as bad a job as gcc seems to do.
>
>See the attached patch for
>
> (a) make the s390 "use -Wno-array-bounds for gcc-12" be generic
>
> (b) fix the ipuv3-crtc.c one. IMX people?
>
> (c) disable -Wdangling-pointer entirely for now

I'll take a look; thanks! Should I send them back as a pull request?

>but that still leaves the netfs_i_context games, which gcc-12 is very
>unhappy about:

Yeah. Happily, this has already been solved, but it looks like David didn't do a pull yet for it?

https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=fscache-next

>I'd like to use something more surgical than
>CONFIG_CC_NO_ARRAY_BOUNDS, but considering the s390 issues, it may not
>even be worth it. Kees, just how far away are we from that being ok on
>x86-64?

For gcc's UBSAN_SHIFT (I typoed this in my first reply) bug, netdev has been moving it to W=1 builds on a per-source basis for the moment:

https://git.kernel.org/linus/e95032988053c17baf6c7e27024f5103a19a5f4a

Some discussion:
https://lore.kernel.org/lkml/202205231229.CF6B8471@keescook/

Perhaps these could be even more carefully limited to GCC 12 only, using the Kconfig you suggested?

-Kees

--
Kees Cook