today dhcp recompiled with gcc 11.1, because libressl was removed (didnt used it) and i noticed that at least half of my devices stopped getting ip. there was absolutely no errors during compile phase, or there isnt any definite errors in syslog from dhcp, however as soon as i reverted back to gcc 10.3 and recompiled dhcp, everything started to work again, funny thing is, not every device was affected... just about 2/3 of them... considering my gentoo is also my main router i dont have days to figure out why its not working, however there is defiantly something wrong with dhcp compiled with gcc 11.1 Reproducible: Always mih ~ # emerge --info Portage 3.0.18 (python 3.8.9-final-0, default/linux/amd64/17.1/hardened, gcc-10.3.0, glibc-2.33, 5.12.1-gentoo x86_64) ================================================================= System uname: Linux-5.12.1-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_X5670_@_2.93GHz-with-glibc2.2.5 KiB Mem: 12268372 total, 4621148 free KiB Swap: 16777684 total, 16773332 free Timestamp of repository gentoo: Mon, 03 May 2021 14:20:11 +0000 Head commit of repository gentoo: 174bdd63cd76e92d077b816934f357946e1409c4 sh bash 5.1_p4 ld GNU ld (Gentoo 2.36.1 p3) 2.36.1 app-shells/bash: 5.1_p4::gentoo dev-lang/perl: 5.32.1::gentoo dev-lang/python: 3.8.9_p2::gentoo dev-util/cmake: 3.20.2::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.7-r2::gentoo sys-apps/openrc: 0.43.3::gentoo sys-apps/sandbox: 2.23::gentoo sys-devel/autoconf: 2.69-r5::gentoo sys-devel/automake: 1.16.3-r1::gentoo sys-devel/binutils: 2.36.1-r1::gentoo sys-devel/gcc: 10.3.0::gentoo sys-devel/gcc-config: 2.4::gentoo sys-devel/libtool: 2.4.6-r6::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.12::gentoo (virtual/os-headers) sys-libs/glibc: 2.33::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo.git priority: -1000 sync-git-verify-commit-signature: true local location: /var/db/repos/local masters: gentoo ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -pipe -O3 -fomit-frame-pointer" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/share/gnupg/qualified.txt /var/bind" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.0/ext-active/ /etc/php/cgi-php8.0/ext-active/ /etc/php/cli-php8.0/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=native -pipe -O3 -fomit-frame-pointer" DISTDIR="/var/cache/distfiles" 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="-march=native -pipe -O3 -fomit-frame-pointer" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-march=native -pipe -O3 -fomit-frame-pointer" GENTOO_MIRRORS="https://mirror.netcologne.de/gentoo/ https://ftp.halifax.rwth-aachen.de/gentoo/ https://mirror.yandex.ru/gentoo-distfiles/" LANG="sl_SI.utf8" LDFLAGS="-Wl,-O3 -Wl,--as-needed -Wl,--sort-common -Wl,--hash-style=gnu" LINGUAS="en sl" MAKEOPTS="-j12 -l12" 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" USE="acl acpi amd64 apache2 apng berkdb bittorrent btrfs bzip2 caps cgi cli client corefonts crypt curl dhcp dlz dovecot-sasl eap exif expat experimental extraengine fontconfig ftp gd gdbm glib gmp gssapi gzip hardened http2 iconv icu idn intl iptables ipv6 ithreads jpeg kerberos lcms libglvnd libtirpc lz4 lzma lzo managesieve mp3 multilib mysql mysqli ncurses nls nping nptl openmp openssl pam pci pcntl pcre pcre16 pcre32 pdo perl pie png posix python rar readline rpc rtmp samba seccomp server session sieve slang smtp soap sockets socks5 spf split-usr sqlite ssh ssl ssp suexec tcpd threads tiff tracepath truetype udev unicode urandom usb vhosts webui x264 x265 xattr xml xmlreader xmlrpc xmlwriter xslt xtpax xvid xz zip zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 authn_dbd authn_socache authz_dbd cache_socache dbd http2 proxy proxy_html proxy_http proxy_http2 proxy_wstunnel xml2enc" APACHE2_MPMS="event" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 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 sl" 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-0" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="geoip" Unset: CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS this --info is after gcc reverse, however its ONLY change
A log from compiling with gcc 11 may be useful as well as runtime logs.
Also, just to note.. >considering my gentoo is also my main router i dont have days to figure out why its not working, however there is defiantly something wrong with dhcp compiled with gcc 11.1 Really, for something critical like this, you should be using stable, which would not have GCC 11 yet.
(In reply to Sam James from comment #2) > Also, just to note.. > >considering my gentoo is also my main router i dont have days to figure out why its not working, however there is defiantly something wrong with dhcp compiled with gcc 11.1 > > Really, for something critical like this, you should be using stable, which > would not have GCC 11 yet. And I also suggest you try with -O2 given that -O3 has a tendency to cause problems with code containing undefined behaviour in C.
(In reply to Sam James from comment #2) > Also, just to note.. > >considering my gentoo is also my main router i dont have days to figure out why its not working, however there is defiantly something wrong with dhcp compiled with gcc 11.1 > > Really, for something critical like this, you should be using stable, which > would not have GCC 11 yet. Well I dont mind if something breaks for couple of hours, its just annoying when family members are starting to complain that internet is not working :) Anyway maybe ill have couple oh hours tomorrow when nobody will be using internet and im gonna try suggested things. syslog for example for DHCP doesnt offer anything, just discover and offer spam like this: May 3 16:30:29 mih dhcpd[16480]: DHCPDISCOVER from 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:29 mih dhcpd[16480]: DHCPOFFER on 10.0.0.79 to 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:30 mih dhcpd[16480]: DHCPDISCOVER from 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:30 mih dhcpd[16480]: DHCPOFFER on 10.0.0.79 to 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:32 mih dhcpd[16480]: DHCPDISCOVER from 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:32 mih dhcpd[16480]: DHCPOFFER on 10.0.0.79 to 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:36 mih dhcpd[16480]: DHCPDISCOVER from 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:36 mih dhcpd[16480]: DHCPOFFER on 10.0.0.79 to 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:44 mih dhcpd[16480]: DHCPDISCOVER from 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:44 mih dhcpd[16480]: DHCPOFFER on 10.0.0.79 to 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:50 mih dhcpd[16480]: DHCPDISCOVER from 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:50 mih dhcpd[16480]: DHCPOFFER on 10.0.0.79 to 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:51 mih dhcpd[16480]: DHCPDISCOVER from 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:51 mih dhcpd[16480]: DHCPOFFER on 10.0.0.79 to 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:53 mih dhcpd[16480]: DHCPDISCOVER from 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:53 mih dhcpd[16480]: DHCPOFFER on 10.0.0.79 to 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:56 mih dhcpd[16480]: DHCPDISCOVER from 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:30:56 mih dhcpd[16480]: DHCPOFFER on 10.0.0.79 to 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:31:04 mih dhcpd[16480]: DHCPDISCOVER from 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan May 3 16:31:04 mih dhcpd[16480]: DHCPOFFER on 10.0.0.79 to 6e:1d:32:30:2e:47 (SoLoR-s-phone) via lan This one was my samsung android phone, funny thing is i checked 2 huawei android phones and they where getting IP just fine, while my brother development oneplus android phone was also not working...
(In reply to Sam James from comment #3) > (In reply to Sam James from comment #2) > > Also, just to note.. > > >considering my gentoo is also my main router i dont have days to figure out why its not working, however there is defiantly something wrong with dhcp compiled with gcc 11.1 > > > > Really, for something critical like this, you should be using stable, which > > would not have GCC 11 yet. > > And I also suggest you try with -O2 given that -O3 has a tendency to cause > problems with code containing undefined behaviour in C. You are right, when i compiled dhcp with gcc11 and -O2 instead of -O3 it works, but it also works with gcc10 and -O3, so there is still something funky going on.... anyway ill attach both build logs if it helps.
Created attachment 705888 [details] build-gcc11-O3
Created attachment 705891 [details] build-gcc11-O2
Does the bug happen without -march=native? Chances are that gcc is now able to optimise things more aggressively and is able to expose latent bugs in the programs. Typical suspects for gcc-11 are -fipa-modref -fstrict-aliasing. You can try to build dhcp with `-O3 -fno-ipa-modref` and `-O3 -fno-strict-aliasing` to check if that alone is enough to trigger working/broken state. Otherwise you can try to find minimum amount of -O3 flags needed to be added to -O2 to see failures. Can be extracted with: $ diff -U0 <(LANG=C gcc -O2 -Q --help=optimizers) <(LANG=C gcc -O3 -Q --help=optimizers) https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide#.5Bbonus.5D_minimize_needed_flags_to_reproduce_failure Narrowing flags down will simplify inspection of generated code.
Created attachment 706785 [details] build-gcc11-O3-fno-strict-aliasing Yes -O3 -fno-strict-aliasing produces working dhcp for me i also attached log if it help.
(In reply to Klemen Mihevc from comment #9) > Created attachment 706785 [details] > build-gcc11-O3-fno-strict-aliasing > > Yes -O3 -fno-strict-aliasing produces working dhcp for me i also attached > log if it help. Aha, that's useful! Fun fact: upstream ./configure already tries to use -fno-strict-aliasing when compiling some .c files, but does not apply it everywhere.
(In reply to Sergei Trofimovich from comment #10) > (In reply to Klemen Mihevc from comment #9) > > Created attachment 706785 [details] > > build-gcc11-O3-fno-strict-aliasing > > > > Yes -O3 -fno-strict-aliasing produces working dhcp for me i also attached > > log if it help. > > Aha, that's useful! > > Fun fact: upstream ./configure already tries to use -fno-strict-aliasing > when compiling some .c files, but does not apply it everywhere. I did notice that in log yes, thats why i was surprised it makes a difference at all, however i didnt notice its not applied to everything...
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ea2cf10a9f26e915cada4262066dacd87513a62 commit 7ea2cf10a9f26e915cada4262066dacd87513a62 Author: Sam James <sam@gentoo.org> AuthorDate: 2021-07-28 02:58:13 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2021-07-28 02:59:31 +0000 net-misc/dhcp: avoid undefined/broken runtime behaviour with -O3 -fstrict-aliasing (enabled by -O3) breaks code within dhcp which violates the no-strict-aliasing rule. So, let's tag on an option to avoid assuming that rule / avoid the optimisation which is unsafe here. Bug: https://bugs.gentoo.org/787935 Signed-off-by: Sam James <sam@gentoo.org> net-misc/dhcp/{dhcp-4.4.2_p1.ebuild => dhcp-4.4.2_p1-r1.ebuild} | 4 ++++ 1 file changed, 4 insertions(+)
OK nothing to be done here anymore.