Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 847124 - >=sys-kernel/gentoo-sources-5.18.0 on sparc: arch/sparc/mm/init_64.c:3055:31: error: array subscript -1 is outside array bounds of 'char[]' [-Werror=array-bounds]
Summary: >=sys-kernel/gentoo-sources-5.18.0 on sparc: arch/sparc/mm/init_64.c:3055:31:...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: Sparc64 Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: https://github.com/KSPP/linux/issues/...
Whiteboard: 5.18.1
Keywords: InVCS, PATCH
Depends on:
Blocks:
 
Reported: 2022-05-23 19:10 UTC by matoro
Modified: 2022-05-30 14:59 UTC (History)
2 users (show)

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


Attachments
genkernel.log (genkernel.log,16.40 KB, text/x-log)
2022-05-23 19:13 UTC, matoro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description matoro archtester 2022-05-23 19:10:12 UTC
Kernel 5.18 enabled -Werror=array-bounds globally with https://github.com/torvalds/linux/commit/b06a17583f6f810f620f95382b171cc5ce9848ee.  Kernel Self-Protection Project was tracking remaining issues in https://github.com/KSPP/linux/issues/181.

I think they may have missed covering arch-specific code, as 5.18.0 fails to compile on sparc64 as below:

*         >> Compiling 5.18.0-gentoo-sparc64 vmlinux ...
COMMAND: nice -n10 make -j56 ARCH='sparc64' AS='sparc64-unknown-linux-gnu-as' AR='sparc64-unknown-linux-gnu-ar' CC='sparc64-unknown-linux-gnu-gcc' LD='sparc64-unknown-linux-gnu-ld' NM='sparc64-unknown-linux-gnu-nm' OBJCOPY='sparc64-unknown-linux-gnu-objcopy' OBJDUMP='sparc64-unknown-linux-gnu-objdump' READELF='sparc64-unknown-linux-gnu-readelf' STRIP='sparc64-unknown-linux-gnu-strip' HOSTAR='sparc64-unknown-linux-gnu-ar' HOSTCC='sparc64-unknown-linux-gnu-gcc' HOSTCXX='sparc64-unknown-linux-gnu-g++' HOSTLD='sparc64-unknown-linux-gnu-ld' vmlinux
  CALL    scripts/atomic/check-atomics.sh
  CALL    scripts/checksyscalls.sh
<stdin>:1517:2: warning: #warning syscall clone3 not implemented [-Wcpp]
  CHK     include/generated/compile.h
  CC      arch/sparc/mm/init_64.o
In function 'kernel_lds_init',
    inlined from 'report_memory' at arch/sparc/mm/init_64.c:3067:2:
arch/sparc/mm/init_64.c:3055:31: error: array subscript -1 is outside array bounds of 'char[]' [-Werror=array-bounds]
 3055 |         code_resource.end   = compute_kern_paddr(_etext - 1);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/sparc/include/asm/sections.h:6,
                 from ./include/linux/interrupt.h:21,
                 from ./include/linux/kernel_stat.h:9,
                 from ./include/linux/cgroup.h:26,
                 from ./include/linux/hugetlb.h:9,
                 from arch/sparc/mm/init_64.c:16:
./include/asm-generic/sections.h: In function 'report_memory':
./include/asm-generic/sections.h:35:32: note: at offset -1 into object '_etext' of size [0, 9223372036854775807]
   35 | extern char _text[], _stext[], _etext[];
      |                                ^~~~~~
In function 'kernel_lds_init',
    inlined from 'report_memory' at arch/sparc/mm/init_64.c:3067:2:
arch/sparc/mm/init_64.c:3057:31: error: array subscript -1 is outside array bounds of 'char[]' [-Werror=array-bounds]
 3057 |         data_resource.end   = compute_kern_paddr(_edata - 1);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/sections.h: In function 'report_memory':
./include/asm-generic/sections.h:36:32: note: at offset -1 into object '_edata' of size [0, 9223372036854775807]
   36 | extern char _data[], _sdata[], _edata[];
      |                                ^~~~~~
In function 'kernel_lds_init',
    inlined from 'report_memory' at arch/sparc/mm/init_64.c:3067:2:
arch/sparc/mm/init_64.c:3059:31: error: array subscript -1 is outside array bounds of 'char[]' [-Werror=array-bounds]
 3059 |         bss_resource.end    = compute_kern_paddr(_end - 1);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/asm-generic/sections.h: In function 'report_memory':
./include/asm-generic/sections.h:41:13: note: at offset -1 into object '_end' of size [0, 9223372036854775807]
   41 | extern char _end[];
      |             ^~~~
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:288: arch/sparc/mm/init_64.o] Error 1
make[1]: *** [scripts/Makefile.build:550: arch/sparc/mm] Error 2

Reproducible: Always




Portage 3.0.30 (python 3.10.4-final-0, default/linux/sparc/17.0/64ul, gcc-12.1.0, glibc-2.35-r5, 5.17.9-gentoo-sparc64 sparc64)
=================================================================
System uname: Linux-5.17.9-gentoo-sparc64-sparc64-sun4v-with-glibc2.35
KiB Mem:    32684336 total,  22271872 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Mon, 23 May 2022 16:33:07 +0000
Head commit of repository gentoo: a0f58cba71636bd0532c4c80449079bf13fd6613

sh bash 5.1_p16
ld GNU ld (Gentoo 2.38 p4) 2.38
app-misc/pax-utils:        1.3.4::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-lang/perl:             5.34.1-r3::gentoo
dev-lang/python:           3.10.4_p1::gentoo
dev-util/cmake:            3.23.1::gentoo
dev-util/meson:            0.62.1::gentoo
sys-apps/baselayout:       2.8::gentoo
sys-apps/openrc:           0.44.10::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.38-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc:             12.1.0::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.17-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.35-r5::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo
    sync-user: portage:portage
    priority: -1000
    sync-git-verify-commit-signature: yes

guru
    location: /var/lib/layman/guru
    sync-type: laymansync
    sync-uri: https://anongit.gentoo.org/git/repo/proj/guru.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="sparc ~sparc"
ACCEPT_LICENSE="@FREE"
CBUILD="sparc64-unknown-linux-gnu"
CFLAGS="-O3 -mcpu=native -mtune=native -pipe"
CHOST="sparc64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O3 -mcpu=native -mtune=native -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--usepkg --autounmask=n --complete-graph --keep-going --with-bdeps=y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS=""
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg buildpkg-live compress-build-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O3 -mcpu=native -mtune=native -pipe"
GENTOO_MIRRORS="https://gentoo.osuosl.org/ https://mirror.leaseweb.com/gentoo/ https://mirror.rackspace.com/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j56"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="acl bash-completion big-endian bzip2 caps cli crypt dri elogind fortran gdbm gentoo-vm graphite headless-awt iconv ipv6 libbsd libglvnd libtirpc llvm-libunwind lto ncurses nls nptl openmp pam pcre pgo readline sparc split-usr ssl symlink threads udev unicode verify-sig vhosts vim-syntax xattr zlib" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 matoro archtester 2022-05-23 19:13:18 UTC
Created attachment 780434 [details]
genkernel.log
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-23 19:15:33 UTC
Thanks! Could you forward upstream?
Comment 3 matoro archtester 2022-05-23 19:17:47 UTC
(In reply to Sam James from comment #2)
> Thanks! Could you forward upstream?

Already working on it, this is just for tracking.  Kees committed this and he has already used my boxes to solve a previous ia64 issue so shouldn't be too bad.
Comment 4 matoro archtester 2022-05-23 21:12:38 UTC
Linked to fix provided by Kees.
Comment 5 Mike Pagano gentoo-dev 2022-05-30 14:59:14 UTC
Fixed and released in gentoo-sources-5.18.1