All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
       [not found] <20220125073137.1.83124@7e6451f583e7>
@ 2022-01-25  8:47 ` Geert Uytterhoeven
  2022-01-25 12:49   ` Arnd Bergmann
  2022-01-25 18:02   ` Yury Norov
  0 siblings, 2 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-01-25  8:47 UTC (permalink / raw)
  To: linux-m68k; +Cc: Arnd Bergmann, Yury Norov, Linux Kernel Mailing List

On Tue, Jan 25, 2022 at 8:31 AM <noreply@ellerman.id.au> wrote:
> FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
>
> http://kisskb.ellerman.id.au/kisskb/buildresult/14688953/
>
> Commit:   Add linux-next specific files for 20220125
>           d25ee88530253138d0b20d43511ca5acbda4e9f7
> Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30
>
> Possible errors
> ---------------
>
> arch/m68k/include/asm/bitops.h:329:20: error: array subscript 2 is above array bounds of 'long unsigned int[1]' [-Werror=array-bounds]
> cc1: all warnings being treated as errors
> make[4]: *** [scripts/Makefile.build:289: drivers/net/ipa/ipa_mem.o] Error 1
> make[3]: *** [scripts/Makefile.build:572: drivers/net/ipa] Error 2
> make[2]: *** [scripts/Makefile.build:572: drivers/net] Error 2
> make[1]: *** [Makefile:1965: drivers] Error 2
> make: *** [Makefile:226: __sub-make] Error 2
>
> No warnings found in log.

The code that causes this is drivers/net/ipa/ipa_mem.c:ipa_mem_valid():

        DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { };
        ...
        for_each_clear_bit(mem_id, regions, IPA_MEM_COUNT) {
                if (ipa_mem_id_required(ipa, mem_id))
                        dev_err(dev, "required memory region %u missing\n",
                                mem_id);
        }

This only happens with gcc-8, not with gcc-9, so it might be a
compiler bug. I don't see anything wrong with c:ipa_mem_valid()
nor with m68k's find_first_zero_bit().

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
  2022-01-25  8:47 ` kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24 Geert Uytterhoeven
@ 2022-01-25 12:49   ` Arnd Bergmann
  2022-01-25 12:55     ` Geert Uytterhoeven
  2022-01-25 18:02   ` Yury Norov
  1 sibling, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2022-01-25 12:49 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-m68k, Arnd Bergmann, Yury Norov, Linux Kernel Mailing List

On Tue, Jan 25, 2022 at 9:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> On Tue, Jan 25, 2022 at 8:31 AM <noreply@ellerman.id.au> wrote:
> > FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
> >
> > http://kisskb.ellerman.id.au/kisskb/buildresult/14688953/
> >
> > Commit:   Add linux-next specific files for 20220125
> >           d25ee88530253138d0b20d43511ca5acbda4e9f7
> > Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30
> >
> > Possible errors
> > ---------------
> >
> > arch/m68k/include/asm/bitops.h:329:20: error: array subscript 2 is above array bounds of 'long unsigned int[1]' [-Werror=array-bounds]
> > cc1: all warnings being treated as errors
> > make[4]: *** [scripts/Makefile.build:289: drivers/net/ipa/ipa_mem.o] Error 1
> > make[3]: *** [scripts/Makefile.build:572: drivers/net/ipa] Error 2
> > make[2]: *** [scripts/Makefile.build:572: drivers/net] Error 2
> > make[1]: *** [Makefile:1965: drivers] Error 2
> > make: *** [Makefile:226: __sub-make] Error 2
> >
> > No warnings found in log.
>
> The code that causes this is drivers/net/ipa/ipa_mem.c:ipa_mem_valid():
>
>         DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { };
>         ...
>         for_each_clear_bit(mem_id, regions, IPA_MEM_COUNT) {
>                 if (ipa_mem_id_required(ipa, mem_id))
>                         dev_err(dev, "required memory region %u missing\n",
>                                 mem_id);
>         }
>
> This only happens with gcc-8, not with gcc-9, so it might be a
> compiler bug. I don't see anything wrong with c:ipa_mem_valid()
> nor with m68k's find_first_zero_bit().

I've seen problems with warnings like this when gcc only partially
inlines one of the functions. Does it go away if you mark find_next_bit()
and find_first_bit() as __always_inline?

       Arnd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
  2022-01-25 12:49   ` Arnd Bergmann
