Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 922612 - sys-kernel/gentoo-sources-6.7.1 doesn't build with SCHED_ALT=y
Summary: sys-kernel/gentoo-sources-6.7.1 doesn't build with SCHED_ALT=y
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: https://lore.kernel.org/linux-hardeni...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-21 11:45 UTC by NHO
Modified: 2024-03-08 23:04 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Config with build failure (config.bad.zip,41.45 KB, application/zip)
2024-01-21 11:46 UTC, NHO
Details
Config of successful build (config.good.zip,41.49 KB, application/zip)
2024-01-21 11:46 UTC, NHO
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NHO 2024-01-21 11:45:31 UTC
After installation of gentoo-sources-6.7.1 make oldconfig presented me with a question about setting SCHED_ALT (allow alternative schedulers), with Y as default. I agreed.

After that, make failed. After making SCHED_ALT is not set, kernel build succeeded.



Reproducible: Always

Actual Results:  
  CC      kernel/sched/alt_core.o
In file included from ./include/linux/string.h:295,
                 from ./include/linux/bitmap.h:12,
                 from ./include/linux/cpumask.h:12,
                 from ./include/linux/smp.h:13,
                 from ./include/linux/sched/clock.h:5,
                 from kernel/sched/alt_core.c:14:
In function ‘bitmap_copy’,
    inlined from ‘cpumask_copy’ at ./include/linux/cpumask.h:756:2,
    inlined from ‘sched_init’ at kernel/sched/alt_core.c:7701:3:
./include/linux/fortify-string.h:57:33: error: ‘__builtin_memcpy’ reading between 41 and 2520 bytes from a region of size 40 [-Werror=stringop-overread]
   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,                  \
      |                          ^~~~~~~~~~~~~~~~~~~~
./include/linux/bitmap.h:245:17: note: in expansion of macro ‘memcpy’
  245 |                 memcpy(dst, src, len);
      |                 ^~~~~~
./include/linux/cpumask.h: In function ‘sched_init’:
./include/linux/cpumask.h:127:23: note: source object ‘__cpu_present_mask’ of size 40
  127 | extern struct cpumask __cpu_present_mask;
      |                       ^~~~~~~~~~~~~~~~~~
In function ‘bitmap_copy’,
    inlined from ‘cpumask_copy’ at ./include/linux/cpumask.h:756:2,
    inlined from ‘sched_init’ at kernel/sched/alt_core.c:7701:3:
./include/linux/fortify-string.h:57:33: error: ‘__builtin_memcpy’ reading between 41 and 2520 bytes from a region of size 40 [-Werror=stringop-overread]
   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,                  \
      |                          ^~~~~~~~~~~~~~~~~~~~
./include/linux/bitmap.h:245:17: note: in expansion of macro ‘memcpy’
  245 |                 memcpy(dst, src, len);
      |                 ^~~~~~
./include/linux/cpumask.h: In function ‘sched_init’:
./include/linux/cpumask.h:127:23: note: source object ‘__cpu_present_mask’ of size 40
  127 | extern struct cpumask __cpu_present_mask;
      |                       ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [scripts/Makefile.build:243: kernel/sched/alt_core.o] Error 1
make[3]: *** [scripts/Makefile.build:480: kernel/sched] Error 2
make[2]: *** [scripts/Makefile.build:480: kernel] Error 2
make[1]: *** [/usr/src/linux-6.7.1-gentoo/Makefile:1911: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2
Comment 1 NHO 2024-01-21 11:46:36 UTC
Created attachment 882760 [details]
Config with build failure
Comment 2 NHO 2024-01-21 11:46:53 UTC
Created attachment 882761 [details]
Config of successful build
Comment 3 NHO 2024-01-22 07:31:31 UTC
USE=experimental, of course.
Comment 4 NHO 2024-01-26 10:30:18 UTC
sys-kernel/gentoo-sources-6.7.2::gentoo USE="experimental symlink -build"

Issue persists. Error is the same.
Comment 5 Mike Pagano gentoo-dev 2024-01-28 13:37:47 UTC
Seems to be a result of upstream enabling -Wstringop-overflow globally.
I was able to successfully compile it with GCC 14.  

This should be reported upstream. 

https://gitlab.com/alfredchen/linux-prjc/-/issues
Comment 6 Holger Hoffstätte 2024-01-30 11:59:51 UTC
Why can I build & run vanilla upstream 6.7.2 with BMQ enabled using gcc-13.2.1_p20240113-r1 without any issue? If -Wstringop-overflow were enabled globally by mainline I'd see the error as well.
Comment 7 Holger Hoffstätte 2024-01-30 12:08:00 UTC
(In reply to Holger Hoffstätte from comment #6)
> Why can I build & run vanilla upstream 6.7.2 with BMQ enabled using
> gcc-13.2.1_p20240113-r1 without any issue? If -Wstringop-overflow were
> enabled globally by mainline I'd see the error as well.

Ah - probably because gentoo-sources has additional Kconfig stuff and enables FORTIFY_SOURCE and other hardening options.
Comment 8 Holger Hoffstätte 2024-01-30 12:22:29 UTC
Reported upstream at https://gitlab.com/alfredchen/linux-prjc/-/issues/92
Comment 9 Mike Pagano gentoo-dev 2024-03-08 23:04:18 UTC
We'll follow the upstream bug and apply any fixes identified.