how to open elf file image from inside genode? libbacktrace question

Alexander Tormasov a.tormasov at innopolis.ru
Thu Apr 8 18:18:01 CEST 2021


I tried this patch for mutex and  receive the following:

36M kernel memory

Genode 20.11-203-g9c8a05c12 <local changes>
530 MiB RAM and 63253 caps assigned to init
[init]   0x1000000 .. 0x10ffffff: linker area
[init]   0x40000000 .. 0x4fffffff: stack area
[init]   0x30000 .. 0x161fff: ld.lib.so
[init] LD: obj: binary 0x46
[init] LD: obj: binary 0x2e
[init] LD: obj: binary 0x3d
[init] LD: obj: binary 0x22
[init] LD: obj: binary 0x6
[init] LD: obj: binary 0x5
[init] LD: obj: binary 0x32
[init] LD: obj: binary 0xa
[init] LD: obj: binary 0x44
[init] LD: obj: binary 0x15
[init] LD: obj: binary 0x25
[init] LD: obj: binary 0x16
[init] LD: obj: binary 0x3a
[init] LD: obj: binary 0x3f
[init] LD: obj: binary 0x34
[init] LD: obj: binary 0x8
[init] LD: obj: binary 0x42
[init] LD: obj: binary 0x2f
[init] LD: obj: binary 0x3c
[init] LD: obj: binary 0x2d
[init] LD: obj: binary 0x38
[init] LD: obj: binary 0x19
[init] LD: obj: binary 0x1f
[init] LD: obj: binary 0x30
[init] LD: obj: binary 0x1b
[init] LD: obj: binary 0x27
page fault, pd='init' thread='ep' cpu=0 ip=0xb1d73 address=0x401eeffc stack pointer=0x401eeff0 qualifiers=0x6 irUWp reason=1

which seems to appear in thread->myself():

   b1d5a:       48 8d 1d df ff ff ff    lea    -0x21(%rip),%rbx        # b1d40 <Genode::Thread::myself()>
   b1d61:       4c 01 db                add    %r11,%rbx
/var/services/homes/admin/gen/21.02/repos/base/src/lib/base/thread_myself.cc:32
        if (sp <  Genode::stack_area_virtual_base() ||
   b1d64:       48 01 dd                add    %rbx,%rbp
   b1d67:       49 89 df                mov    %rbx,%r15
/var/services/homes/admin/gen/21.02/repos/base/src/lib/base/thread_myself.cc:23
{
   b1d6a:       48 83 ec 18             sub    $0x18,%rsp
/var/services/homes/admin/gen/21.02/repos/base/src/lib/base/thread_myself.cc:31
        addr_t sp = (addr_t)(&dummy);
   b1d6e:       4c 8d 64 24 0c          lea    0xc(%rsp),%r12
/var/services/homes/admin/gen/21.02/repos/base/src/lib/base/thread_myself.cc:24
        int dummy = 0; /* used for determining the stack pointer */
   b1d73:       c7 44 24 0c 00 00 00    movl   $0x0,0xc(%rsp)
   b1d7a:       00
/var/services/homes/admin/gen/21.02/repos/base/src/lib/base/thread_myself.cc:32
        if (sp <  Genode::stack_area_virtual_base() ||
   b1d7b:       ff d5                   callq  *%rbp
   b1d7d:       49 39 c4                cmp    %rax,%r12
   b1d80:       72 46                   jb     b1dc8 <Genode::Thread::myself()+0x88>
/var/services/homes/admin/gen/21.02/repos/base/src/lib/base/thread_myself.cc:33
            sp >= Genode::stack_area_virtual_base() + Genode::stack_area_virtual_size())
   b1d82:       ff d5                   callq  *%rbp
   b1d84:       48 05 00 00 00 10       add    $0x10000000,%rax
/var/services/homes/admin/gen/21.02/repos/base/src/lib/base/thread_myself.cc:32
        if (sp <  Genode::stack_area_virtual_base() ||


> 
> Now we are not entirely sure if taking the mutex in 'dl_iterate_phdr' is
> strictly necessary - that is something we have to investigate. Removing
> the mutex allows the 'go_app' to run through. So you are free to do the
> same. But to be clear, we do not know if this leads to other regressions.
> We are going to look into that.
> 
> 
> (*) You can instrument that by applying the patch I attached that
>    makes the linker verbose and shows you the object and index for
>    the relocation:
> 
>    ! […]
>    ! [init -> test-go] LD: SLOT libc.lib.so 0x20c
>    ! [init -> test-go] LD: SLOT binary 0xe
>    ! [init -> test-go] Error: deadlock ahead, mutex=0x164040, return ip=0xf3383
> 
>    With this information you can check to which symbol the index
>    belongs to:
> 
>    $ readelf --dyn-syms test-go|grep '\<14:'
>        14: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND mknod
> 



More information about the users mailing list