-
Notifications
You must be signed in to change notification settings - Fork 823
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
ELF section .note.ABI-tag breaks shared libraries #3023
Comments
This "atomic bomb" workaround helps too:
Will barf out a few errors where libraries are actually linker scripts. No ill effects. |
Just came across this in a Google search. Not sure if it is relevant or not but just FYI glibc creates an ABI-invalid .note section for that exact section. I have just filed a bug against glibc about that. |
Works for me on Linux in a VM. The ELF standard notwithstanding, having the runtime linker not work due to a quirk in WSL is an issue. Interestingly enough, the newer shared objects added the option to call them directly, having them say more or less "I'm a library". Calling that |
What, exactly, is causing this? The ELF note in a shared object is only parsed by the glibc dynamic linker during program loading, not the kernel, so it is unclear to me why there would be a difference between Linux and Windows in this context. Perhaps the auxiliary vector contains some data which tells glibc not to load the shared object with this kind of ABI note? |
I've been also curious for my own edification: What, exactly, is special about the |
Yes, it would certainly be interesting to see the output of If the Windows kernel self-identifies itself as something earlier than kernel version 3.17, then the dynamic linker is completely right to ignore the object. |
WSL self identifies as |
@therealkenc Actually, the glibc dynamic linker looks at the ABI notes and refuses to load incompatible DSOs. To determine the kernel version, it prefers the version reported in the vDSO, followed by uname, followed by the contents of |
I can't remember the Linux distribution that had the binary. It was either Debian sid or Arch testing. Sorry guys. You can list sections for your own binaries though. |
Ah. That was kinda relevant to mention in the the OP (grumble). This is possibly related to #2820, which was on Arch. In that issue |
@noahbaxter it's somewhere in @therealkenc the issue's reproducible on Debian sid. You can install it into a chroot via No idea what causes it to begin with, binutils, gcc, GNU libc or something else...? |
Reproducible on Gentoo with Qt-5.11.1, Glibc-2.27 and gcc-8.1.0 @sthalik : Thanks for your "atomic bomb", this one saved my day! 👍 |
... by stripping an incompatible ABI note as suggested here: microsoft/WSL#3023
I can confirm that stripping the tag resolves the problem with Arch. Afterwards Qt5 works fine. |
This would break programs relying on stripped information in the binary files. For example, modified |
Hello, I have a problem that Qt5 based applications won't run on WSL. After googling I was drawn here.
Here's the dump $ objdump -s -j .note.ABI-tag /lib/libQt5Core.so.5|less /lib/libQt5Core.so.5: file format elf64-x86-64 Contents of section .note.ABI-tag: Feel free to ask for more info. |
For ArchLinux users, it's possible to utilize pacman hooks to automatize the stripping of the
Upon every Qt5 upgrade after that, the offending section will be stripped automatically. If |
Thanks for the tip. Does the stripping result in any instability? If the ABI versions don't match I would imagine Qt issuing an unsupported syscall sooner or later? |
No, the field is to be read as follows, see here and here: The minimum kernel version for the binary is required to be the Linux kernel version given by the last 3 blocks, i.e. in your case It's worth noting that the ABI tag is specified and required for LSB binaries, and that this is not an issue with Qt5 at all. I can't say why Qt5 uses the field, but LSB requires support for it, and the low kernel version emulated by Microsoft is the issue here. This is by design enforced by the dynamic linker and thus the installed FWIW, stripping the tag only disables the check by the dynamic linker for the kernel version to be at least as high and has no other effects. So if a given binary works after the check was removed, it won't cause any particular issues or changes in behavior. For WSL the kernel version isn't particularly meaningful anyways. |
Okay, I've debugged this a bit, there's actually another issue at hand here. Since I've got this on Arch with a requirement of 4.11.0 I thought it was just the fact that the kernel version is too low. However that's not quite the case, and that's why people with the older 3.17.0 version see this too. This needs a bit of explanation how Now,
The problem for us is going to be 1), the other two identify as kernel 4.4.0. To see what 1 gives, we need to dump the kernel vDSO ourselves. The easy way to do this is by opening
Now with
The relevant part is the last 4 bytes, it is to be read as kernel version @therealkenc can you forward this to whoever is responsible for the vDSO? |
Very nice investigation. 🏆
I don't really know whose around anymore. @benhillis maybe. What might help the chances of this one being looked at immeasurably would be specific repro steps to create a shared library with one Same was suggested in May 2018. It might be overkill, your analysis might be self-evident, and this might be a matter of changing a |
Right, I'll see if I can generate a simple example. It's easily reproduced by using a similar trick to what Qt5 itself does. They explicitly add an assembly file with the section information and have a header that differentiates between the available kernel features it was configured with. Qt5 can use Aside from the mismatch, which can be easily reproduced and argued why it's an issue - LSB also demands that LSB compliant binaries require the proper kernel version, and if That aside, I don't understand why Qt5 would be entirely out of scope. Qt is not a GUI library in itself, and there's a lot of features in the library that have nothing to do with GUI or hardware abstractions, like XML parsers, an SQL abstraction layer, networking, concurrency extensions, and these are also common place in the C++ world, even on servers. The problem also has nothing to do with the combination of Qt and certain distros, but rather depends on what syscalls are exposed in the glibc of the system the binary is being built on. If you were to compile Qt5 yourself on Ubuntu, you'd still run into this problem, albeit not in the |
Qt has fallback code for other kernels. They could do run-time detection and drop the ABI note. The Qt in Red Hat Enterprise Linux 8 has been patched to do just this, to preserve compatibility with the Red Hat Enterprise Linux 7 kernel. |
Preaching to the choir, brother. Personally I don't think any of these libraries have thing-one to do with 'graphics'. Some of the functions end up reading and writing bytes down a socket, maybe, sometimes, depending on the function. But, sadly, this line of reasoning (most unfortunately) falls down, because of issue submissions along the lines of (say, made-up example) "VLC doesn't run I get You can game the system of course, and that's exactly what folks should do. Any large graphic or server scenario can be turned into a small CLI one. Chrome (about as big as it gets) used to die because |
This being an universal issue in itself is good in a way. At some point it's bound to become a problem serious enough for WSL's vendor to fix it. Especially given Debian's and Ubuntu's preference for pulling in all possible compile-time dependencies.
Not in practice, either. I'm running some Qt project with |
Part of the reason this one went sideways though is Qt apps, even stuff like VLC, run alright on Ubuntu 18.04 from the Store. Then it gets revealed after the fact it wasn't Ubuntu from the Store and the coffin nails came out. I can't tell you why Qt5 is okay on Ubuntu, because I never looked. But it doesn't require any stripping of
I suspect (or would like to hope) this issue would have gotten more grease if |
So you're saying that some recent Debian version doesn't exhibit this behavior? My sid/experimental with Qt 5.11 has this.
Qt has some dubious stuff where Qt5Core can be invokes as an executable directly too. I don't think it should exist in the tree to begin with, but of course WSL ought to support ELF binaries correctly. |
As detailed in nextpnr #444 post-close comments, I am seeing this error in a fresh WSL1 Ubuntu 20.04 install:
edit: version info WSL on
|
I had an error with libQt5Core on WSL and I fixed it by using this workaround: YosysHQ/nextpnr#444 (comment) |
this also happens for octave install in WSL1 Ubuntu focal (20.04LTS) from store on Windows 10.0.18363.1556:
|
Considering running GUI linux apps in win11 is supposed to be a feature, you'd think this 4+ year old bug would have been looked at |
glibc 2.36 will remove the kernel version check. From the NEWS file:
|
I'm also facing a similar situation, applying the patch |
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request. Thank you! |
Your Windows build number: (Type
ver
at a Windows Command Prompt)What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)
Executing
lupdate
from Qt5 tools,LD_DEBUG=all ldd /usr/lib/libQt5Xml.so
, etc.Doesn't treat
libQt5Core.so.5
as a suitable library, as perWhat's wrong / what should be happening instead:
As long as ELF section called
.note.ABI-tag
exists, the library can't be linked to by other shared objects. It can be executed directly by theld-linux
linker however.The workaround is to
strip --remove-section=.note.ABI-tag /usr/lib/libQt5Core.so.5.10.1
.See how the section's presence influences
file(1)
output:Finally, without the section:
Strace of the failing command, if applicable[...]
openat
of the library,read
,lseek
,close
, barf out error message on the standard error file descriptor andexit_group
.Similarly
LD_DEBUG=all
shows opening the ELF without further information other than an error message.After removing the tag, the runtime linking process proceeds normally.
The text was updated successfully, but these errors were encountered: