-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
segfault on Libdl.dllist()
on 32-bit Linux
#24643
Comments
Good that you can reproduce it. Jameson mentioned that in #21849 (comment) but I couldn't reproduce locally. Were you able to figure out what actually segfaults in the debugger? |
No, I haven't figured out why the segfault is occurring. Unfortunately, packaging up the binary and running it outside of the docker environment doesn't trigger the bug. If you like, I can get you SSH access in? |
I'm actually thinking this might be an alignment issue. I had some time to dig back into this; the segmentation fault is occurring within this chunk of code passed in to
Inspecting the
I don't have a particularly good way of tying this native code back to Julia source, unfortunately. My best attempts to get this are shown here, but it appears that |
Since |
How old is the buildbot? I would guess that this is due to the stack requirement not being met on old glibc versions/code compiled with old gcc. I'm pretty sure this requirement is much younger than i386 and I've also seen comment in glibc mentioning the stack realignment requirement in order to support code compiled with old gcc. If that's true, just stepping back up two levels should give an aligned stack and disassembling the |
Yes, @yuyichao is correct, stepping back up to
I think it's pretty obvious that Do you think this is a bug in glibc or GCC? E.g. if I use a newer GCC to build glibc 2.12, do you think that will fix the problem? |
Note that sp isn't aligned to 16 when entering the function (sp + 4 is).
It's a C function so glibc should be fine.
Not sure... |
I guess my question is, why don't newer versions of glibc have this
problem? Is it that the C source code somehow demanded the right stack
alignment, or is it that newer GCCs automatically emit code that keeps the
stack aligned properly?
-E
…On Sat, Nov 18, 2017 at 12:30 PM, Yichao Yu ***@***.***> wrote:
due to the sub $0x48,%esp
Note that sp isn't aligned to 16 when entering the function (sp + 4 is).
Do you think this is a bug in glibc or GCC
It's a C function so glibc should be fine.
if I use a newer GCC to build glibc 2.12, do you think that will fix the
problem?
Not sure...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#24643 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAH_aDYsMaSu4dgDyrsRH9swWpouRax1ks5s3z6DgaJpZM4QipXM>
.
|
Seems like a gcc bug. I didn’t think 4.4.7 was that old to pre-date the ABI change. Sounds like a good idea to try recompiling glibc with a newer gcc. |
It should be GCC's job though IIRC it can be controlled by command line flags too. I wasn't sure since I wasn't able to reproduce an issue on gcc 4.4.7 on https://gcc.godbolt.org/ |
(To clarify, the Linux user space ABI changed sometime after the introduction of AVX. While we could alter our cfunction stub to be backwards compatible, in practice that isn’t usually necessary, since the ABI change is generally assumed to have occurred a while ago) |
Google confirmed for me: this was a breaking change for the gcc 4.5 release (2010). |
Hmmm, I tried to build my own
Here's the output with |
If anyone wants to try this out at home, you can |
Compile glibc with |
Can you try using this patch on the x86 buildog: diff --git a/src/codegen.cpp b/src/codegen.cpp
index 9f4a02ef10..105c926a2f 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -6646,6 +6646,7 @@ extern "C" void *jl_init_llvm(void)
// to ensure compatibility with GCC codes
options.StackAlignmentOverride = 16;
#endif
+ options.StackAlignmentOverride = 4;
EngineBuilder eb((std::unique_ptr<Module>(engine_module)));
std::string ErrorStr;
eb .setEngineKind(EngineKind::JIT) If this works as it should, I'll make a PR to put this behind a compiler flag (something like |
It seems that it would be dangerous since it may not give 16bytes alignments for other functions anymore? (judging from the comment). |
Yeah, we'll also have to fix the rest of the build, but that's a secondary issue. |
But it'll make the binary built unusable everywhere else |
That seems OK? If we want to build for & distribute a binary with the new (post-gcc 4.5) ABI, we need to build on a buildbot OS that uses it. |
The it seems that we should just drop the support or provide multiple generic binary. |
I agree that we should just drop support for the older ABI going forward. I just built a new buildbot based on Debian 8 that still uses a relatively old glibc (2.19) and is built with the proper ABI flags. It's also having trouble with |
This is confirmed fixed by bumping up to Debian 8. Yay. |
Latest
master
segfaults if you runLibdl.dllist()
:The text was updated successfully, but these errors were encountered: