[BUG] allmodconfig build error in next-20240108

Lucas De Marchi lucas.demarchi at intel.com
Tue Jan 9 16:58:40 UTC 2024


On Mon, Jan 08, 2024 at 03:15:23PM -0800, Paul E. McKenney wrote:
>On Tue, Jan 09, 2024 at 09:57:57AM +1100, Stephen Rothwell wrote:
>> Hi Paul,
>>
>> On Mon, 8 Jan 2024 13:33:36 -0800 "Paul E. McKenney" <paulmck at kernel.org> wrote:
>> >
>> > Recent -next trees get the following build error for allmodconfig builds:
>> >
>> > ------------------------------------------------------------------------
>> >
>> > drivers/gpu/drm/xe/xe_gt_pagefault.c: In function ‘xe_guc_pagefault_handler’:
>> > ./include/linux/fortify-string.h:57:33: error: writing 16 bytes into a region of  size 0 [-Werror=stringop-overflow=]
>> >    57 | #define __underlying_memcpy     __builtin_memcpy
>> >       |                                 ^
>> > ./include/linux/fortify-string.h:644:9: note: in expansion of macro ‘__underlying_memcpy’
>> >   644 |         __underlying_##op(p, q, __fortify_size); \
>> >       |         ^~~~~~~~~~~~~
>> > ./include/linux/fortify-string.h:689:26: note: in expansion of macro ‘__fortify_memcpy_chk’
>> >   689 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s, \
>> >       |                          ^~~~~~~~~~~~~~~~~~~~
>> > drivers/gpu/drm/xe/xe_gt_pagefault.c:340:17: note: in expansion of macro ‘memcpy’
>> >   340 |                 memcpy(pf_queue->data + pf_queue->tail, msg, len * sizeof(u32));
>> >       |                 ^~~~~~
>> > In file included from drivers/gpu/drm/xe/xe_device_types.h:17,
>> >                  from drivers/gpu/drm/xe/xe_vm_types.h:16,
>> >                  from drivers/gpu/drm/xe/xe_bo.h:13,
>> >                  from drivers/gpu/drm/xe/xe_gt_pagefault.c:16:
>> > drivers/gpu/drm/xe/xe_gt_types.h:102:25: note: at offset [1144, 265324] into destination object ‘tile’ of size 8
>> >   102 |         struct xe_tile *tile;
>> >       |
>>
>> Which architecture?  What compiler and version?  Anything special in your build
>> setup?  I do x86_64 allmodconfig builds all day with gcc v13.2 and I don't see
>> this failure.
>
>Good point!
>
>I am using gcc version 11.3.1 20230605 (Red Hat 11.4.1-2) on x86_64.
>I see the same behavior on gcc version 8.5.0, which for all I know might
>be too old.

I could reproduce it with allmodconfig and gcc 11.4.1 from rockylinux,
but not with gcc 9.3 or 12.3. Also it's not reproduced with gcc 11.4.1
when using defconfig + CONFIG_DRM_XE  (even if  -Wstringop-overflow is
still added).

I don't see a bug in the code, even if it inverts the head/tail
convention.

Searching around showed this which may be relevant: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101854
At least I can reproduce the same issue as in the snippet provided
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101854#c7) with the buggy
compiler.

So, maybe the best thing to do for now is to disable -Wstringop-overflow
for gcc < 12?


------8<-----
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index 6952da8979ea..0433a3c6cbfd 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -17,7 +17,7 @@ subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
  subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
  subdir-ccflags-y += $(call cc-option, -Wformat-overflow)
  subdir-ccflags-y += $(call cc-option, -Wformat-truncation)
-subdir-ccflags-y += $(call cc-option, -Wstringop-overflow)
+subdir-ccflags-$(call gcc-min-version, 120000) += $(call cc-option, -Wstringop-overflow)
  subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
  # The following turn off the warnings enabled by -Wextra
  ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
------8<-----

and if we are tweaking the warnings, then do similarly in scripts/Makefile.extrawarn
so it doesn't show up again with W=1 builds. Thoughts?

Lucas De Marchi

>
>							Thanx, Paul


More information about the Intel-xe mailing list