[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: YALG post - Yet Another linux-gate.so.1 post - What's the TRUTH?



The vdso's location is passed to the process using the AT_SYSINFO and/or
AT_SYSINFO_EHDR ELF auxiliary vectors (auxv).  On 32-bit x86 I have
both, with different addresses, and on amd64 only AT_SYSINFO_EHDR.
Perhaps someone can clarify this.

The load addresses reported by ldd are merely advisory: if the address
space requested is not available, ld.so will just relocate the object
(which is what prelink tried to avoid -- but I digress).

Your vdso is probably moving around as a result of the address space
randomization feature.

        $ sysctl kernel.randomize_va_space
        kernel.randomize_va_space = 2

Delightfully, the value 2 is not documented, but with a quick look at
Linux's mm/memory.c we can guess that it means "feature enabled,
CONFIG_COMPAT_BRK disabled".  But again I digress.

Here's one way to view the auxv:

        LD_SHOW_AUXV=1 /bin/true
        AT_SYSINFO_EHDR: 0x7fff573ff000
        AT_HWCAP:        bfebfbff
        AT_PAGESZ:       4096
        AT_CLKTCK:       100
        AT_PHDR:         0x400040
        AT_PHENT:        56
        AT_PHNUM:        8
        AT_BASE:         0x7f274f10a000
        AT_FLAGS:        0x0
        AT_ENTRY:        0x400d50
        AT_UID:          1000
        AT_EUID:         1000
        AT_GID:          1000
        AT_EGID:         1000
        AT_SECURE:       0
        AT_PLATFORM:     x86_64

And so:

        $ for i in $(seq 10); do LD_SHOW_AUXV=1 /bin/true | grep ^AT_SYSINFO ; done
        AT_SYSINFO_EHDR: 0x7fffdb9ff000
        AT_SYSINFO_EHDR: 0x7fff3bdff000
        AT_SYSINFO_EHDR: 0x7fff0e1fe000
        AT_SYSINFO_EHDR: 0x7fffafbff000
        AT_SYSINFO_EHDR: 0x7fff2adfe000
        AT_SYSINFO_EHDR: 0x7fff1c5fe000
        AT_SYSINFO_EHDR: 0x7fff7a7fe000
        AT_SYSINFO_EHDR: 0x7ffffabfe000
        AT_SYSINFO_EHDR: 0x7fff90dfe000
        AT_SYSINFO_EHDR: 0x7fff911ff000

Here's the article from which I gleaned the above:

        http://manugarg.googlepages.com/aboutelfauxiliaryvectors

I hope this helps and that I haven't made too many errors.

-- 
Paul Collins
Wellington, New Zealand

Dag vijandelijk luchtschip de huismeester is dood


Reply to: