[prev in list] [next in list] [prev in thread] [next in thread] 

List:       suse-programming-e
Subject:    Re: [opensuse-programming] VDSO support
From:       Roger Oberholtzer <roger () opq ! se>
Date:       2012-02-10 7:17:20
Message-ID: 1328858240.12763.21.camel () acme ! pacific
[Download RAW message or body]

On Fri, 2012-02-10 at 07:34 +0100, Per Jessen wrote:
> Roger Oberholtzer wrote:
> 
> > On Thu, 2012-02-09 at 15:00 +0100, Per Jessen wrote:
> >> Roger Oberholtzer wrote:
> >> 
> >> > Is it the case that applications should just magically get the VDSO
> >> > version of the three system calls listed above? If that is the
> >> > case, I should not see calls to gettimeofday in straces of my app.
> >> > But I do.
> >> > 
> >> > I suspect there is is an additional step needed. I have not
> >> > recognized it in my googling on the topic. Perhaps a compile/linker
> >> > option?
> >> 
> >> I think you need to link in the vdso module when you build your
> >> application.
> > 
> > OK. Where is that? I looked for something called *vdso* in /usr/lib,
> > but came up empty.
> 
> I only read the article, sometimes another pair of eyes will help. This
> is the section:

The article was rather sloppy keeping kernel mods separate from user
applications. Other articles I have read claim that glibc knows about
vdso.

/usr/src/linux/Documentation/ABI/stable/vdso (in newer kernel source
trees) says:

"On some architectures, when the kernel loads any userspace program it
maps an ELF DSO into that program's address space.  This DSO is called
the vDSO and it often contains useful and highly-optimized alternatives
to real syscalls."

It goes on to say:

"Programs that dynamically link to glibc will use the vDSO
automatically."

Maybe the problem is the x86 architecture, as the same doc worryingly
states:

"As of this writing, this ABI documentation as been confirmed for
x86_64. The maintainers of the other vDSO-using architectures should
confirm that it is correct for their architecture."

I am trying this in x86.


> 
> > Let's compile a test case to exercise the vDSO call:
> > 
> > /* notb.c */
> > #include <stdio.h>
> > 
> > int main(void)
> > {
> >     int notb = number_of_the_beast();
> >       
> >     printf("His number is %d\n", notb);
> > 
> >     return 0;
> > }
> > 
> > Then, compile the code above as:
> > 
> > gcc notb.c -o notb vdso.so
> > 
> > The file you link against is vdso.so, which provides the symbol
> > resolution needed to make the kernel call. The kernel version of
> > number_of_the_beast() is called, even if the code for that function is
> > completely different in vdso.so. Where is vdso.so located? It's
> > located in the kernel build directory after building the
> > kernel:linux-2.6.37/arch/x86/vdso/vdso.so.      
> 
> Let us know how it goes, it's an interesting topic.
> 
> 
> /Per Jessen, Zürich
> 

Yours sincerely,

Roger Oberholtzer

OPQ Systems / Ramböll RST

Office: Int +46 10-615 60 20
Mobile: Int +46 70-815 1696
roger.oberholtzer@ramboll.se
________________________________________

Ramböll Sverige AB
Krukmakargatan 21
P.O. Box 17009
SE-104 62 Stockholm, Sweden
www.rambollrst.se


-- 
To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org
To contact the owner, e-mail: opensuse-programming+owner@opensuse.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic