Bug 472409 - Assertion '!overlap' failed.
Summary: Assertion '!overlap' failed.
Status: REOPENED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.21.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-19 22:00 UTC by Stefan de Konink
Modified: 2023-08-26 13:24 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Output with debugging on (239.16 KB, text/plain)
2023-07-20 19:11 UTC, Stefan de Konink
Details
verbose log from building Ladybird (228.72 KB, text/plain)
2023-07-24 01:32 UTC, Dominique Liberda
Details
full link line (15.26 KB, text/plain)
2023-07-24 06:31 UTC, psykose
Details
pmap output (105.27 KB, text/plain)
2023-07-24 22:07 UTC, Stefan de Konink
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan de Konink 2023-07-19 22:00:50 UTC
SUMMARY
Valgrind on Alpine Linux debugging a Qt6 application gave me several issues. The first issue was already resolved in git a few days ago (453c7111133ce9dc5dce043e03b7b58efdbf46cd). This has been patched today in Alpine Linux.

I end up with the trace below.


STEPS TO REPRODUCE
1.  valgrind --tool=none --track-fds=yes ./myapp

OBSERVED RESULT

==2489== Nulgrind, the minimal Valgrind tool
==2489== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote.
==2489== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==2489== Command: ./myapp -platform xcb
==2489== 
==2491== 
==2491== FILE DESCRIPTORS: 3 open (3 std) at exit.
==2491== 

valgrind: m_debuginfo/debuginfo.c:914 (truncate_DebugInfoMapping_overlaps): Assertion '!overlap' failed.

host stacktrace:
==2489==    at 0x5801C37D: show_sched_status_wrk (m_libcassert.c:406)
==2489==    by 0x5801C5D9: report_and_quit (m_libcassert.c:477)
==2489==    by 0x5801C7AA: vgPlain_assert_fail (m_libcassert.c:543)
==2489==    by 0x5803323E: vgPlain_di_notify_mmap (debuginfo.c:1151)
==2489==    by 0x580598A2: vgModuleLocal_generic_PRE_sys_mmap (syswrap-generic.c:2465)
==2489==    by 0x58010329: vgSysWrap_amd64_linux_sys_mmap_before (syswrap-amd64-linux.c:413)
==2489==    by 0x5800EF24: vgPlain_client_syscall (syswrap-main.c:2240)
==2489==    by 0x5800B88E: handle_syscall (scheduler.c:1206)
==2489==    by 0x5800E0B6: vgPlain_scheduler (scheduler.c:1552)
==2489==    by 0x58062ADE: run_a_thread_NORETURN (syswrap-linux.c:102)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable syscall 9 (lwpid 2489)
==2489==    at 0x4035244: mmap (syscall_arch.h:61)
==2489==    by 0x4059E37: map_library (dynlink.c:646)
==2489==    by 0x405A667: load_library (dynlink.c:1181)
==2489==    by 0x405BA53: dlopen (dynlink.c:2163)
==2489==    by 0x59A53A2: ??? (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x59A61C1: ??? (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x59A6417: ??? (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x5824A2F: QFactoryLoader::instance(int) const (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x4FB09E3: ??? (in /usr/lib/libQt6Gui.so.6.5.1)
==2489==    by 0x4FB4E51: QImageWriter::supportedImageFormats() (in /usr/lib/libQt6Gui.so.6.5.1)
==2489==    by 0x13C65098: ??? (in /usr/lib/qt6/plugins/multimedia/libffmpegmediaplugin.so)
==2489==    by 0x13C6A179: ??? (in /usr/lib/qt6/plugins/multimedia/libffmpegmediaplugin.so)
==2489==    by 0x97FE0D9: QPlatformMediaIntegration::instance() (in /usr/lib/libQt6Multimedia.so.6.5.1)
==2489==    by 0x9813EDE: QVideoSink::QVideoSink(QObject*) (in /usr/lib/libQt6Multimedia.so.6.5.1)
==2489==    by 0x97857CE: QQuickVideoOutput::QQuickVideoOutput(QQuickItem*) (in /usr/lib/libQt6MultimediaQuick.so.6.5.1)
==2489==    by 0x978FA6B: ??? (in /usr/lib/libQt6MultimediaQuick.so.6.5.1)
==2489==    by 0x4C3DFFB: QQmlType::create(void**, unsigned long) const (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4C3E0AB: QQmlType::createWithQQmlData() const (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4BFEEFA: QQmlObjectCreator::createInstance(int, QObject*, bool) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4C006B4: QQmlObjectCreator::setPropertyBinding(QQmlPropertyData const*, QV4::CompiledData::Binding const*) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4C02B5E: QQmlObjectCreator::setupBindings(QFlags<QQmlObjectCreator::BindingMode>) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4C0A262: QQmlObjectCreator::populateInstance(int, QObject*, QObject*, QQmlPropertyData const*, QV4::CompiledData::Binding const*) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4BFEA4B: QQmlObjectCreator::createInstance(int, QObject*, bool) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4BFB424: QQmlObjectCreator::create(int, QObject*, QQmlInstantiationInterrupt*, int) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4BFE84E: QQmlObjectCreator::createInstance(int, QObject*, bool) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4C006B4: QQmlObjectCreator::setPropertyBinding(QQmlPropertyData const*, QV4::CompiledData::Binding const*) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4C02B5E: QQmlObjectCreator::setupBindings(QFlags<QQmlObjectCreator::BindingMode>) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4C0A262: QQmlObjectCreator::populateInstance(int, QObject*, QObject*, QQmlPropertyData const*, QV4::CompiledData::Binding const*) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4BFEA4B: QQmlObjectCreator::createInstance(int, QObject*, bool) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4C006B4: QQmlObjectCreator::setPropertyBinding(QQmlPropertyData const*, QV4::CompiledData::Binding const*) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4C02B5E: QQmlObjectCreator::setupBindings(QFlags<QQmlObjectCreator::BindingMode>) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4C0A262: QQmlObjectCreator::populateInstance(int, QObject*, QObject*, QQmlPropertyData const*, QV4::CompiledData::Binding const*) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4BFEA4B: QQmlObjectCreator::createInstance(int, QObject*, bool) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4BFB424: QQmlObjectCreator::create(int, QObject*, QQmlInstantiationInterrupt*, int) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4B9044D: QQmlComponentPrivate::beginCreate(QQmlRefPointer<QQmlContextData>) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4B9073A: QQmlComponentPrivate::doBeginCreate(QQmlComponent*, QQmlContext*) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4B92A19: QQmlComponentPrivate::createWithProperties(QObject*, QMap<QString, QVariant> const&, QQmlContext*, QQmlComponentPrivate::CreateBehavior) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4B92CB8: QQmlComponent::create(QQmlContext*) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4B7B72A: QQmlApplicationEnginePrivate::finishLoad(QQmlComponent*) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x4B7BCC3: QQmlApplicationEngine::load(QUrl const&) (in /usr/lib/libQt6Qml.so.6.5.1)
==2489==    by 0x111AFF: main (in /home/skinkie/blxview++/build/myapp)
client stack range: [0x1FFEFF6000 0x1FFF000FFF] client SP: 0x1FFEFFBFA0
valgrind stack range: [0x1002D3C000 0x1002E3BFFF] top usage: 8368 of 1048576

Thread 2: status = VgTs_WaitSys syscall 7 (lwpid 2490)
==2489==    at 0x4054F0A: ??? (syscall_cp.s:29)
==2489==    by 0x40520ED: __syscall_cp_c (pthread_cancel.c:33)
==2489==    by 0x4045BF9: poll (poll.c:9)
==2489==    by 0x6286ABF: ??? (in /usr/lib/libglib-2.0.so.0.7600.4)
==2489==    by 0x62243ED: g_main_context_iteration (in /usr/lib/libglib-2.0.so.0.7600.4)
==2489==    by 0x59A691D: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x57C163A: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x58A4D1F: QThread::exec() (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x6340F3A: ??? (in /usr/lib/libQt6DBus.so.6.5.1)
==2489==    by 0x58E3B71: ??? (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x4052BB5: start (pthread_create.c:207)
==2489==    by 0x4054ED6: ??? (clone.s:22)
client stack range: [0x7AF2000 0x7B12FFF] client SP: 0x7B125E8
valgrind stack range: [0x1004DCD000 0x1004ECCFFF] top usage: 5408 of 1048576

Thread 3: status = VgTs_WaitSys syscall 7 (lwpid 2492)
==2489==    at 0x4054F0A: ??? (syscall_cp.s:29)
==2489==    by 0x40520ED: __syscall_cp_c (pthread_cancel.c:33)
==2489==    by 0x4045BF9: poll (poll.c:9)
==2489==    by 0x70F8CB3: ??? (in /usr/lib/libxcb.so.1.1.0)
==2489==    by 0x70FA35A: xcb_wait_for_event (in /usr/lib/libxcb.so.1.1.0)
==2489==    by 0x7A2182D: ??? (in /usr/lib/libQt6XcbQpa.so.6.5.1)
==2489==    by 0x58E3B71: ??? (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x4052BB5: start (pthread_create.c:207)
==2489==    by 0x4054ED6: ??? (clone.s:22)
client stack range: [0x7B2B000 0x7B4BFFF] client SP: 0x7B4B6B8
valgrind stack range: [0x1004ED1000 0x1004FD0FFF] top usage: 5408 of 1048576

Thread 4: status = VgTs_WaitSys syscall 7 (lwpid 2493)
==2489==    at 0x4054F0A: ??? (syscall_cp.s:29)
==2489==    by 0x40520ED: __syscall_cp_c (pthread_cancel.c:33)
==2489==    by 0x4045BF9: poll (poll.c:9)
==2489==    by 0x6286ABF: ??? (in /usr/lib/libglib-2.0.so.0.7600.4)
==2489==    by 0x62243ED: g_main_context_iteration (in /usr/lib/libglib-2.0.so.0.7600.4)
==2489==    by 0x59A691D: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x57C163A: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x58A4D1F: QThread::exec() (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x58E3B71: ??? (in /usr/lib/libQt6Core.so.6.5.1)
==2489==    by 0x4052BB5: start (pthread_create.c:207)
==2489==    by 0x4054ED6: ??? (clone.s:22)
client stack range: [0x7B82000 0x8382FFF] client SP: 0x8382638
valgrind stack range: [0x1005040000 0x100513FFFF] top usage: 7456 of 1048576

Thread 5: status = VgTs_WaitSys syscall 202 (lwpid 2494)
==2489==    at 0x4054F0A: ??? (syscall_cp.s:29)
==2489==    by 0x40520ED: __syscall_cp_c (pthread_cancel.c:33)
==2489==    by 0x40516DE: __timedwait_cp (__timedwait.c:24)
==2489==    by 0x40524F9: pthread_cond_timedwait (pthread_cond_timedwait.c:100)
==2489==    by 0x9CB115B: ??? (in /usr/lib/xorg/modules/dri/libgallium_dri.so)
==2489==    by 0x9D2D817: ??? (in /usr/lib/xorg/modules/dri/libgallium_dri.so)
==2489==    by 0x4052BB5: start (pthread_create.c:207)
==2489==    by 0x4054ED6: ??? (clone.s:22)
client stack range: [0x1396D000 0x1398DFFF] client SP: 0x1398D668
valgrind stack range: [0x1007376000 0x1007475FFF] top usage: 3256 of 1048576

Thread 6: status = VgTs_WaitSys syscall 202 (lwpid 2495)
==2489==    at 0x4054F0A: ??? (syscall_cp.s:29)
==2489==    by 0x40520ED: __syscall_cp_c (pthread_cancel.c:33)
==2489==    by 0x40516DE: __timedwait_cp (__timedwait.c:24)
==2489==    by 0x40524F9: pthread_cond_timedwait (pthread_cond_timedwait.c:100)
==2489==    by 0x9CB115B: ??? (in /usr/lib/xorg/modules/dri/libgallium_dri.so)
==2489==    by 0x9D2D817: ??? (in /usr/lib/xorg/modules/dri/libgallium_dri.so)
==2489==    by 0x4052BB5: start (pthread_create.c:207)
==2489==    by 0x4054ED6: ??? (clone.s:22)
client stack range: [0x13AD1000 0x13AF1FFF] client SP: 0x13AF1668
valgrind stack range: [0x100747A000 0x1007579FFF] top usage: 3928 of 1048576

EXPECTED RESULT

A working trace within the application.

SOFTWARE/OS VERSIONS
Qt Version: Qt 6.5.1
Comment 1 Paul Floyd 2023-07-20 08:37:08 UTC
Can you tell what library libQt6Core is trying to load?

And if you can deternine that, can you get the program header with objdump -p, for instance on amd64 RHEL 7.9 libm I get

/lib64/libm.so.6:     file format elf64-x86-64

Program Header:
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**21
         filesz 0x0000000000100834 memsz 0x0000000000100834 flags r-x
    LOAD off    0x0000000000100d60 vaddr 0x0000000000300d60 paddr 0x0000000000300d60 align 2**21
         filesz 0x0000000000000384 memsz 0x00000000000003d8 flags rw-
 DYNAMIC off    0x0000000000100d80 vaddr 0x0000000000300d80 paddr 0x0000000000300d80 align 2**3
         filesz 0x0000000000000230 memsz 0x0000000000000230 flags rw-
    NOTE off    0x00000000000001c8 vaddr 0x00000000000001c8 paddr 0x00000000000001c8 align 2**2
         filesz 0x0000000000000044 memsz 0x0000000000000044 flags r--
EH_FRAME off    0x00000000000f86a8 vaddr 0x00000000000f86a8 paddr 0x00000000000f86a8 align 2**2
         filesz 0x000000000000122c memsz 0x000000000000122c flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x0000000000100d60 vaddr 0x0000000000300d60 paddr 0x0000000000300d60 align 2**0
         filesz 0x00000000000002a0 memsz 0x00000000000002a0 flags r--

What I'm interested in is the LOAD sections.

Valgrind has a fairly narrow (and hard-coded) loader. This works for the defaults with GNU BFD ld and LLVM lld (and anything that generates the same program header layout).

If you are using an incompatible link editor or linker scripts that change the LOAD segments then that is likely to cause problems.

Secondly could you run Valgrind with -d -d -d ?
That will generate large amounts of output. The bit that I want to see should look like

--6499-- di_notify_mmap-0:
--6499-- di_notify_mmap-1: 0x4028000-0x402cfff r--
--6499-- di_notify_mmap-2: /home/paulf/scratch/valgrind/drd/tests/dlopen_lib.so
--6499-- di_notify_mmap-3: is_rx_map 0, is_rw_map 0, is_ro_map 1
--6499-- di_notify_mmap-4: noting details in DebugInfo* at 0x10024C0590
--6499-- di_notify_mmap-6: no dinfo loaded /home/paulf/scratch/valgrind/drd/tests/dlopen_lib.so (no rx or no rw mapping)
--6499-- di_notify_mmap-0:
--6499-- di_notify_mmap-1: 0x4029000-0x4029fff r-x
--6499-- di_notify_mmap-2: /home/paulf/scratch/valgrind/drd/tests/dlopen_lib.so
--6499-- di_notify_mmap-3: is_rx_map 1, is_rw_map 0, is_ro_map 0
--6499-- di_notify_mmap-4: noting details in DebugInfo* at 0x10024C0590
--6499-- di_notify_mmap-6: no dinfo loaded /home/paulf/scratch/valgrind/drd/tests/dlopen_lib.so (no rx or no rw mapping)
--6499-- di_notify_mmap-0:
--6499-- di_notify_mmap-1: 0x402a000-0x402cfff r--
--6499-- di_notify_mmap-2: /home/paulf/scratch/valgrind/drd/tests/dlopen_lib.so
--6499-- di_notify_mmap-3: is_rx_map 0, is_rw_map 0, is_ro_map 1
--6499-- di_notify_mmap-4: noting details in DebugInfo* at 0x10024C0590
--6499-- di_notify_mmap-6: no dinfo loaded /home/paulf/scratch/valgrind/drd/tests/dlopen_lib.so (no rx or no rw mapping)
--6499-- di_notify_mmap-0:
--6499-- di_notify_mmap-1: 0x402b000-0x402cfff rw-
--6499-- di_notify_mmap-2: /home/paulf/scratch/valgrind/drd/tests/dlopen_lib.so
--6499-- di_notify_mmap-3: is_rx_map 0, is_rw_map 1, is_ro_map 0
--6499-- di_notify_mmap-4: noting details in DebugInfo* at 0x10024C0590
--6499-- di_notify_mmap-5: achieved accept state for /home/paulf/scratch/valgrind/drd/tests/dlopen_lib.so
--6499-- cfsi range rx-mappings coverage check: Covered 0x0-0xffffffffffffffff

(with a different path and shared library rather than dlopen_lib.so)
Comment 2 Stefan de Konink 2023-07-20 18:51:38 UTC
Thanks for your elaborate reply. I just updated the edge files of Alpine Linux again. And valgrind now works as intented. If this appears again I'll update this issue.
Comment 3 Stefan de Konink 2023-07-20 19:11:59 UTC
Created attachment 160413 [details]
Output with debugging on

Ok, that was quick, happened again. See attachment with -d -d -d.
Comment 4 Paul Floyd 2023-07-21 12:24:23 UTC
(In reply to Stefan de Konink from comment #3)
> Created attachment 160413 [details]
> Output with debugging on
> 
> Ok, that was quick, happened again. See attachment with -d -d -d.

Could you also post the objump -p output for /usr/lib/qt6/plugins/xcbglintegrations/libqxcb-glx-integration.so ?

Valgrind is seeing overlapping segments

--2548-- di_notify_mmap-1: 0x9bbd000-0x9bc0fff r--
--2548-- di_notify_mmap-2: /usr/lib/qt6/plugins/xcbglintegrations/libqxcb-glx-integration.so
--2548-- di_notify_mmap-3: is_rx_map 0, is_rw_map 0, is_ro_map 1
--2548-- di_notify_mmap-4: noting details in DebugInfo* at 0x10051734D0
--2548-- di_notify_mmap-6: no dinfo loaded /usr/lib/qt6/plugins/xcbglintegrations/libqxcb-glx-integration.so (no rx or no rw mapping)
--2548-- di_notify_mmap-0:
--2548-- di_notify_mmap-1: 0x9bbf000-0x9bc0fff rw-
--2548-- di_notify_mmap-2: /usr/lib/qt6/plugins/xcbglintegrations/libqxcb-glx-integration.so
--2548-- di_notify_mmap-3: is_rx_map 0, is_rw_map 1, is_ro_map 0
--2548-- di_notify_mmap-4: noting details in DebugInfo* at 0x10051734D0
--2548-- di_notify_mmap-5: achieved accept state for /usr/lib/qt6/plugins/xcbglintegrations/libqxcb-glx-integration.so

Both of those end at 0x9bc0fff . I would expect the first one to end at 0x9bbf000 minus one or 0x9bbefff.
Comment 5 Dominique Liberda 2023-07-24 01:32:29 UTC
Created attachment 160488 [details]
verbose log from building Ladybird

I'm observing the same behavior when trying to run Valgrind on Alpine Linux edge (up to date as of a few hours ago), debugging [Ladybird](https://github.com/SerenityOS/serenity/tree/master/Ladybird), which uses Qt6.

```
domi@ryuko:/tmp/serenity$ valgrind --tool=none /tmp/serenity/Build/lagom/bin/ladybird
==13389== Nulgrind, the minimal Valgrind tool
==13389== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote.
==13389== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==13389== Command: /tmp/serenity/Build/lagom/bin/ladybird
==13389== 

valgrind: m_debuginfo/debuginfo.c:914 (truncate_DebugInfoMapping_overlaps): Assertion '!overlap' failed.

host stacktrace:
==13389==    at 0x5801C37D: show_sched_status_wrk (m_libcassert.c:406)
==13389==    by 0x5801C5D9: report_and_quit (m_libcassert.c:477)
==13389==    by 0x5801C7AA: vgPlain_assert_fail (m_libcassert.c:543)
==13389==    by 0x5803323E: vgPlain_di_notify_mmap (debuginfo.c:1151)
==13389==    by 0x580598A2: vgModuleLocal_generic_PRE_sys_mmap (syswrap-generic.c:2465)
==13389==    by 0x58010329: vgSysWrap_amd64_linux_sys_mmap_before (syswrap-amd64-linux.c:413)
==13389==    by 0x5800EF24: vgPlain_client_syscall (syswrap-main.c:2240)
==13389==    by 0x5800B88E: handle_syscall (scheduler.c:1206)
==13389==    by 0x5800E0B6: vgPlain_scheduler (scheduler.c:1552)
==13389==    by 0x58062ADE: run_a_thread_NORETURN (syswrap-linux.c:102)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable syscall 9 (lwpid 13389)
==13389==    at 0x4035225: mmap (syscall_arch.h:61)
==13389==    by 0x4059E18: map_library (dynlink.c:646)
==13389==    by 0x405A648: load_library (dynlink.c:1181)
==13389==    by 0x405BA34: dlopen (dynlink.c:2163)
==13389==    by 0x5C5B4B2: QLibraryPrivate::load() (qlibrary_unix.cpp:210)
==13389==    by 0x5C5C2E1: QLibraryPrivate::loadPlugin() (qlibrary.cpp:575)
==13389==    by 0x5C52137: QLibraryPrivate::pluginInstance() (qlibrary.cpp:496)
==13389==    by 0x5AD6C27: QFactoryLoader::instance(int) const (qfactoryloader.cpp:374)
==13389==    by 0x52C0DC0: QPlatformInputContextFactory::create(QString const&) (qfactoryloader_p.h:97)
==13389==    by 0xA588ECB: QXcbIntegration::initialize() (qxcbintegration.cpp:343)
==13389==    by 0x5A6DFF6: QCoreApplicationPrivate::init() (qcoreapplication.cpp:906)
==13389==    by 0x52960DC: QGuiApplicationPrivate::init() (qguiapplication.cpp:1562)
==13389==    by 0x4B32AC9: QApplicationPrivate::init() (qapplication.cpp:473)
==13389==    by 0x180AE0: serenity_main(Main::Arguments) (main.cpp:55)
==13389==    by 0x1345AA: main (Main.cpp:43)
client stack range: [0x1FFEFFD000 0x1FFF000FFF] client SP: 0x1FFEFFF230
valgrind stack range: [0x1002D3C000 0x1002E3BFFF] top usage: 7496 of 1048576

Thread 2: status = VgTs_WaitSys syscall 7 (lwpid 13390)
==13389==    at 0x4054EEB: ??? (syscall_cp.s:29)
==13389==    by 0x40520CE: __syscall_cp_c (pthread_cancel.c:33)
==13389==    by 0x4045BDA: poll (poll.c:9)
==13389==    by 0x8318ABF: g_main_context_iterate.isra.0 (gmain.c:4584)
==13389==    by 0x82B63ED: g_main_context_iteration (gmain.c:4343)
==13389==    by 0x5C5568D: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventdispatcher_glib.cpp:393)
==13389==    by 0x5A73E4A: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:182)
==13389==    by 0x5B5379F: QThread::exec() (qthread.cpp:578)
==13389==    by 0x83D2EFA: QDBusConnectionManager::run() (qdbusconnection.cpp:123)
==13389==    by 0x5B97D52: QThreadPrivate::start(void*) (qthread_unix.cpp:321)
==13389==    by 0x4052B96: start (pthread_create.c:207)
==13389==    by 0x4054EB7: ??? (clone.s:22)
client stack range: [0xA63F000 0xA65FFFF] client SP: 0xA65F5A8
valgrind stack range: [0x100948B000 0x100958AFFF] top usage: 5408 of 1048576

Thread 3: status = VgTs_WaitSys syscall 7 (lwpid 13392)
==13389==    at 0x4054EEB: ??? (syscall_cp.s:29)
==13389==    by 0x40520CE: __syscall_cp_c (pthread_cancel.c:33)
==13389==    by 0x4045BDA: poll (poll.c:9)
==13389==    by 0xA1C5CB3: ??? (in /usr/lib/libxcb.so.1.1.0)
==13389==    by 0xA1C735A: xcb_wait_for_event (in /usr/lib/libxcb.so.1.1.0)
==13389==    by 0xA58250D: QXcbEventQueue::run() (qxcbeventqueue.cpp:192)
==13389==    by 0x5B97D52: QThreadPrivate::start(void*) (qthread_unix.cpp:321)
==13389==    by 0x4052B96: start (pthread_create.c:207)
==13389==    by 0x4054EB7: ??? (clone.s:22)
client stack range: [0xA680000 0xA6A0FFF] client SP: 0xA6A0678
valgrind stack range: [0x100958F000 0x100968EFFF] top usage: 5408 of 1048576
```

I'm also attaching a log from `-d -d -d`.
Comment 6 Paul Floyd 2023-07-24 06:21:38 UTC
Again what I need is the obj dump -p output for /usr/lib/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so

Also if you can find out how that file is being linked (which link editor, using linker scripts?) that would be a big help. I’ll try asking on Qt forums.
Comment 7 psykose 2023-07-24 06:22:57 UTC
$ objdump -p /usr/lib/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so 

/usr/lib/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so:     file format elf64-x86-64

Program Header:
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**12
         filesz 0x0000000000002398 memsz 0x0000000000002398 flags r--
    LOAD off    0x0000000000003000 vaddr 0x0000000000003000 paddr 0x0000000000003000 align 2**12
         filesz 0x0000000000000e29 memsz 0x0000000000000e29 flags r-x
    LOAD off    0x0000000000004000 vaddr 0x0000000000004000 paddr 0x0000000000004000 align 2**12
         filesz 0x0000000000000818 memsz 0x0000000000000818 flags r--
    LOAD off    0x00000000000048f0 vaddr 0x00000000000058f0 paddr 0x00000000000058f0 align 2**12
         filesz 0x0000000000000830 memsz 0x00000000000008c0 flags rw-
 DYNAMIC off    0x0000000000004be0 vaddr 0x0000000000005be0 paddr 0x0000000000005be0 align 2**3
         filesz 0x0000000000000240 memsz 0x0000000000000240 flags rw-
    NOTE off    0x00000000000002a8 vaddr 0x00000000000002a8 paddr 0x00000000000002a8 align 2**3
         filesz 0x00000000000000c8 memsz 0x00000000000000c8 flags r--
    NOTE off    0x0000000000000370 vaddr 0x0000000000000370 paddr 0x0000000000000370 align 2**2
         filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
0x6474e553 off    0x00000000000002a8 vaddr 0x00000000000002a8 paddr 0x00000000000002a8 align 2**3
         filesz 0x0000000000000030 memsz 0x0000000000000030 flags r--
EH_FRAME off    0x0000000000004340 vaddr 0x0000000000004340 paddr 0x0000000000004340 align 2**2
         filesz 0x0000000000000104 memsz 0x0000000000000104 flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x00000000000048f0 vaddr 0x00000000000058f0 paddr 0x00000000000058f0 align 2**0
         filesz 0x0000000000000710 memsz 0x0000000000000710 flags r--

Dynamic Section:
  NEEDED               libxkbcommon.so.0
  NEEDED               libQt6Gui.so.6
  NEEDED               libQt6Core.so.6
  NEEDED               libstdc++.so.6
  NEEDED               libc.musl-x86_64.so.1
  RUNPATH              $ORIGIN/../../../
  INIT                 0x0000000000003000
  FINI                 0x0000000000003e26
  INIT_ARRAY           0x00000000000058f0
  INIT_ARRAYSZ         0x0000000000000008
  FINI_ARRAY           0x00000000000058f8
  FINI_ARRAYSZ         0x0000000000000008
  GNU_HASH             0x0000000000000398
  STRTAB               0x0000000000000cf8
  SYMTAB               0x0000000000000440
  STRSZ                0x0000000000000bca
  SYMENT               0x0000000000000018
  RELA                 0x0000000000001b30
  RELASZ               0x0000000000000840
  RELAENT              0x0000000000000018
  VERDEF               0x0000000000001980
  VERDEFNUM            0x0000000000000009
  FLAGS                0x0000000000000008
  FLAGS_1              0x0000000000000001
  VERNEED              0x0000000000001ab0
  VERNEEDNUM           0x0000000000000003
  VERSYM               0x00000000000018c2
  RELR                 0x0000000000002370
  RELRSZ               0x0000000000000028
  RELRENT              0x0000000000000008

Version definitions:
1 0x01 0x08d1879f libcomposeplatforminputcontextplugin.so
2 0x00 0x0acbd2c9 Qt_6_PRIVATE_API
3 0x00 0x00058a26 Qt_6
4 0x02 0x058a2910 Qt_6.0
	Qt_6 
5 0x02 0x058a2911 Qt_6.1
	Qt_6.0 
6 0x02 0x058a2912 Qt_6.2
	Qt_6.1 
7 0x02 0x058a2913 Qt_6.3
	Qt_6.2 
8 0x02 0x058a2914 Qt_6.4
	Qt_6.3 
9 0x00 0x058a2915 Qt_6.5
	Qt_6.4 

Version References:
  required from libxkbcommon.so.0:
    0x0c231840 0x00 13 V_0.5.0
  required from libQt6Core.so.6:
    0x058a2915 0x00 14 Qt_6.5
    0x00058a26 0x00 11 Qt_6
  required from libQt6Gui.so.6:
    0x00058a26 0x00 12 Qt_6
    0x0acbd2c9 0x00 10 Qt_6_PRIVATE_API
Comment 8 psykose 2023-07-24 06:31:07 UTC
Created attachment 160491 [details]
full link line
Comment 9 psykose 2023-07-24 06:32:58 UTC
nothing that special on the linker line that i can tell. the version script used is just

Qt_6_PRIVATE_API {
    qt_private_api_tag*;
};
Qt_6 { *; };
Qt_6.0 {} Qt_6;
Qt_6.1 {} Qt_6.0;
Qt_6.2 {} Qt_6.1;
Qt_6.3 {} Qt_6.2;
Qt_6.4 {} Qt_6.3;
Qt_6.5 { qt_version_tag; } Qt_6.4;
Comment 10 Paul Floyd 2023-07-24 10:33:31 UTC
I see 4 segments. Pages are 4k (0x1000).

First, RO starting at offset 0, size 0x2398.

Second, RX starting at the next page 0x3000, size 0xe29.

Third, RO starting at the next page, 0x4000 size 0x818.

Fourth and last, RW. This doesn't start at the next page 0x5000.
Instead it starts at offset 0x48f0 (0x5ff0 in virtual memory), size 0x830 (0x8c0 in memory).

I think that Valgrind is getting confused by this as it's expecting 4k page alignment.

--13740-- di_notify_mmap-1: 0xa6cc000-0xa6d2fff r--
--13740-- di_notify_mmap-0:
--13740-- di_notify_mmap-1: 0xa6cf000-0xa6cffff r-x
--13740-- di_notify_mmap-0:
--13740-- di_notify_mmap-1: 0xa6d0000-0xa6d2fff r--
--13740-- di_notify_mmap-0:
--13740-- di_notify_mmap-1: 0xa6d1000-0xa6d2fff rw-

I don't understand why the first RO segment doesn't end at 0xa6cefff.

The second segment looks normal.

I would  expect the third segment to end at 0xa6d0fff.

And the last segment I'd expect to end at 0xa6d1fff.
Comment 11 Paul Floyd 2023-07-24 10:35:32 UTC
@psykose would it be possible to post the output of pmap -x on the running exe? That way i can see what the link loader is really doing with that library.
Comment 12 Dominique Liberda 2023-07-24 19:11:28 UTC
(In reply to Paul Floyd from comment #11)
> @psykose would it be possible to post the output of pmap -x on the running
> exe? That way i can see what the link loader is really doing with that
> library.

log just before the crash:

```
6723: valgrind --tool=none /home/domi/projects/serenity/Build/lagom/bin/ladybird
Address		  Kbytes     PSS   Dirty    Swap  Mode  Mapping
0000000000108000     160     160       0       0  r--p  /home/domi/projects/serenity/Build/lagom/bin/ladybird
0000000000130000     284      92       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/bin/ladybird
0000000000177000     188     152       0       0  r--p  /home/domi/projects/serenity/Build/lagom/bin/ladybird
00000000001a6000      24      24      24       0  r--p  /home/domi/projects/serenity/Build/lagom/bin/ladybird
00000000001ac000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/bin/ladybird
0000000004000000      80       2       0       0  r--p  /lib/ld-musl-x86_64.so.1
0000000004014000     292       5       0       0  r-xp  /lib/ld-musl-x86_64.so.1
000000000405d000     216       4       0       0  r--p  /lib/ld-musl-x86_64.so.1
0000000004093000       4       4       4       0  r--p  /lib/ld-musl-x86_64.so.1
0000000004094000       4       4       4       0  rw-p  /lib/ld-musl-x86_64.so.1
0000000004095000      12      12      12       0  rw-p    [ anon ]
0000000004098000       4       0       0       0  ---p    [ anon ]
0000000004099000      28      28      28       0  rwxp    [ anon ]
0000000004898000       4       4       0       0  r--p  /usr/libexec/valgrind/vgpreload_core-amd64-linux.so
0000000004899000       4       4       0       0  r-xp  /usr/libexec/valgrind/vgpreload_core-amd64-linux.so
000000000489a000       4       4       0       0  r--p  /usr/libexec/valgrind/vgpreload_core-amd64-linux.so
000000000489b000       4       4       4       0  r--p  /usr/libexec/valgrind/vgpreload_core-amd64-linux.so
000000000489c000       4       4       4       0  rw-p  /usr/libexec/valgrind/vgpreload_core-amd64-linux.so
000000000489d000     260     260       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-webview.so.0.0.0
00000000048de000     268      64       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-webview.so.0.0.0
0000000004921000      80      80       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-webview.so.0.0.0
0000000004935000      24      24      24       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-webview.so.0.0.0
000000000493b000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-webview.so.0.0.0
000000000493c000     144     144       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-sql.so.0.0.0
0000000004960000     328      64       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-sql.so.0.0.0
00000000049b2000      68      48       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-sql.so.0.0.0
00000000049c3000      16      16      16       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-sql.so.0.0.0
00000000049c7000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-sql.so.0.0.0
00000000049c8000    1296     648       0       0  r--p  /usr/lib/libQt6Widgets.so.6.5.2
0000000004b0c000    4308      70       0       0  r-xp  /usr/lib/libQt6Widgets.so.6.5.2
0000000004f41000    1380     450       0       0  r--p  /usr/lib/libQt6Widgets.so.6.5.2
000000000509a000     256     256     256       0  r--p  /usr/lib/libQt6Widgets.so.6.5.2
00000000050da000      48      48      48       0  rw-p  /usr/lib/libQt6Widgets.so.6.5.2
00000000050e6000    1040     520       0       0  r--p  /usr/lib/libQt6Gui.so.6.5.2
00000000051ea000    5792     906       0       0  r-xp  /usr/lib/libQt6Gui.so.6.5.2
0000000005792000    1320     572       0       0  r--p  /usr/lib/libQt6Gui.so.6.5.2
00000000058dc000     136     136     136       0  r--p  /usr/lib/libQt6Gui.so.6.5.2
00000000058fe000      40      40      40       0  rw-p  /usr/lib/libQt6Gui.so.6.5.2
0000000005908000      60      52      52       0  rw-p    [ anon ]
0000000005917000     668     334       0       0  r--p  /usr/lib/libQt6Core.so.6.5.2
00000000059be000    2996    1270       0       0  r-xp  /usr/lib/libQt6Core.so.6.5.2
0000000005cab000    1784     666       0       0  r--p  /usr/lib/libQt6Core.so.6.5.2
0000000005e69000      84      84      84       0  r--p  /usr/lib/libQt6Core.so.6.5.2
0000000005e7e000      16      16      16       0  rw-p  /usr/lib/libQt6Core.so.6.5.2
0000000005e82000      16      12      12       0  rw-p    [ anon ]
0000000005e86000    4672    4672       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-web.so.0.0.0
0000000006316000   10804     668       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-web.so.0.0.0
0000000006da3000    1716    1584       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-web.so.0.0.0
0000000006f50000     700     700     700       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-web.so.0.0.0
0000000006fff000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-web.so.0.0.0
0000000007000000      36      16      16       0  rw-p    [ anon ]
0000000007009000      36      36       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gui.so.0.0.0
0000000007012000      68      64       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gui.so.0.0.0
0000000007023000      24      24       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gui.so.0.0.0
0000000007029000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gui.so.0.0.0
000000000702a000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gui.so.0.0.0
000000000702b000     248     248       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gfx.so.0.0.0
0000000007069000    1176     124       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gfx.so.0.0.0
000000000718f000     680     160       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gfx.so.0.0.0
0000000007239000      24      24      24       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gfx.so.0.0.0
000000000723f000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gfx.so.0.0.0
0000000007240000    1364    1364       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-js.so.0.0.0
0000000007395000    5084     228       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-js.so.0.0.0
000000000788c000     652     636       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-js.so.0.0.0
000000000792f000     176     176     176       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-js.so.0.0.0
000000000795b000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-js.so.0.0.0
000000000795c000       8       8       8       0  rw-p    [ anon ]
000000000795e000      12      12       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-filesystem.so.0.0.0
0000000007961000      20      20       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-filesystem.so.0.0.0
0000000007966000       4       4       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-filesystem.so.0.0.0
0000000007967000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-filesystem.so.0.0.0
0000000007968000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-filesystem.so.0.0.0
0000000007969000      24      24       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-ipc.so.0.0.0
000000000796f000      32      32       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-ipc.so.0.0.0
0000000007977000      12      12       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-ipc.so.0.0.0
000000000797a000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-ipc.so.0.0.0
000000000797b000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-ipc.so.0.0.0
000000000797c000     236     236       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-core.so.0.0.0
00000000079b7000     568     316       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-core.so.0.0.0
0000000007a45000     152     152       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-core.so.0.0.0
0000000007a6b000      20      20      20       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-core.so.0.0.0
0000000007a70000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-core.so.0.0.0
0000000007a71000       4       4       4       0  rw-p    [ anon ]
0000000007a72000     708      58       0       0  r--p  /usr/lib/libstdc++.so.6.0.32
0000000007b23000    1260     202       0       0  r-xp  /usr/lib/libstdc++.so.6.0.32
0000000007c5e000     616      54       0       0  r--p  /usr/lib/libstdc++.so.6.0.32
0000000007cf8000      56      56      56       0  r--p  /usr/lib/libstdc++.so.6.0.32
0000000007d06000       4       4       4       0  rw-p  /usr/lib/libstdc++.so.6.0.32
0000000007d07000      16      16      16       0  rw-p    [ anon ]
0000000007d0b000       8       8       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-syntax.so.0.0.0
0000000007d0d000      12      12       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-syntax.so.0.0.0
0000000007d10000       4       4       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-syntax.so.0.0.0
0000000007d11000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-syntax.so.0.0.0
0000000007d12000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-syntax.so.0.0.0
0000000007d13000      88      88       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-regex.so.0.0.0
0000000007d29000     316     312       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-regex.so.0.0.0
0000000007d78000      44      44       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-regex.so.0.0.0
0000000007d83000       8       8       8       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-regex.so.0.0.0
0000000007d85000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-regex.so.0.0.0
0000000007d86000      16       1       0       0  r--p  /usr/lib/libgcc_s.so.1
0000000007d8a000     104       6       0       0  r-xp  /usr/lib/libgcc_s.so.1
0000000007da4000      16       1       0       0  r--p  /usr/lib/libgcc_s.so.1
0000000007da8000       4       4       4       0  r--p  /usr/lib/libgcc_s.so.1
0000000007da9000       4       4       4       0  rw-p  /usr/lib/libgcc_s.so.1
0000000007daa000      24       6       0       0  r--p  /usr/lib/libEGL.so.1.0.0
0000000007db0000     176      16       0       0  r-xp  /usr/lib/libEGL.so.1.0.0
0000000007ddc000      56      10       0       0  r--p  /usr/lib/libEGL.so.1.0.0
0000000007dea000      12      12      12       0  r--p  /usr/lib/libEGL.so.1.0.0
0000000007ded000       4       4       4       0  rw-p  /usr/lib/libEGL.so.1.0.0
0000000007dee000      24       2       0       0  r--p  /usr/lib/libfontconfig.so.1.12.0
0000000007df4000     120       4       0       0  r-xp  /usr/lib/libfontconfig.so.1.12.0
0000000007e12000      96       3       0       0  r--p  /usr/lib/libfontconfig.so.1.12.0
0000000007e2a000       8       8       8       0  r--p  /usr/lib/libfontconfig.so.1.12.0
0000000007e2c000       4       4       4       0  rw-p  /usr/lib/libfontconfig.so.1.12.0
0000000007e2d000      88       5       0       0  r--p  /usr/lib/libX11.so.6.4.0
0000000007e43000     436      39       0       0  r-xp  /usr/lib/libX11.so.6.4.0
0000000007eb0000     584      28       0       0  r--p  /usr/lib/libX11.so.6.4.0
0000000007f42000      12      12      12       0  r--p  /usr/lib/libX11.so.6.4.0
0000000007f45000      16      16      16       0  rw-p  /usr/lib/libX11.so.6.4.0
0000000007f49000     112       6       0       0  r--p  /usr/lib/libglib-2.0.so.0.7600.4
0000000007f65000     636      27       0       0  r-xp  /usr/lib/libglib-2.0.so.0.7600.4
0000000008004000     564      15       0       0  r--p  /usr/lib/libglib-2.0.so.0.7600.4
0000000008091000       4       4       4       0  r--p  /usr/lib/libglib-2.0.so.0.7600.4
0000000008092000       4       4       4       0  rw-p  /usr/lib/libglib-2.0.so.0.7600.4
0000000008093000       4       4       4       0  rw-p    [ anon ]
0000000008094000     112      56       0       0  r--p  /usr/lib/libQt6DBus.so.6.5.2
00000000080b0000     452     220       0       0  r-xp  /usr/lib/libQt6DBus.so.6.5.2
0000000008121000     112      56       0       0  r--p  /usr/lib/libQt6DBus.so.6.5.2
000000000813d000      16      16      16       0  r--p  /usr/lib/libQt6DBus.so.6.5.2
0000000008141000       8       8       8       0  rw-p  /usr/lib/libQt6DBus.so.6.5.2
0000000008143000       4       4       4       0  rw-p    [ anon ]
0000000008144000      12       1       0       0  r--p  /usr/lib/libxkbcommon.so.0.0.0
0000000008147000      88      15       0       0  r-xp  /usr/lib/libxkbcommon.so.0.0.0
000000000815d000     136      32       0       0  r--p  /usr/lib/libxkbcommon.so.0.0.0
000000000817f000       8       8       8       0  r--p  /usr/lib/libxkbcommon.so.0.0.0
0000000008181000       4       4       4       0  rw-p  /usr/lib/libxkbcommon.so.0.0.0
0000000008182000      84      13       0       0  r--p  /usr/lib/libGL.so.1.2.0
0000000008197000     364       9       0       0  r-xp  /usr/lib/libGL.so.1.2.0
00000000081f2000     148      29       0       0  r--p  /usr/lib/libGL.so.1.2.0
0000000008217000      12      12      12       0  r--p  /usr/lib/libGL.so.1.2.0
000000000821a000       4       4       4       0  rw-p  /usr/lib/libGL.so.1.2.0
000000000821b000      24       1       0       0  r--p  /usr/lib/libpng16.so.16.40.0
0000000008221000     112       5       0       0  r-xp  /usr/lib/libpng16.so.16.40.0
000000000823d000      44       3       0       0  r--p  /usr/lib/libpng16.so.16.40.0
0000000008248000       4       4       4       0  r--p  /usr/lib/libpng16.so.16.40.0
0000000008249000       4       4       4       0  rw-p  /usr/lib/libpng16.so.16.40.0
000000000824a000      44       3       0       0  r--p  /usr/lib/libharfbuzz.so.0.60801.0
0000000008255000     788       5       0       0  r-xp  /usr/lib/libharfbuzz.so.0.60801.0
000000000831a000     204      13       0       0  r--p  /usr/lib/libharfbuzz.so.0.60801.0
000000000834d000       4       4       4       0  r--p  /usr/lib/libharfbuzz.so.0.60801.0
000000000834e000       4       4       4       0  rw-p  /usr/lib/libharfbuzz.so.0.60801.0
000000000834f000      24       1       0       0  r--p  /usr/lib/libfreetype.so.6.20.0
0000000008355000     428       5       0       0  r-xp  /usr/lib/libfreetype.so.6.20.0
00000000083c0000     168      11       0       0  r--p  /usr/lib/libfreetype.so.6.20.0
00000000083ea000      32      32      32       0  r--p  /usr/lib/libfreetype.so.6.20.0
00000000083f2000       4       4       4       0  rw-p  /usr/lib/libfreetype.so.6.20.0
00000000083f3000      12       0       0       0  r--p  /lib/libz.so.1.2.13
00000000083f6000      56       2       0       0  r-xp  /lib/libz.so.1.2.13
0000000008404000      28       2       0       0  r--p  /lib/libz.so.1.2.13
000000000840b000       4       4       4       0  r--p  /lib/libz.so.1.2.13
000000000840c000       4       4       4       0  rw-p  /lib/libz.so.1.2.13
000000000840d000     876     297       0       0  r--p  /usr/lib/libicui18n.so.73.2
00000000084e8000    1200      21       0       0  r-xp  /usr/lib/libicui18n.so.73.2
0000000008614000     508     135       0       0  r--p  /usr/lib/libicui18n.so.73.2
0000000008693000      72      72      72       0  r--p  /usr/lib/libicui18n.so.73.2
00000000086a5000       4       4       4       0  rw-p  /usr/lib/libicui18n.so.73.2
00000000086a6000       4       4       4       0  rw-p    [ anon ]
00000000086a7000     304      76       0       0  r--p  /usr/lib/libicuuc.so.73.2
00000000086f3000     724      15       0       0  r-xp  /usr/lib/libicuuc.so.73.2
00000000087a8000     548      48       0       0  r--p  /usr/lib/libicuuc.so.73.2
0000000008831000      76      76      76       0  r--p  /usr/lib/libicuuc.so.73.2
0000000008844000       4       4       4       0  rw-p  /usr/lib/libicuuc.so.73.2
0000000008845000       8       4       4       0  rw-p    [ anon ]
0000000008847000      16       2       0       0  r--p  /usr/lib/libzstd.so.1.5.5
000000000884b000     612      22       0       0  r-xp  /usr/lib/libzstd.so.1.5.5
00000000088e4000      68      13       0       0  r--p  /usr/lib/libzstd.so.1.5.5
00000000088f5000       4       4       4       0  r--p  /usr/lib/libzstd.so.1.5.5
00000000088f6000       4       4       4       0  rw-p  /usr/lib/libzstd.so.1.5.5
00000000088f7000      12       6       0       0  r--p  /usr/lib/libdouble-conversion.so.3.3.0
00000000088fa000      52      24       0       0  r-xp  /usr/lib/libdouble-conversion.so.3.3.0
0000000008907000      16       8       0       0  r--p  /usr/lib/libdouble-conversion.so.3.3.0
000000000890b000       4       4       4       0  r--p  /usr/lib/libdouble-conversion.so.3.3.0
000000000890c000       4       4       4       0  rw-p  /usr/lib/libdouble-conversion.so.3.3.0
000000000890d000      12       6       0       0  r--p  /usr/lib/libb2.so.1.0.4
0000000008910000     104      32       0       0  r-xp  /usr/lib/libb2.so.1.0.4
000000000892a000      12       6       0       0  r--p  /usr/lib/libb2.so.1.0.4
000000000892d000       4       4       4       0  r--p  /usr/lib/libb2.so.1.0.4
000000000892e000       4       4       4       0  rw-p  /usr/lib/libb2.so.1.0.4
000000000892f000       8       2       0       0  r--p  /usr/lib/libpcre2-16.so.0.11.2
0000000008931000     408      21       0       0  r-xp  /usr/lib/libpcre2-16.so.0.11.2
0000000008997000     176      28       0       0  r--p  /usr/lib/libpcre2-16.so.0.11.2
00000000089c3000       4       4       4       0  r--p  /usr/lib/libpcre2-16.so.0.11.2
00000000089c4000       4       4       4       0  rw-p  /usr/lib/libpcre2-16.so.0.11.2
00000000089c5000     292      73       0       0  r--p  /lib/libcrypto.so.3
0000000008a0e000    2708      50       0       0  r-xp  /lib/libcrypto.so.3
0000000008cb3000     824     240       0       0  r--p  /lib/libcrypto.so.3
0000000008d81000     356     356     356       0  r--p  /lib/libcrypto.so.3
0000000008dda000      12      12      12       0  rw-p  /lib/libcrypto.so.3
0000000008ddd000      12       8       8       0  rw-p    [ anon ]
0000000008de0000      32      32       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-markdown.so.0.0.0
0000000008de8000      72      64       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-markdown.so.0.0.0
0000000008dfa000      16      16       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-markdown.so.0.0.0
0000000008dfe000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-markdown.so.0.0.0
0000000008dff000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-markdown.so.0.0.0
0000000008e00000      36      36       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-http.so.0.0.0
0000000008e09000      60      60       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-http.so.0.0.0
0000000008e18000      20      20       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-http.so.0.0.0
0000000008e1d000       8       8       8       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-http.so.0.0.0
0000000008e1f000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-http.so.0.0.0
0000000008e20000      24      24       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gemini.so.0.0.0
0000000008e26000      32      32       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gemini.so.0.0.0
0000000008e2e000      12      12       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gemini.so.0.0.0
0000000008e31000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gemini.so.0.0.0
0000000008e32000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gemini.so.0.0.0
0000000008e33000      76      76       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gl.so.0.0.0
0000000008e46000     172      56       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gl.so.0.0.0
0000000008e71000      52      52       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gl.so.0.0.0
0000000008e7e000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gl.so.0.0.0
0000000008e7f000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-gl.so.0.0.0
0000000008e80000      84      84       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-video.so.0.0.0
0000000008e95000     340     116       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-video.so.0.0.0
0000000008eea000      72      72       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-video.so.0.0.0
0000000008efc000      12      12      12       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-video.so.0.0.0
0000000008eff000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-video.so.0.0.0
0000000008f00000     308     308       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-wasm.so.0.0.0
0000000008f4d000     700     124       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-wasm.so.0.0.0
0000000008ffc000     120     104       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-wasm.so.0.0.0
000000000901a000      12      12      12       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-wasm.so.0.0.0
000000000901d000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-wasm.so.0.0.0
000000000901e000      36      36       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-xml.so.0.0.0
0000000009027000     136      60       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-xml.so.0.0.0
0000000009049000      20      20       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-xml.so.0.0.0
000000000904e000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-xml.so.0.0.0
000000000904f000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-xml.so.0.0.0
0000000009050000      40      40       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-idl.so.0.0.0
000000000905a000     116      60       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-idl.so.0.0.0
0000000009077000      20      20       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-idl.so.0.0.0
000000000907c000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-idl.so.0.0.0
000000000907d000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-idl.so.0.0.0
000000000907e000      16      16       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-textcodec.so.0.0.0
0000000009082000      20      20       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-textcodec.so.0.0.0
0000000009087000      12      12       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-textcodec.so.0.0.0
000000000908a000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-textcodec.so.0.0.0
000000000908b000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-textcodec.so.0.0.0
000000000908c000      48      48       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-audio.so.0.0.0
0000000009098000     152      60       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-audio.so.0.0.0
00000000090be000     344      72       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-audio.so.0.0.0
0000000009114000       4       4       4       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-audio.so.0.0.0
0000000009115000      12      12       8       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-audio.so.0.0.0
0000000009118000       4       4       4       0  rw-p    [ anon ]
0000000009119000      60      60       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-crypto.so.0.0.0
0000000009128000     212     152       0       0  r-xp  /home/domi/projects/serenity/Build/lagom/lib/liblagom-crypto.so.0.0.0
000000000915d000      52      40       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-crypto.so.0.0.0
000000000916a000       8       8       8       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-crypto.so.0.0.0
000000000916c000       4       4       4       0  rw-p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-crypto.so.0.0.0
000000000916d000      76      76       0       0  r--p  /home/domi/projects/serenity/Build/lagom/lib/liblagom-unicode.so.0.0.0
----------------  ------  ------  ------  ------
total		   75956   24525    2744       0
```
Comment 13 Paul Floyd 2023-07-24 20:17:15 UTC
It's the standalone guest exe that I need so that I can see where dlopen is loading the shared library.
Comment 14 Stefan de Konink 2023-07-24 22:07:34 UTC
Created attachment 160508 [details]
pmap output

For me the behavior is a complete mystery. In the setting it fail (the primary reason I use valgrind to track leaking file descriptors), I cannot run valgrind on it. In the situation that is 'offscreen' valgrind runs like charm, same system.
Comment 15 Paul Floyd 2023-07-25 09:07:22 UTC
When you run a compiled binary standalone, one of the first things that happens is that ld.so, the link loader, reads ELF information in your binary to see which dynamic libraries it links to, and it loads them. In order to load them it reads the ELF header and segments marked LOAD get loaded (via mmap) into memory. This can also be done on the fly by dlopen which results in the same thing happening (reading ELF headers and mmap'in LOAD segemnts).

When you run your exe in Valgrind, all ofthe above still happen but running under Valgrind. The Valgrind memory manager maintains a list of mapped memory blocks. This gets updated whenever Valgrind sees a file get mmap'd.

In this case, when the exe does a mmap, Valgrind is trying to read the ELF header so that it can add the new segment to its internal list. The values that is sees for the offset and size are incoherent - the segments shouldn't be overlapping but they are in this case.
Comment 16 Paul Floyd 2023-08-17 20:23:01 UTC
Possibly relevant.

https://reviews.llvm.org/D64906

I'll try -z noseparate-code and see if I can reproduce the issue.
Comment 17 Paul Floyd 2023-08-26 13:24:22 UTC
On Alpine 3.18 amd64 this small example works fine

#include <dlfcn.h>

int main()
{
   dlclose(dlopen("/usr/lib/qt6/plugins/xcbglintegrations/libqxcb-glx-integration.so", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE));
   dlclose(dlopen("/usr/lib/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE));
}

I don't particularly want to use Edge.

Is there any other way to reproduce the issue?