@ 2022-01-25 12:55     ` Geert Uytterhoeven
  0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-01-25 12:55 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-m68k, Yury Norov, Linux Kernel Mailing List

Hi Arnd,

On Tue, Jan 25, 2022 at 1:49 PM Arnd Bergmann <arnd@arndb.de> wrote:
> On Tue, Jan 25, 2022 at 9:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Tue, Jan 25, 2022 at 8:31 AM <noreply@ellerman.id.au> wrote:
> > > FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
> > >
> > > http://kisskb.ellerman.id.au/kisskb/buildresult/14688953/
> > >
> > > Commit:   Add linux-next specific files for 20220125
> > >           d25ee88530253138d0b20d43511ca5acbda4e9f7
> > > Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30
> > >
> > > Possible errors
> > > ---------------
> > >
> > > arch/m68k/include/asm/bitops.h:329:20: error: array subscript 2 is above array bounds of 'long unsigned int[1]' [-Werror=array-bounds]
> > > cc1: all warnings being treated as errors
> > > make[4]: *** [scripts/Makefile.build:289: drivers/net/ipa/ipa_mem.o] Error 1
> > > make[3]: *** [scripts/Makefile.build:572: drivers/net/ipa] Error 2
> > > make[2]: *** [scripts/Makefile.build:572: drivers/net] Error 2
> > > make[1]: *** [Makefile:1965: drivers] Error 2
> > > make: *** [Makefile:226: __sub-make] Error 2
> > >
> > > No warnings found in log.
> >
> > The code that causes this is drivers/net/ipa/ipa_mem.c:ipa_mem_valid():
> >
> >         DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { };
> >         ...
> >         for_each_clear_bit(mem_id, regions, IPA_MEM_COUNT) {
> >                 if (ipa_mem_id_required(ipa, mem_id))
> >                         dev_err(dev, "required memory region %u missing\n",
> >                                 mem_id);
> >         }
> >
> > This only happens with gcc-8, not with gcc-9, so it might be a
> > compiler bug. I don't see anything wrong with c:ipa_mem_valid()
> > nor with m68k's find_first_zero_bit().
>
> I've seen problems with warnings like this when gcc only partially
> inlines one of the functions. Does it go away if you mark find_next_bit()
> and find_first_bit() as __always_inline?

Thanks for the suggestio, but it doesn't make a difference.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
  2022-01-25  8:47 ` kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24 Geert Uytterhoeven
  2022-01-25 12:49   ` Arnd Bergmann
@ 2022-01-25 18:02   ` Yury Norov
  2022-01-26  8:53     ` Kees Cook
  1 sibling, 1 reply; 10+ messages in thread
From: Yury Norov @ 2022-01-25 18:02 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-m68k, Arnd Bergmann, Linux Kernel Mailing List, Kees Cook

On Tue, Jan 25, 2022 at 12:47 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> On Tue, Jan 25, 2022 at 8:31 AM <noreply@ellerman.id.au> wrote:
> > FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
> >
> > http://kisskb.ellerman.id.au/kisskb/buildresult/14688953/
> >
> > Commit:   Add linux-next specific files for 20220125
> >           d25ee88530253138d0b20d43511ca5acbda4e9f7
> > Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30
> >
> > Possible errors
> > ---------------
> >
> > arch/m68k/include/asm/bitops.h:329:20: error: array subscript 2 is above array bounds of 'long unsigned int[1]' [-Werror=array-bounds]

The array-bounds warning has been enabled just recently. CC Kees Cook for this.

> > cc1: all warnings being treated as errors
> > make[4]: *** [scripts/Makefile.build:289: drivers/net/ipa/ipa_mem.o] Error 1
> > make[3]: *** [scripts/Makefile.build:572: drivers/net/ipa] Error 2
> > make[2]: *** [scripts/Makefile.build:572: drivers/net] Error 2
> > make[1]: *** [Makefile:1965: drivers] Error 2
> > make: *** [Makefile:226: __sub-make] Error 2
> >
> > No warnings found in log.
>
> The code that causes this is drivers/net/ipa/ipa_mem.c:ipa_mem_valid():
>
>         DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { };
>         ...
>         for_each_clear_bit(mem_id, regions, IPA_MEM_COUNT) {
>                 if (ipa_mem_id_required(ipa, mem_id))
>                         dev_err(dev, "required memory region %u missing\n",
>                                 mem_id);
>         }
>
> This only happens with gcc-8, not with gcc-9, so it might be a
> compiler bug. I don't see anything wrong with c:ipa_mem_valid()
> nor with m68k's find_first_zero_bit().

I don't see any problems about how this code uses bitmap API.
The m68k version of find_first_zero_bit() looks correct as well.

Thanks,
Yury

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
  2022-01-25 18:02   ` Yury Norov
@ 2022-01-26  8:53     ` Kees Cook
  2022-01-26  9:16       ` Geert Uytterhoeven
  0 siblings, 1 reply; 10+ messages in thread
From: Kees Cook @ 2022-01-26  8:53 UTC (permalink / raw)
  To: Yury Norov, Geert Uytterhoeven
  Cc: linux-m68k, Arnd Bergmann, Linux Kernel Mailing List



On January 25, 2022 10:02:56 AM PST, Yury Norov <yury.norov@gmail.com> wrote:
>On Tue, Jan 25, 2022 at 12:47 AM Geert Uytterhoeven
><geert@linux-m68k.org> wrote:
>>
>> On Tue, Jan 25, 2022 at 8:31 AM <noreply@ellerman.id.au> wrote:
>> > FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
>> >
>> > http://kisskb.ellerman.id.au/kisskb/buildresult/14688953/
>> >
>> > Commit:   Add linux-next specific files for 20220125
>> >           d25ee88530253138d0b20d43511ca5acbda4e9f7
>> > Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30
>> >
>> > Possible errors
>> > ---------------
>> >
>> > arch/m68k/include/asm/bitops.h:329:20: error: array subscript 2 is above array bounds of 'long unsigned int[1]' [-Werror=array-bounds]
>
>The array-bounds warning has been enabled just recently. CC Kees Cook for this.
>
>> > cc1: all warnings being treated as errors
>> > make[4]: *** [scripts/Makefile.build:289: drivers/net/ipa/ipa_mem.o] Error 1
>> > make[3]: *** [scripts/Makefile.build:572: drivers/net/ipa] Error 2
>> > make[2]: *** [scripts/Makefile.build:572: drivers/net] Error 2
>> > make[1]: *** [Makefile:1965: drivers] Error 2
>> > make: *** [Makefile:226: __sub-make] Error 2
>> >
>> > No warnings found in log.
>>
>> The code that causes this is drivers/net/ipa/ipa_mem.c:ipa_mem_valid():
>>
>>         DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { };
>>         ...
>>         for_each_clear_bit(mem_id, regions, IPA_MEM_COUNT) {
>>                 if (ipa_mem_id_required(ipa, mem_id))
>>                         dev_err(dev, "required memory region %u missing\n",
>>                                 mem_id);
>>         }
>>
>> This only happens with gcc-8, not with gcc-9, so it might be a
>> compiler bug. I don't see anything wrong with c:ipa_mem_valid()
>> nor with m68k's find_first_zero_bit().
>
>I don't see any problems about how this code uses bitmap API.
>The m68k version of find_first_zero_bit() looks correct as well.

The trouble is with "enum ipa_mem_id mem_id;" which is an int, and the bitmap API requires unsigned long. I tried to fix this[1] at the source, but the maintainers want each[2] call site to fix it instead. :(

Sorry I missed this case in my build testing! If no one beats me to it, I can send a patch tomorrow.

-Kees

[1] https://lore.kernel.org/lkml/20211203100846.3977195-1-keescook@chromium.org/
[2] https://lore.kernel.org/lkml/?q=f%3A%22Kees+Cook%22+%22Use+correctly+sized+arguments+for+bit+field%22

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
  2022-01-26  8:53     ` Kees Cook
@ 2022-01-26  9:16       ` Geert Uytterhoeven
  2022-01-26 12:25         ` Arnd Bergmann
  0 siblings, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-01-26  9:16 UTC (permalink / raw)
  To: Kees Cook
  Cc: Yury Norov, linux-m68k, Arnd Bergmann, Linux Kernel Mailing List

Hi Kees

On Wed, Jan 26, 2022 at 9:54 AM Kees Cook <keescook@chromium.org> wrote:
> On January 25, 2022 10:02:56 AM PST, Yury Norov <yury.norov@gmail.com> wrote:
> >On Tue, Jan 25, 2022 at 12:47 AM Geert Uytterhoeven
> ><geert@linux-m68k.org> wrote:
> >> On Tue, Jan 25, 2022 at 8:31 AM <noreply@ellerman.id.au> wrote:
> >> > FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
> >> >
> >> > http://kisskb.ellerman.id.au/kisskb/buildresult/14688953/
> >> >
> >> > Commit:   Add linux-next specific files for 20220125
> >> >           d25ee88530253138d0b20d43511ca5acbda4e9f7
> >> > Compiler: m68k-linux-gcc (GCC) 8.1.0 / GNU ld (GNU Binutils) 2.30
> >> >
> >> > Possible errors
> >> > ---------------
> >> >
> >> > arch/m68k/include/asm/bitops.h:329:20: error: array subscript 2 is above array bounds of 'long unsigned int[1]' [-Werror=array-bounds]
> >
> >The array-bounds warning has been enabled just recently. CC Kees Cook for this.
> >
> >> > cc1: all warnings being treated as errors
> >> > make[4]: *** [scripts/Makefile.build:289: drivers/net/ipa/ipa_mem.o] Error 1
> >> > make[3]: *** [scripts/Makefile.build:572: drivers/net/ipa] Error 2
> >> > make[2]: *** [scripts/Makefile.build:572: drivers/net] Error 2
> >> > make[1]: *** [Makefile:1965: drivers] Error 2
> >> > make: *** [Makefile:226: __sub-make] Error 2
> >> >
> >> > No warnings found in log.
> >>
> >> The code that causes this is drivers/net/ipa/ipa_mem.c:ipa_mem_valid():
> >>
> >>         DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { };
> >>         ...
> >>         for_each_clear_bit(mem_id, regions, IPA_MEM_COUNT) {
> >>                 if (ipa_mem_id_required(ipa, mem_id))
> >>                         dev_err(dev, "required memory region %u missing\n",
> >>                                 mem_id);
> >>         }
> >>
> >> This only happens with gcc-8, not with gcc-9, so it might be a
> >> compiler bug. I don't see anything wrong with c:ipa_mem_valid()
> >> nor with m68k's find_first_zero_bit().
> >
> >I don't see any problems about how this code uses bitmap API.
> >The m68k version of find_first_zero_bit() looks correct as well.
>
> The trouble is with "enum ipa_mem_id mem_id;" which is an int, and the bitmap API requires unsigned long. I tried to fix this[1] at the source, but the maintainers want each[2] call site to fix it instead. :(

Sorry, I don't get it. "mem_id" is not used as the bitmap, "regions" is,
and the latter has the correct type?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
  2022-01-26  9:16       ` Geert Uytterhoeven
@ 2022-01-26 12:25         ` Arnd Bergmann
  2022-01-26 12:37           ` Geert Uytterhoeven
  2022-01-26 16:42           ` Kees Cook
  0 siblings, 2 replies; 10+ messages in thread
From: Arnd Bergmann @ 2022-01-26 12:25 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kees Cook, Yury Norov, linux-m68k, Arnd Bergmann,
	Linux Kernel Mailing List

On Wed, Jan 26, 2022 at 10:16 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> On Wed, Jan 26, 2022 at 9:54 AM Kees Cook <keescook@chromium.org> wrote:
> > >>
> > >> The code that causes this is drivers/net/ipa/ipa_mem.c:ipa_mem_valid():
> > >>
> > >>         DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { };
> > >>         ...
> > >>         for_each_clear_bit(mem_id, regions, IPA_MEM_COUNT) {
> > >>                 if (ipa_mem_id_required(ipa, mem_id))
> > >>                         dev_err(dev, "required memory region %u missing\n",
> > >>                                 mem_id);
> > >>         }
> > >>
> > >> This only happens with gcc-8, not with gcc-9, so it might be a
> > >> compiler bug. I don't see anything wrong with c:ipa_mem_valid()
> > >> nor with m68k's find_first_zero_bit().
> > >
> > >I don't see any problems about how this code uses bitmap API.
> > >The m68k version of find_first_zero_bit() looks correct as well.
> >
> > The trouble is with "enum ipa_mem_id mem_id;" which is an int, and the bitmap API requires unsigned long. I tried to fix this[1] at the source, but the maintainers want each[2] call site to fix it instead. :(
>
> Sorry, I don't get it. "mem_id" is not used as the bitmap, "regions" is,
> and the latter has the correct type?

I think you are right here, and even if it was an array of 'unsigned
int' instead
of 'unsigned long', this should not change the size of the object on
a 32-bit architecture.

I ran the preprocessed code through cvise[1], bisecting for a reduced
test case that fails on gcc-8 but succeeds on gcc-9. The reduced
case is still fairly complex, and it appears to only happen in the
presence of an inline asm. Narrowing down the compiler versions shows
that anything after gcc-9.2 does not warn, but 9.1 and earlier versions do,
which is further indication that  it was probably a false-positive that got
fixed in gcc.

     Arnd

[1] https://github.com/marxin/cvise
[2] https://www.godbolt.org/z/xMr9v1nPT

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
  2022-01-26 12:25         ` Arnd Bergmann
@ 2022-01-26 12:37           ` Geert Uytterhoeven
  2022-01-26 15:25             ` Arnd Bergmann
  2022-01-26 16:42           ` Kees Cook
  1 sibling, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2022-01-26 12:37 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Kees Cook, Yury Norov, linux-m68k, Linux Kernel Mailing List

Hi Arnd,

On Wed, Jan 26, 2022 at 1:26 PM Arnd Bergmann <arnd@arndb.de> wrote:
> On Wed, Jan 26, 2022 at 10:16 AM Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > On Wed, Jan 26, 2022 at 9:54 AM Kees Cook <keescook@chromium.org> wrote:
> > > >>
> > > >> The code that causes this is drivers/net/ipa/ipa_mem.c:ipa_mem_valid():
> > > >>
> > > >>         DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { };
> > > >>         ...
> > > >>         for_each_clear_bit(mem_id, regions, IPA_MEM_COUNT) {
> > > >>                 if (ipa_mem_id_required(ipa, mem_id))
> > > >>                         dev_err(dev, "required memory region %u missing\n",
> > > >>                                 mem_id);
> > > >>         }
> > > >>
> > > >> This only happens with gcc-8, not with gcc-9, so it might be a
> > > >> compiler bug. I don't see anything wrong with c:ipa_mem_valid()
> > > >> nor with m68k's find_first_zero_bit().
> > > >
> > > >I don't see any problems about how this code uses bitmap API.
> > > >The m68k version of find_first_zero_bit() looks correct as well.
> > >
> > > The trouble is with "enum ipa_mem_id mem_id;" which is an int, and the bitmap API requires unsigned long. I tried to fix this[1] at the source, but the maintainers want each[2] call site to fix it instead. :(
> >
> > Sorry, I don't get it. "mem_id" is not used as the bitmap, "regions" is,
> > and the latter has the correct type?
>
> I think you are right here, and even if it was an array of 'unsigned
> int' instead
> of 'unsigned long', this should not change the size of the object on
> a 32-bit architecture.

Indeed, size matters not here.

> I ran the preprocessed code through cvise[1], bisecting for a reduced
> test case that fails on gcc-8 but succeeds on gcc-9. The reduced
> case is still fairly complex, and it appears to only happen in the
> presence of an inline asm. Narrowing down the compiler versions shows
> that anything after gcc-9.2 does not warn, but 9.1 and earlier versions do,
> which is further indication that  it was probably a false-positive that got
> fixed in gcc.

Thanks for investigating! So let's ignore this.

FTR, my gcc-9 is 9.4.0, i.e. >= 9.2.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
  2022-01-26 12:37           ` Geert Uytterhoeven
@ 2022-01-26 15:25             ` Arnd Bergmann
  0 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2022-01-26 15:25 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Arnd Bergmann, Kees Cook, Yury Norov, linux-m68k,
	Linux Kernel Mailing List

On Wed, Jan 26, 2022 at 1:37 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Wed, Jan 26, 2022 at 1:26 PM Arnd Bergmann <arnd@arndb.de> wrote:
> > I ran the preprocessed code through cvise[1], bisecting for a reduced
> > test case that fails on gcc-8 but succeeds on gcc-9. The reduced
> > case is still fairly complex, and it appears to only happen in the
> > presence of an inline asm. Narrowing down the compiler versions shows
> > that anything after gcc-9.2 does not warn, but 9.1 and earlier versions do,
> > which is further indication that  it was probably a false-positive that got
> > fixed in gcc.
>
> Thanks for investigating! So let's ignore this.
>
> FTR, my gcc-9 is 9.4.0, i.e. >= 9.2.

Ok, if it comes up again, I suppose we can make the warning conditional on
the compiler warning.

         Arnd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24
  2022-01-26 12:25         ` Arnd Bergmann
  2022-01-26 12:37           ` Geert Uytterhoeven
@ 2022-01-26 16:42           ` Kees Cook
  1 sibling, 0 replies; 10+ messages in thread
From: Kees Cook @ 2022-01-26 16:42 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Geert Uytterhoeven, Yury Norov, linux-m68k, Linux Kernel Mailing List

On Wed, Jan 26, 2022 at 01:25:45PM +0100, Arnd Bergmann wrote:
> On Wed, Jan 26, 2022 at 10:16 AM Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > On Wed, Jan 26, 2022 at 9:54 AM Kees Cook <keescook@chromium.org> wrote:
> > > >>
> > > >> The code that causes this is drivers/net/ipa/ipa_mem.c:ipa_mem_valid():
> > > >>
> > > >>         DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { };
> > > >>         ...
> > > >>         for_each_clear_bit(mem_id, regions, IPA_MEM_COUNT) {
> > > >>                 if (ipa_mem_id_required(ipa, mem_id))
> > > >>                         dev_err(dev, "required memory region %u missing\n",
> > > >>                                 mem_id);
> > > >>         }
> > > >>
> > > >> This only happens with gcc-8, not with gcc-9, so it might be a
> > > >> compiler bug. I don't see anything wrong with c:ipa_mem_valid()
> > > >> nor with m68k's find_first_zero_bit().
> > > >
> > > >I don't see any problems about how this code uses bitmap API.
> > > >The m68k version of find_first_zero_bit() looks correct as well.
> > >
> > > The trouble is with "enum ipa_mem_id mem_id;" which is an int, and the bitmap API requires unsigned long. I tried to fix this[1] at the source, but the maintainers want each[2] call site to fix it instead. :(
> >
> > Sorry, I don't get it. "mem_id" is not used as the bitmap, "regions" is,
> > and the latter has the correct type?

Oops, sorry, this looked so much like the other bitops stuff I thought
that was the problem. You are right -- something else is going on.

> I think you are right here, and even if it was an array of 'unsigned
> int' instead
> of 'unsigned long', this should not change the size of the object on
> a 32-bit architecture.
> 
> I ran the preprocessed code through cvise[1], bisecting for a reduced
> test case that fails on gcc-8 but succeeds on gcc-9. The reduced
> case is still fairly complex, and it appears to only happen in the
> presence of an inline asm. Narrowing down the compiler versions shows
> that anything after gcc-9.2 does not warn, but 9.1 and earlier versions do,
> which is further indication that  it was probably a false-positive that got
> fixed in gcc.

Eek. Can we work around it in this code, or should -Warray-bounds have a
gcc version check?

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-26 16:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220125073137.1.83124@7e6451f583e7>
2022-01-25  8:47 ` kisskb: FAILED linux-next/m68k-allmodconfig/m68k-gcc8 Tue Jan 25, 18:24 Geert Uytterhoeven
2022-01-25 12:49   ` Arnd Bergmann
2022-01-25 12:55     ` Geert Uytterhoeven
2022-01-25 18:02   ` Yury Norov
2022-01-26  8:53     ` Kees Cook
2022-01-26  9:16       ` Geert Uytterhoeven
2022-01-26 12:25         ` Arnd Bergmann
2022-01-26 12:37           ` Geert Uytterhoeven
2022-01-26 15:25             ` Arnd Bergmann
2022-01-26 16:42           ` Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.