Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 911727 - sys-apps/iproute2 fails to build with glibc-2.38 and -fno-semantic-interposition
Summary: sys-apps/iproute2 fails to build with glibc-2.38 and -fno-semantic-interposition
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: glibc-2.38
  Show dependency tree
 
Reported: 2023-08-05 00:34 UTC by Ninpo
Modified: 2024-03-01 23:09 UTC (History)
5 users (show)

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


Attachments
sys-apps/iproute2 build.log (iproute2-6.4.0:20230804-052533.log,86.22 KB, text/x-log)
2023-08-05 00:34 UTC, Ninpo
Details
iproute2 build.log without libbsd (iproute2-6.4.0:20230905-153318.log,228.61 KB, text/x-log)
2023-09-05 15:35 UTC, Ninpo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ninpo 2023-08-05 00:34:50 UTC
Created attachment 867072 [details]
sys-apps/iproute2 build.log

Portage 3.0.49_p38 (python 3.12.0-beta-4, default/linux/amd64/17.1/desktop/plasma, gcc-13, glibc-2.38, 6.1.41-gentoo-x86_64 x86_64)
=================================================================
System uname: Linux-6.1.41-gentoo-x86_64-x86_64-AMD_Ryzen_Threadripper_1950X_16-Core_Processor-with-glibc2.38
KiB Mem:    65662428 total,   8677200 free
KiB Swap:    8388604 total,   6469372 free
Timestamp of repository gentoo: Fri, 04 Aug 2023 13:16:40 +0000
Head commit of repository gentoo: c8a04abb51369aa9cac857f518186c0a430dce41

Timestamp of repository kde: Wed, 02 Aug 2023 18:32:20 +0000
Head commit of repository kde: f58052ca124abfe5442d5e830df32968b39fa4f7

Timestamp of repository lto-overlay: Wed, 02 Aug 2023 18:32:18 +0000
Head commit of repository lto-overlay: 77e924278367892a3ce0e6c53728473e7a3beed0

Head commit of repository mv: e1118e55e25cd171db8a070bd65545052452cc3f

Timestamp of repository steam-overlay: Wed, 02 Aug 2023 18:32:12 +0000
Head commit of repository steam-overlay: 7a0714867f4659d1ef4b9b9229ec6457cd884d78

sh bash 5.2_p15-r6
ld GNU ld (Gentoo 2.41 p1) 2.41
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r6::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.10.12::gentoo, 3.11.4::gentoo, 3.12.0_beta4_p1::gentoo
dev-lang/rust:             1.71.0::gentoo
dev-util/cmake:            3.27.1::gentoo
dev-util/meson:            1.2.0::gentoo
sys-apps/baselayout:       2.14::gentoo
sys-apps/openrc:           0.48::gentoo
sys-apps/sandbox:          2.37::gentoo
sys-devel/autoconf:        2.71-r7::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.40-r7::gentoo, 2.41::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.6::gentoo
sys-devel/gcc:             12.3.1_p20230623::gentoo, 13.2.0::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             16.0.6::gentoo
sys-devel/llvm:            16.0.6::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.4::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo
    priority: -1000
    volatile: False

custom
    location: /var/db/repos/custom
    masters: gentoo
    volatile: False

kde
    location: /var/db/repos/kde
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/kde.git
    masters: gentoo
    volatile: False

lto-overlay
    location: /var/db/repos/lto-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/lto-overlay.git
    masters: gentoo mv
    volatile: False

mv
    location: /var/db/repos/mv
    sync-type: git
    sync-uri: https://github.com/vaeth/mv-overlay.git
    masters: gentoo
    volatile: False

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo
    volatile: False

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -pipe -O2 -flto=6 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -pipe -O2 -flto=6 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -march=native -pipe -O2 -flto=6 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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 XDG_STATE_HOME"
FCFLAGS="-march=native -pipe -O2 -flto=6 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live clean-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -pipe -O2 -flto=6 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j9"
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="X a52 aac acl acpi activities alsa amd64 branding bzip2 cairo cdda cdr cli crypt cups dbus declarative dri dts dvd dvdr elogind encode exif flac fortran gdbm gif googledrive gpm gtk gui i3wm iconv icu ipv6 jpeg kde kwallet lcms libnotify libtirpc lto mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf perl pgo pipewire plasma png policykit ppds pulseaudio qml qt5 readline screencast sdl seccomp semantic-desktop sound spell split-usr ssl startup-notification svg system-bootstrap system-llvm test-rust tiff truetype udev udisks unicode upower usb vim vim-syntax vorbis vulkan wayland widgets wxwidgets x264 xattr xcb xft xml xv xvid zlib zstd" ABI_X86="64 32" ADA_TARGET="gnat_2021" 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" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" 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" L10N="en-GB en" 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="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11 python3_10 python3_12" RUBY_TARGETS="ruby31" VIDEO_CARDS="vesa" 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, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, 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 Holger Hoffstätte 2023-08-05 08:49:40 UTC
The ebuild fails for me as well (with only -fno-semantic-interposition and without LTO), but I found that the vanilla package works just fine *with* it.
Apparently the iproute2-5.12.0-configure-nomagic patch is to blame since it now somehow breaks the built-in check for strlcpy.
When I delete the NEED_STRLCPY section in lib/utils.c it also works, so this is not a problem in glibc.
Comment 2 Holger Hoffstätte 2023-08-05 15:21:20 UTC
While the problems building with USE=-libbsd are self-inflicted by the aforementioned patch, the good news here is that they can be circumvented for now by USE=libbsd, which will trick the iproute2 config process into ignoring both glibc's strlcpy and the provided version, using libbsd as intended.
It will then build fine.

