-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests segfault on i386 #3637
Comments
See randombit/botan#3637 Note that this only seems to segfault on Edge and not on -stable.
This definitely looks like a miscompilation bug - Thanks for the docker script, that certainly will help with reproducing. Presumably we can modify the code in some way to avoid the miscompilation similar to what was done in #3492 |
Unfortunately docker seems to be in some broken state on my machine, it may take some time before I can repro this. |
something to support this is the fact this doesn't crash built with clang. it also does not crash with -O0. it crashes with -O1 or anything higher (but not -Os). |
that said, "magic UB somewhere nobody saw" is also likely to crash with one and not another.. and sadly we don't have sanitizers on x86 to at least perform a few checks for that |
since it doesn't crash with -Os but does crash with -O1, that narrows the list of optimisations that can be looked at for which one breaks it.. |
OK well "good" news - I can reproduce this locally on an Arch Linux system with GCC 13.1.1 building for x86_32
We have a CI build for x86_32 (https://github.com/randombit/botan/actions/runs/5636570107/job/15287907155) which isn't having problems, but that is on GCC 11.2 |
Rebuilding with UbSan/Asan to see if that gives a clue Update: with |
|
(was passing it wrong, actually does pass with -Os) |
I tried creating a minimal repro (https://gist.github.com/randombit/b0008fc5e1ee752b7fb62d6e0e78af12) which ... doesn't crash 😭 |
WTF - the repro does crash if I put the function That to me puts this firmly into GCC bug territory. |
the current gist state then sounds small enough to be put in the gcc bugzilla. do you feel like it, or should we? |
thank you! |
Even knowing what tickles the bug I cannot find a way of restructuring the library code in a way that prevents the miscompilation. I'd suggest in the meantime building with |
since the Os does work, insofar as tests, (edited above) we set that for now. hopefully there's a response and it's not an ignored bug, in which case we get a real fix :) |
GCC bug is at least confirmed now, hopefully someone will take a look at it |
Bug is reportedly fixed in GCC master, unfortunately the patch did not make it in time to be included in GCC 13.2. Since there is not (AFAICT) a way for us to work around this bug within our code I don't think there is any further action possible, so closing this. Thanks again for reporting this, and for maintaining the Alpine packaging. |
Bug: randombit/botan#3637 Bug: https://gcc.gnu.org/PR110792 Signed-off-by: Sam James <sam@gentoo.org>
On Alpine Linux Edge, we noticed that the botan test suite segfaults in the
whirlpool.cpp
code on i386.The relevant part of the backtrace looks as follows:
So it seems to segfault in
Botan::rotr
:botan/src/lib/utils/rotate.h
Lines 27 to 37 in bfd60f0
The invocation of
Botan::rotr
isrotr<32>(WHIRL_S[get_byte<4>(K4)])
from:botan/src/lib/hash/whirlpool/whirlpool.cpp
Line 114 in bfd60f0
Dockerfile to reproduce the segfault:
Make sure to adjust the make jobs accordingly.
The text was updated successfully, but these errors were encountered: