Summary: | sys-apps/iproute2 fails to build with glibc-2.38 and -fno-semantic-interposition | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Ninpo <ninpo> |
Component: | Current packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | holger, ionen, kocelfc, sam, stefan11111 |
Priority: | Normal | Keywords: | PullRequest |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://github.com/gentoo/gentoo/pull/32636 https://bugs.gentoo.org/show_bug.cgi?id=908421 https://bugs.gentoo.org/show_bug.cgi?id=785433 https://bugs.gentoo.org/show_bug.cgi?id=902075 https://bugs.gentoo.org/show_bug.cgi?id=895080 https://bugs.gentoo.org/show_bug.cgi?id=896444 https://bugs.gentoo.org/show_bug.cgi?id=834445 https://bugs.gentoo.org/show_bug.cgi?id=916085 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101270 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 911592 | ||
Attachments: |
sys-apps/iproute2 build.log
iproute2 build.log without libbsd |
Description
Ninpo
2023-08-05 00:34:50 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. 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. 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 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, | ^ 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. (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" (In reply to stefan11111 from comment #6) > -fipa-pta is one of the recommendations from the GentooLTO overlay. > and? (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. (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. 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. (In reply to Holger Hoffstätte from comment #10) Thanks for the investigation! Created attachment 869880 [details]
iproute2 build.log without libbsd
Built successfully with glibc 2.37-r3. (In reply to Ninpo from comment #13) > Built successfully with glibc 2.37-r3. Cool, thanks for testing! \o/ 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(-) I've also sent https://lore.kernel.org/netdev/20231202024705.1375296-1-sam@gentoo.org/T/#u upstream. 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(+) |