Summary: | net-misc/dhcp-4.4.2-r3 have issues with gcc 11 | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Klemen Mihevc <solor> |
Component: | Current packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ionen, sam |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 732706 | ||
Attachments: |
build-gcc11-O3
build-gcc11-O2 build-gcc11-O3-fno-strict-aliasing |
Description
Klemen Mihevc
2021-05-03 17:32:58 UTC
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. |