public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* My dynamic loader refuses to load libQt5Core because of the ABI tag note
@ 2021-10-07 18:47 Krzysztof Żelechowski
  2021-10-07 18:53 ` Jeffrey Walton
  2021-10-07 19:14 ` Carlos O'Donell
  0 siblings, 2 replies; 6+ messages in thread
From: Krzysztof Żelechowski @ 2021-10-07 18:47 UTC (permalink / raw)
  To: libc-help

/usr/lib/YaST2/bin/y2controlcenter
                /usr/lib/YaST2/bin/y2controlcenter: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
uname -r
                4.4.0-19041-Microsoft
ldd /usr/lib64/libQt5Widgets.so.5
libQt5Core.so.5 => not found
/usr/lib64/libQt5Core.so.5
                This is the QtCore library version Qt 5.12.7 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.5.0)
Copyright (C) 2016 The Qt Company Ltd.
Contact: http://www.qt.io/licensing/

Installation prefix: /usr
Library path:        lib64
Include path:        include/qt5
Processor features:  sse2[required] sse3 ssse3 fma sse4.1 sse4.2 movbe popcnt aes avx f16c rdrnd bmi avx2 bmi2 rdseed sha
readelf -n /usr/lib64/libQt5Core.so.5
Displaying notes found in: .note.ABI-tag
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 3.17.0
objcopy -R .note.ABI-tag /usr/lib64/libQt5Core.so.5 /tmp/libQt5Core.so.5
LD_LIBRARY_PATH=/tmp /usr/lib/YaST2/bin/y2controlcenter

Please help!
Please note that the error message "No such file or directory" is as misleading as can be.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: My dynamic loader refuses to load libQt5Core because of the ABI tag note
  2021-10-07 18:47 My dynamic loader refuses to load libQt5Core because of the ABI tag note Krzysztof Żelechowski
@ 2021-10-07 18:53 ` Jeffrey Walton
  2021-10-07 19:00   ` Carlos O'Donell
  2021-10-07 19:14 ` Carlos O'Donell
  1 sibling, 1 reply; 6+ messages in thread
From: Jeffrey Walton @ 2021-10-07 18:53 UTC (permalink / raw)
  To: Krzysztof Żelechowski; +Cc: libc-help

On Thu, Oct 7, 2021 at 2:47 PM Krzysztof Żelechowski via Libc-help
<libc-help@sourceware.org> wrote:
>
> /usr/lib/YaST2/bin/y2controlcenter
>                 /usr/lib/YaST2/bin/y2controlcenter: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
> uname -r
>                 4.4.0-19041-Microsoft
> ldd /usr/lib64/libQt5Widgets.so.5
> libQt5Core.so.5 => not found
> /usr/lib64/libQt5Core.so.5
>                 This is the QtCore library version Qt 5.12.7 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.5.0)
> Copyright (C) 2016 The Qt Company Ltd.
> Contact: http://www.qt.io/licensing/
>
> Installation prefix: /usr
> Library path:        lib64
> Include path:        include/qt5
> Processor features:  sse2[required] sse3 ssse3 fma sse4.1 sse4.2 movbe popcnt aes avx f16c rdrnd bmi avx2 bmi2 rdseed sha
> readelf -n /usr/lib64/libQt5Core.so.5
> Displaying notes found in: .note.ABI-tag
>   Owner                Data size        Description
>   GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
>     OS: Linux, ABI: 3.17.0
> objcopy -R .note.ABI-tag /usr/lib64/libQt5Core.so.5 /tmp/libQt5Core.so.5
> LD_LIBRARY_PATH=/tmp /usr/lib/YaST2/bin/y2controlcenter

Off-topic, this is probably CVE worthy:

    LD_LIBRARY_PATH=/tmp

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: My dynamic loader refuses to load libQt5Core because of the ABI tag note
  2021-10-07 18:53 ` Jeffrey Walton
@ 2021-10-07 19:00   ` Carlos O'Donell
  2021-10-07 19:05     ` Adhemerval Zanella
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos O'Donell @ 2021-10-07 19:00 UTC (permalink / raw)
  To: noloader, Krzysztof Żelechowski; +Cc: libc-help

