I have bee trying to prepare new patch to add libvdso support needed by 
golang based on the work of @benoit. I came across this discussion 
here 
https://groups.google.com/forum/#!searchin/osv-dev/Delay$20elf$20object$20initialization%7Csort:date/osv-dev/DOJ23sMsZuY/EgryjmqqCQAJ
 
(look for "vdso fast syscall compatibility library" subthread). 

The original patch prepared by Benoit add libvdso as a separate shared 
library whose base address gets passed to auxv as needed by Golang. Nadav 
argued in this thread that instead libvdso could be part of kernel and 
kernel base can be used instead (unless I misunderstood the conversation).

To have better understanding I captured the based address of kernel by 
adding debug statement like so in application::prepare_argv() 
- https://github.com/benoit-canet/osv/blob/go4/core/app.cc#L298-L359:

    debug("***$$$$$ lbbvdso address: %#x\n", _libvdso->base());
         auto _libxenstore = program->get_library("libxenstore.so.3.0");
    if( _libxenstore) {
       debug("***$$$$$ libxenstore address: %#x\n", _libxenstore->base());
    }
 

 libxenstore.so.3.0 is one of the "virtual" libraries that is resolvable as 
part of kernel (look at supplied_modules in program constructor). So if we 
added libvdso.so same way as libxenstore.so.3.0 we would pass its base 
address to auxv.

Here is the output I am getting:

***$$$$$ lbbvdso address: 0x100000000000
***$$$$$ libxenstore address: 0

For whatever reason the base address of any library provided by OSv kernel 
would be 0. Do we know why base address returned here is 0 instead of 
expected 0x200000?

Here is the Golang portion of code with the guard that Benoit is referring 
- https://github.com/golang/go/blob/master/src/runtime/vdso_linux.go#L269-L273

        case _AT_SYSINFO_EHDR:
                if val == 0 {
                        // Something went wrong
                        return
                }






So clearly we cannot pass 0 as base address? So I wonder of there is some 
bug where base address of supplied modules is returned as 0 or indeed it is 
zero instead of 0x200000 and then the only choice we have is to have it a 
separate library.

Am I missing something?

Waldek

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to