IMHO the sanest way forward here is to remove libbsd as USE flag and either
use it or not, depending on glibc >= 2.38.
Comment 3 stefan11111 2023-08-28 19:21:57 UTC
This happens here too.
>/usr/include/bits/string_fortified.h: In function 'strlcat':
>/usr/include/bits/string_fortified.h:150:1: error: inlining failed in call to 'always_inline' 'strlcpy.localalias': function not inlinable
>  150 | __NTH (strlcpy (char *__restrict __dest, const char *__restrict __src,
>      | ^
>../lib/utils.c:1544:23: note: called from here
> 1544 |         return dlen + strlcpy(dst + dlen, src, size - dlen);
>      |                       ^
>make[2]: *** [/var/tmp/portage/sys-apps/iproute2-6.4.0/temp/cctFFrlU.mk:29: /var/tmp/portage/sys-apps/iproute2-6.4.0/temp/ccM5wlv4.ltrans9.ltrans.o] Error 1
>make[2]: *** Waiting for unfinished jobs....
>lto-wrapper: fatal error: make returned 2 exit status
>compilation terminated.
>/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
>collect2: error: ld returned 1 exit status
>make[1]: *** [Makefile:144: tc] Error 1
>rm emp_ematch.lex.c
>make[1]: Leaving directory '/var/tmp/portage/sys-apps/iproute2-6.4.0/work/iproute2-6.4.0/tc'
>make: *** [Makefile:76: all] Error 2

Portage 3.0.51 (python 3.11.5-final-0, default/linux/amd64/17.1/no-multilib, gcc-13, glibc-2.38-r1, 6.4.10-gentoo x86_64)
=================================================================
System uname: Linux-6.4.10-gentoo-x86_64-Intel-R-_Core-TM-_i5-7400_CPU_@_3.00GHz-with-glibc2.38
KiB Mem:     8123244 total,    369612 free
KiB Swap:   16777212 total,  16666108 free
Timestamp of repository gentoo: Sun, 27 Aug 2023 22:00:01 +0000
Head commit of repository gentoo: d815e557994ea8a2f180ce73a06ab487dba85b02
Head commit of repository gentoo-static: b220537760d6a06378c2142e216fc6644183ce19

Timestamp of repository khoverlay: Wed, 23 Aug 2023 07:46:47 +0000
Head commit of repository khoverlay: d127e8419056fe83b1a2bf9ef9970505198f424d

Timestamp of repository libressl: Sat, 26 Aug 2023 15:31:38 +0000
Head commit of repository libressl: b429ba7975cf845941bd4bf0396cc878b66d23b0

Head commit of repository librewolf: 9fd9f4571ae3b188dc1e994d587467ce43ed1f13

Timestamp of repository palemoon: Tue, 22 Aug 2023 17:16:54 +0000
Head commit of repository palemoon: a9b8be9ba65a3c12a9b5726b0f31dc559d6fe289

Timestamp of repository steam-overlay: Wed, 23 Aug 2023 07:46:41 +0000
Head commit of repository steam-overlay: f99709b5ad1cef25a18763987742b5e07cd1e649

Head commit of repository stefan_overlay: 35b898e7c63fed8ececbdeca5389cec5fffbb822

sh bash 5.2_p15-r6
ld GNU ld (Gentoo 2.41 p2) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r6::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           2.7.18_p16-r1::libressl, 3.11.5::libressl
dev-util/cmake:            3.27.4::gentoo
dev-util/meson:            1.2.1-r1::gentoo
sys-apps/baselayout:       2.14::gentoo
sys-apps/openrc:           0.48::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/autoconf:        2.13-r8::gentoo, 2.71-r7::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.41-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             13.2.1_p20230826::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.4::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r1::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 

gentoo-static
    location: /var/db/repos/gentoo-static
    sync-type: git
    sync-uri: https://github.com/NeddySeagoon/gentoo-static.git
    masters: gentoo
    volatile: False

khoverlay
    location: /var/db/repos/khoverlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/khoverlay.git
    masters: gentoo
    volatile: False

libressl
    location: /var/db/repos/libressl
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/libressl.git
    masters: gentoo
    volatile: False

librewolf
    location: /var/db/repos/librewolf
    sync-type: git
    sync-uri: https://codeberg.org/librewolf/gentoo.git
    masters: gentoo
    volatile: False

palemoon
    location: /var/db/repos/palemoon
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/palemoon.git
    masters: gentoo
    volatile: False

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo
    volatile: False

stefan_overlay
    location: /var/db/repos/stefan_overlay
    sync-type: git
    sync-uri: https://github.com/stefan11111/stefan_overlay.git
    masters: gentoo
    volatile: False

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -pipe -march=native -flto=4 -frecord-gcc-switches -ftree-vectorize -ffast-math -funswitch-loops -fno-semantic-interposition -fipa-pta -fdevirtualize-at-ltrans"
CHOST="x86_64-pc-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"
CXXFLAGS="-O3 -pipe -march=native -flto=4 -frecord-gcc-switches -ftree-vectorize -ffast-math -funswitch-loops -fno-semantic-interposition -fipa-pta -fdevirtualize-at-ltrans"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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 XDG_STATE_HOME"
FCFLAGS="-O3 -pipe -march=native -flto=4 -frecord-gcc-switches -ftree-vectorize -ffast-math -funswitch-loops -fno-semantic-interposition -fipa-pta -fdevirtualize-at-ltrans"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O3 -pipe -march=native -flto=4 -frecord-gcc-switches -ftree-vectorize -ffast-math -funswitch-loops -fno-semantic-interposition -fipa-pta -fdevirtualize-at-ltrans"
GENTOO_MIRRORS="http://ftp.romnet.org/gentoo/ http://mirrors.xservers.ro/gentoo/ http://bloodnoc.org/~roy/olde-distfiles/"
INSTALL_MASK="/etc/systemd /lib/systemd /usr/lib/systemd /usr/lib/modules-load.d /usr/lib/tmpfiles.d *tmpfiles* /var/lib/dbus /lib/udev /usr/share/icons /usr/share/applications /usr/share/gtk-3.0/emoji /usr/lib64/palemoon/gtk2"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j4"
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="X alsa amd64 asm git grub ipv6 jit jumbo-build libressl lto man minimal native-symlinks olde-gentoo rsync-verify split-usr ssl test-rust threads verify-sig" ABI_X86="64" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="libressl" ELIBC="glibc" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher" GRUB_PLATFORMS="efi-64" KERNEL="linux" LUA_SINGLE_TARGET="luajit" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="nvidia"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, 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 4 stefan11111 2023-08-28 19:25:04 UTC
When building with just CFLAGS="-O3 -pipe -march=native -flto=4 -frecord-gcc-switches -ftree-vectorize -ffast-math -funswitch-loops -fipa-pta -fdevirtualize-at-ltrans", the build succeeds, but it spits this out:

../lib/libnetlink.c: In function 'iproute_flush':
../lib/libnetlink.c:1382:17: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=]
 1382 |                 memcpy(RTA_DATA(rta), data, alen);
      |                 ^
../lib/libnetlink.c:354:33: note: at offset [32, 40] into destination object 'nlh' of size 16
  354 |                 struct nlmsghdr nlh;
      |                                 ^
../lib/libnetlink.c: In function 'get_netnsid_from_netnsid':
../lib/libnetlink.c:1382:17: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=]
 1382 |                 memcpy(RTA_DATA(rta), data, alen);
      |                 ^
ipnetns.c:378:33: note: at offset 24 into destination object 'n' of size 16
  378 |                 struct nlmsghdr n;
      |                                 ^
../lib/libnetlink.c: In function 'ipaddr_modify':
../lib/libnetlink.c:1382:17: warning: writing 16 bytes into a region of size 12 [-Wstringop-overflow=]
 1382 |                 memcpy(RTA_DATA(rta), data, alen);
      |                 ^
ipaddress.c:2431:33: note: at offset [4, 16] into destination object 'n' of size 16
 2431 |                 struct nlmsghdr n;
      |                                 ^
../lib/libnetlink.c: In function 'iplink_parse':
../lib/libnetlink.c:1382:17: warning: writing 16 bytes into a region of size 12 [-Wstringop-overflow=]
 1382 |                 memcpy(RTA_DATA(rta), data, alen);
      |                 ^
ip_common.h:117:33: note: at offset [4, 16] into destination object 'n' of size 16
  117 |         struct nlmsghdr         n;
      |                                 ^
../lib/libnetlink.c:1382:17: warning: writing 16 bytes into a region of size 12 [-Wstringop-overflow=]
 1382 |                 memcpy(RTA_DATA(rta), data, alen);
      |                 ^
ip_common.h:117:33: note: at offset [4, 16] into destination object 'n' of size 16
  117 |         struct nlmsghdr         n;
      |                                 ^
../lib/libnetlink.c: In function 'xfrm_state_modify.constprop':
../lib/libnetlink.c:1382:17: warning: writing 24 bytes into a region of size 12 [-Wstringop-overflow=]
 1382 |                 memcpy(RTA_DATA(rta), data, alen);
      |                 ^
xfrm_state.c:276:33: note: at offset [4, 16] into destination object 'n' of size 16
  276 |                 struct nlmsghdr n;
      |                                 ^
../lib/libnetlink.c: In function 'seg6_do_cmd':
../lib/libnetlink.c:1382:17: warning: writing 16 bytes into a region of size 12 [-Wstringop-overflow=]
 1382 |                 memcpy(RTA_DATA(rta), data, alen);
      |                 ^
ipseg6.c:134:9: note: at offset [4, 16] into destination object 'n' of size 16
  134 |         SEG6_REQUEST(req, 1024, opts.cmd, NLM_F_REQUEST);
      |         ^
../lib/libnetlink.c: In function 'do_show_or_flush':
../lib/libnetlink.c:1382:17: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=]
 1382 |                 memcpy(RTA_DATA(rta), data, alen);
      |                 ^
../lib/libnetlink.c:396:33: note: at offset [32, 40] into destination object 'nlh' of size 16
  396 |                 struct nlmsghdr nlh;
      |                                 ^
../lib/libnetlink.c: In function 'do_modify_nl':
../lib/libnetlink.c:1382:17: warning: writing 16 bytes into a region of size 12 [-Wstringop-overflow=]
 1382 |                 memcpy(RTA_DATA(rta), data, alen);
      |                 ^
ipmacsec.c:413:9: note: at offset [4, 16] into destination object 'n' of size 16
  413 |         MACSEC_GENL_REQ(req, MACSEC_BUFLEN, cmd, NLM_F_REQUEST);
      |         ^
In function 'memset',
    inlined from 'parse_rtattr_flags' at ../lib/libnetlink.c:1517:2,
    inlined from 'parse_rtattr' at ../lib/libnetlink.c:1509:9,
    inlined from 'bond_print_stats_attr' at iplink_bond.c:839:2:
/usr/include/bits/string_fortified.h:59:10: warning: '__builtin___memset_chk' writing 32 bytes into a region of size 24 overflows the destination [-Wstringop-overflow=]
   59 |   return __builtin___memset_chk (__dest, __ch, __len,
      |          ^
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-28 19:29:58 UTC
Please use attachments for large pastes.

Please also avoid making bug reports with -ffast-math, as it breaks standards compliance and is not simply an optimisation.

-fipa-pta should also not be used unless you measure a performance improvement, per GCC upstream recommendations, because it's both a buggy optimisation pass for now but also very slow at compile-time.

Anyway, your second paste is unrelated.
Comment 6 stefan11111 2023-08-28 19:41:02 UTC
(In reply to Sam James from comment #5)
> Please use attachments for large pastes.
> 
> Please also avoid making bug reports with -ffast-math, as it breaks
> standards compliance and is not simply an optimisation.
> 
> -fipa-pta should also not be used unless you measure a performance
> improvement, per GCC upstream recommendations, because it's both a buggy
> optimisation pass for now but also very slow at compile-time.

-fipa-pta is one of the recommendations from the GentooLTO overlay.

This happens even with COMMON_FLAGS="-O1 -fno-semantic-interposition" or higher -O level.
However, it works with COMMON_FLAGS="-O0 -fno-semantic-interposition" or COMMON_FLAGS="-fno-semantic-interposition"
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-28 19:41:33 UTC
(In reply to stefan11111 from comment #6)
> -fipa-pta is one of the recommendations from the GentooLTO overlay.
> 

and?
Comment 8 Ionen Wolkens gentoo-dev 2023-08-28 19:58:05 UTC
(In reply to stefan11111 from comment #6)
> -fipa-pta is one of the recommendations from the GentooLTO overlay.
I don't think there's much that the LTO overlay actually recommends, they recognize that it's experimental and it's just something that's attempted by default until someone reports an issue so they can disable it by default for specific packages.

Albeit IMO that one should just be dropped entirely.
Comment 9 Holger Hoffstätte 2023-09-05 12:30:45 UTC
(In reply to Holger Hoffstätte from comment #2)

> IMHO the sanest way forward here is to remove libbsd as USE flag and either
> use it or not, depending on glibc >= 2.38.

After looking a bit further into this it seems the opposite is true, and we should just remove any dependency on libbsd, since that is just not needed at all moving forward due to the existing strlcat/strlcpy implementations in iproute. Upstream's "optional fallback" to libbsd was really the worst possible idea here.
Comment 10 Holger Hoffstätte 2023-09-05 14:47:46 UTC
WIP branch, iproute2-6.4.0 only for now:
https://github.com/hhoffstaette/gentoo/commits/iproute2

This:
- removes the libbsd USE and dependency, which is not needed
- undoes the libbsd enforcement by iproute2-5.12.0-configure-nomagic.patch
- removes the optional libbsd fallback from iproute's configure

All this will make iproute2 use glibc's strlcpy when built on glibc-2.38.
It builds successfully & works with LTO and -fno-semantic-interposition.

Would appreciate if someone could test the build on glibc <2.38, where it should simply fall back onto its own strlcpy.

If it works I'll make a PR.
Comment 11 Mike Gilbert gentoo-dev 2023-09-05 15:15:20 UTC
(In reply to Holger Hoffstätte from comment #10)

Thanks for the investigation!
Comment 12 Ninpo 2023-09-05 15:35:24 UTC
Created attachment 869880 [details]
iproute2 build.log without libbsd
Comment 13 Ninpo 2023-09-05 15:35:53 UTC
Built successfully with glibc 2.37-r3.
Comment 14 Holger Hoffstätte 2023-09-05 15:38:04 UTC
(In reply to Ninpo from comment #13)
> Built successfully with glibc 2.37-r3.

Cool, thanks for testing! \o/
Comment 15 Larry the Git Cow gentoo-dev 2023-09-16 10:25:15 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7b6f5746b3fc5690a0d7542003d26f12780bb4c

commit c7b6f5746b3fc5690a0d7542003d26f12780bb4c
Author:     Holger Hoffstätte <holger@applied-asynchrony.com>
AuthorDate: 2023-09-05 17:28:29 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-09-16 10:13:18 +0000

    sys-apps/iproute2: remove libbsd IUSE and dependency
    
    This removes libbsd from IUSE as it does nothing except create problems
    due to another patch. It is also no longer needed since glibc-2.38;
    for older glibc versions we can let configure fall back to iproute's
    built-in strlcpy.
    
    Closes: https://bugs.gentoo.org/911727
    Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/iproute2/iproute2-5.15.0-r1.ebuild | 173 ++++++++++++++++++++++
 sys-apps/iproute2/iproute2-6.0.0-r1.ebuild  | 209 +++++++++++++++++++++++++++
 sys-apps/iproute2/iproute2-6.1.0-r2.ebuild  | 210 +++++++++++++++++++++++++++
 sys-apps/iproute2/iproute2-6.2.0-r2.ebuild  | 214 +++++++++++++++++++++++++++
 sys-apps/iproute2/iproute2-6.3.0-r1.ebuild  | 214 +++++++++++++++++++++++++++
 sys-apps/iproute2/iproute2-6.4.0-r1.ebuild  | 215 ++++++++++++++++++++++++++++
 sys-apps/iproute2/iproute2-9999.ebuild      |  12 +-
 7 files changed, 1238 insertions(+), 9 deletions(-)
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-02 02:49:01 UTC
I've also sent https://lore.kernel.org/netdev/20231202024705.1375296-1-sam@gentoo.org/T/#u upstream.
Comment 17 Larry the Git Cow gentoo-dev 2023-12-02 04:03:11 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=68de100047e59fb73d796848ef4c4735958a1651

commit 68de100047e59fb73d796848ef4c4735958a1651
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-12-02 02:51:24 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-12-02 03:28:16 +0000

    sys-apps/iproute2: add strlcpy modern C configure patch
    
    Bug: https://bugs.gentoo.org/911727
    Signed-off-by: Sam James <sam@gentoo.org>

 ...Add-_GNU_SOURCE-to-strlcpy-configure-test.patch |  25 +++
 sys-apps/iproute2/iproute2-6.6.0-r1.ebuild         | 215 +++++++++++++++++++++
 2 files changed, 240 insertions(+)