On 10/7/21 14:53, Jeffrey Walton via Libc-help wrote:
> On Thu, Oct 7, 2021 at 2:47 PM Krzysztof Żelechowski via Libc-help
> <libc-help@sourceware.org> wrote:
>>
>> /usr/lib/YaST2/bin/y2controlcenter
>>                 /usr/lib/YaST2/bin/y2controlcenter: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
>> uname -r
>>                 4.4.0-19041-Microsoft
>> ldd /usr/lib64/libQt5Widgets.so.5
>> libQt5Core.so.5 => not found
>> /usr/lib64/libQt5Core.so.5
>>                 This is the QtCore library version Qt 5.12.7 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.5.0)
>> Copyright (C) 2016 The Qt Company Ltd.
>> Contact: http://www.qt.io/licensing/
>>
>> Installation prefix: /usr
>> Library path:        lib64
>> Include path:        include/qt5
>> Processor features:  sse2[required] sse3 ssse3 fma sse4.1 sse4.2 movbe popcnt aes avx f16c rdrnd bmi avx2 bmi2 rdseed sha
>> readelf -n /usr/lib64/libQt5Core.so.5
>> Displaying notes found in: .note.ABI-tag
>>   Owner                Data size        Description
>>   GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
>>     OS: Linux, ABI: 3.17.0
>> objcopy -R .note.ABI-tag /usr/lib64/libQt5Core.so.5 /tmp/libQt5Core.so.5
>> LD_LIBRARY_PATH=/tmp /usr/lib/YaST2/bin/y2controlcenter
> 
> Off-topic, this is probably CVE worthy:
> 
>     LD_LIBRARY_PATH=/tmp

Why is this CVE worthy?

The user copied a library to /tmp, stripping a section, and then restarted the binary
with an LD_LIBRARY_PATH to use the temporary copy of the library with the changes.

LD_LIBRARY_PATH is used *after* DT_RPATH (if DT_RUNPATH is not present), and so has
precedence as expected, and is controlled by the user.

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: My dynamic loader refuses to load libQt5Core because of the ABI tag note
  2021-10-07 19:00   ` Carlos O'Donell
@ 2021-10-07 19:05     ` Adhemerval Zanella
  0 siblings, 0 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2021-10-07 19:05 UTC (permalink / raw)
  To: Carlos O'Donell, noloader, Krzysztof Żelechowski; +Cc: libc-help



On 07/10/2021 16:00, Carlos O'Donell via Libc-help wrote:
> On 10/7/21 14:53, Jeffrey Walton via Libc-help wrote:
>> On Thu, Oct 7, 2021 at 2:47 PM Krzysztof Żelechowski via Libc-help
>> <libc-help@sourceware.org> wrote:
>>>
>>> /usr/lib/YaST2/bin/y2controlcenter
>>>                 /usr/lib/YaST2/bin/y2controlcenter: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
>>> uname -r
>>>                 4.4.0-19041-Microsoft
>>> ldd /usr/lib64/libQt5Widgets.so.5
>>> libQt5Core.so.5 => not found
>>> /usr/lib64/libQt5Core.so.5
>>>                 This is the QtCore library version Qt 5.12.7 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.5.0)
>>> Copyright (C) 2016 The Qt Company Ltd.
>>> Contact: http://www.qt.io/licensing/
>>>
>>> Installation prefix: /usr
>>> Library path:        lib64
>>> Include path:        include/qt5
>>> Processor features:  sse2[required] sse3 ssse3 fma sse4.1 sse4.2 movbe popcnt aes avx f16c rdrnd bmi avx2 bmi2 rdseed sha
>>> readelf -n /usr/lib64/libQt5Core.so.5
>>> Displaying notes found in: .note.ABI-tag
>>>   Owner                Data size        Description
>>>   GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
>>>     OS: Linux, ABI: 3.17.0
>>> objcopy -R .note.ABI-tag /usr/lib64/libQt5Core.so.5 /tmp/libQt5Core.so.5
>>> LD_LIBRARY_PATH=/tmp /usr/lib/YaST2/bin/y2controlcenter
>>
>> Off-topic, this is probably CVE worthy:
>>
>>     LD_LIBRARY_PATH=/tmp
> 
> Why is this CVE worthy?
> 
> The user copied a library to /tmp, stripping a section, and then restarted the binary
> with an LD_LIBRARY_PATH to use the temporary copy of the library with the changes.
> 
> LD_LIBRARY_PATH is used *after* DT_RPATH (if DT_RUNPATH is not present), and so has
> precedence as expected, and is controlled by the user.
> 

And there is some discussion whether is up to glibc to deny preload
of file with NOEXEC mounts [1] (if it is what you might be referring).

[1] https://sourceware.org/pipermail/libc-alpha/2021-August/130403.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: My dynamic loader refuses to load libQt5Core because of the ABI tag note
  2021-10-07 18:47 My dynamic loader refuses to load libQt5Core because of the ABI tag note Krzysztof Żelechowski
  2021-10-07 18:53 ` Jeffrey Walton
@ 2021-10-07 19:14 ` Carlos O'Donell
  2021-10-08  8:03   ` Krzysztof Żelechowski
  1 sibling, 1 reply; 6+ messages in thread
From: Carlos O'Donell @ 2021-10-07 19:14 UTC (permalink / raw)
  To: Krzysztof Żelechowski, libc-help

Second time around, forgot to TO libc-help.

On 10/7/21 14:47, Krzysztof Żelechowski via Libc-help wrote:
> /usr/lib/YaST2/bin/y2controlcenter
>                 /usr/lib/YaST2/bin/y2controlcenter: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory

This kind of question needs to be raised with the distribution maintainer since they
are responsible for providing the libraries required to run core applications (usually
OpenSUSE or SUSE) like YaST.

What does 'readelf -a -W /usr/lib/YaST2/bin/y2controlcenter' return?

Alternatively run with:

LD_DEBUG_OUTPUT=/tmp/y2cc LD_DEBUG=all /usr/lib/YaST2/bin/y2controlcenter

Then you'll find /tmp/y2cc.$PID with the details from the dynamic loader operations
that were taken to try find the DSO. This should give you further information to
try track down what is broken or missing (is there a DT_RPATH, or DT_RUNPATH, or other
that is getting in the way).

> uname -r
>                 4.4.0-19041-Microsoft

This looks like WSL2 running a specific Microsoft Linux kernel.

> ldd /usr/lib64/libQt5Widgets.so.5
> libQt5Core.so.5 => not found
> /usr/lib64/libQt5Core.so.5
>                 This is the QtCore library version Qt 5.12.7 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.5.0)
> Copyright (C) 2016 The Qt Company Ltd.
> Contact: http://www.qt.io/licensing/
>
> Installation prefix: /usr
> Library path:        lib64
> Include path:        include/qt5
> Processor features:  sse2[required] sse3 ssse3 fma sse4.1 sse4.2 movbe popcnt aes avx f16c rdrnd bmi avx2 bmi2 rdseed sha
> readelf -n /usr/lib64/libQt5Core.so.5
> Displaying notes found in: .note.ABI-tag
>   Owner                Data size        Description
>   GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
>     OS: Linux, ABI: 3.17.0

That's OK, this just means you need a Linux Kernel 3.17.0 to run and you have that.

The only possible problem is if the kernel exposes a vDSO with a Linux note that has
an *old* version in it. You can dump the vDSO with gdb and examine it.

Likewise uname() might return something odd. I haven't tested. You could check with
a small program what uname() returns?

What does `cat /proc/sys/kernel/osrelease` print?

> objcopy -R .note.ABI-tag /usr/lib64/libQt5Core.so.5 /tmp/libQt5Core.so.5
> LD_LIBRARY_PATH=/tmp /usr/lib/YaST2/bin/y2controlcenter

Does this actually work?

> Please note that the error message "No such file or directory" is as misleading as can be.
 
Yes, in some cases the "unloadable file" ends up with "No such file or directory"

I agree we could do better for a diagnostic in this case.

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: My dynamic loader refuses to load libQt5Core because of the ABI tag note
  2021-10-07 19:14 ` Carlos O'Donell
@ 2021-10-08  8:03   ` Krzysztof Żelechowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Żelechowski @ 2021-10-08  8:03 UTC (permalink / raw)
  To: Carlos O'Donell, libc-help

I repeat the most important stuff:

/usr/lib/YaST2/bin/y2controlcenter

	/usr/lib/YaST2/bin/y2controlcenter: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory

LD_DEBUG=all returns a ton of stuff but there is no mention of an OS version mismatch, just that the library could not be found, which is mind-boggling.

readelf -n /usr/lib64/libQt5Core.so.5

	Displaying notes found in: .note.ABI-tag
	Owner                Data size        Description
	GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
	OS: Linux, ABI: 3.17.0

objcopy -R .note.ABI-tag /usr/lib64/libQt5Core.so.5 /tmp/libQt5Core.so.5

LD_LIBRARY_PATH=/tmp /usr/lib/YaST2/bin/y2controlcenter

	qt.qpa.xcb: could not connect to display

cat /proc/sys/kernel/osrelease

	4.4.0-19041-Microsoft

This shows that
	1) the library is present and correct, 
	2) the dynamic loader does not care about diagnostics, 
	3) the dynamic loader is undocumented as to how it uses the ABI tag note and where it takes its idea of OS version from.

How do I examine kernel vDSO?

I have no way of reporting this problem to the distro until we have confirmed it is the ABI note problem as I suppose it is, and I expect it to be confirmed by an appropriate diagnostic emitted by the dynamic loader.  I would rather not tell the distro maintainers to dig into function open_verify to see that, especially as you need to know that it compares %EAX to %EDX and you have to si and figure out which register represents which version.

Thanks for your help,
Chris


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-08  8:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 18:47 My dynamic loader refuses to load libQt5Core because of the ABI tag note Krzysztof Żelechowski
2021-10-07 18:53 ` Jeffrey Walton
2021-10-07 19:00   ` Carlos O'Donell
2021-10-07 19:05     ` Adhemerval Zanella
2021-10-07 19:14 ` Carlos O'Donell
2021-10-08  8:03   ` Krzysztof Żelechowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).