-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
static binary crashing with NULL symbol #2054
Comments
fyi @fidencio |
/cc @Jakob-Naucke |
Hmm @clnperez. Just dumping a few thoughts: |
@tuliom FYI Thanks @Jakob-Naucke. I am still using the older glibc in the default osbuilder distros. I think @Amulyam24 may have tried a newer distro. IIUC, the container libc wouldn't unless this was dynamically compiled either way -- but I could be wrong!
Can you clarify what you're referring to here when you say "it is relatively new?" |
@clnperez I meant: The file |
@Jakob-Naucke, to confirm, the error persists irrespective of the glibc version used by the guest or the container(Tried with glibc<2.32 in combination of guest OS - Fedora 30 - glibc 2.29 + container - Ubuntu 18.04 - glibc 2.27). |
Ah, it probably stems from the build host glibc (specifically due to the static linkage). I don't have an idea about the underlying issue though. |
Ok, so, it turns out we did have a small recreator for this (thanks @Amulyam24). I just hadn't run it on a different host with a downlevel gcc. I can recreate this on my laptop (fedora 33) and a ppc64le system, so it at least isn't a power-only problem. So I compiled it locally (fc33 on x86), and copied it into a fc32 container to run.
Just to make sure:
After talking with someone on our toolchain team, she suggested I look for anything calling
I'm not sure how to track that down. Hopefully some of this is helpful for some more digging at least. |
It really seems this only happens with more recent glibc. |
@Jakob-Naucke -- I may be misunderstanding your last comment. I thought that you'd mostly root-caused this in this comment that it would only happen with glibc 2.32 and later if built using an earlier glibc. But I'm also surprised that you could reproduce it with 2.27 in the Ubuntu 18.04 container. |
@clnperez No, I meant building it on a more recent glibc than running it all along. But my comment was very confusing 🙂 Poking around a little more, I found that this happens when building with glibc >= 2.32 and running on glibc <= 2.31. I think it's also noteworthy that when you build dynamically instead, you will get the error
The error |
This is reproducible without Rust:
built with
|
Thank you @Jakob-Naucke !
Running a program dynamically linked against a newer glibc on a system with an older glibc is unsupported because the older glibc can't support all the features of the new one. IMHO, the real question is in the static case which does make usage of dynamic linking via |
From @tuliom in Bugzilla:
@clnperez I can reproduce this with Rust too. Building the Rust example against 2.33 and linking statically, the code runs just fine. So I think this is an issue with glibc 2.32 and no version before or after. |
Thanks guys. It's good to know it's not just rust. And @Jakob-Naucke, I flipped the versions around in my comment . So that only added to the confusion here. :D It does seem to be only related to that one add in glibc 2.32. |
Statically linked glibc binaries aren't very portable. In general, you need to run them on a system with exactly the same glibc version. (Dynamically linked binaries can run on newer glibc versions, too.) |
@fweimer-rh -- That seems to indicate that there shouldn't be static agent binaries for kata at all then? /cc @fidencio |
@clnperez I don't know your exact requirements. If you need static binaries for isolation from the host environment, you need to stick to a certain subset if using glibc. It so happens that Using one of the smaller libcs instead might be a better alternative for you. The other alternative would be to inject the application along with its own dynamically-linked glibc. |
Thanks @fweimer-rh Sounds like we should close this as a known limitation then? Also happy to keep it open and test as progress towards improved static linking is made. |
building it against |
This issue can be closed?
This was a helpful reference for me to better understand when static linking to glibc breaks beyond the more commonly cited examples. |
Thanks for the updates, I'll close based on the above. If there is more to figure out here, feel free to create a discussion, or reopen/create a new issue if our |
target: ppc64le-unknown-linux-gnu & stable-x86_64-unknown-linux-gnu
a statically compiled kata agent binary crashes in what looks to be a dynamic-library-related function. The binaries were built using the latest libc so that we could pick up the fix for statically compiling on non-x86 architectures (#2046).
However, we are seeing this:
dl-call-libc-early-init.c:37: _dl_call_libc_early_init: Assertion sym != NULL failed
The place @Amulyam24 has narrowed it down to is possibly in this openpty call: https://github.com/kata-containers/kata-containers/blob/main/src/agent/rustjail/src/container.rs#L881
I was once stuck on an issue with go that involved ptys, and in that case TCSETS and TCGETS values were wrong for ppc64le. See golang/go#19560. So I can't help but be suspicious, but the dl_ part of this makes me think it's probably not related.
Unfortunately, there's not a lot of info in the logs, and we haven't been able to find a small recreator. I'm opening this here in hopes that someone has some tips for getting more information.
kata-issue-1387-trace.out.txt
The text was updated successfully, but these errors were encountered: