Questions tagged [vdso]

VDSO is a Linux kernel mechanism for exporting some kernel space routines to user space.

VDSO (Virtual Dynamically-linked Shared Object) is a Linux kernel mechanism for exporting certain number of kernel space routines to user space applications, without incurring the performance penalty of the system call interface.

38 questions
3
votes
1 answer

How to get the size of the VDSO on a Linux x86_64 system

I'd like to dump the VDSO to disk in a way that I can verify it is correct with objdump -D. We can get the base address of the VDSO with getauxval(AT_SYSINFO_EHDR) as documented in vdso(7). But how does one get the size of the object? I happen to…
Edd Barrett
  • 3,425
  • 2
  • 29
  • 48
3
votes
1 answer

gettimeofday() not using vDSO?

I strace'd a java process that was triggering a lot of kernel time to see what syscalls were being used, and was surprised to see that gettimeofday() and clock_gettime() dominated (I suspect it's due to logging), which is strange considering that…
Roee Shenberg
  • 1,457
  • 1
  • 13
  • 22
3
votes
1 answer

vDSO: why does linux use them only for time-related functions?

Just searched the Linux kernel for vdso hooks (e.g. found this at kernel.org), and it seems to be currently used mostly for time-related system calls. This brings two questions to mind: Are there any other system calls that are planned to use vDSO…
Samee
  • 796
  • 5
  • 13
2
votes
0 answers

time() not using vdso?

I write a program,use time() function, When I gdb it : [VM_241_149_tlinux ~/test]$ gdb ./testsys_d -q Reading symbols from /data/home/youngxiao/test/testsys_d...(no debugging symbols found)...done. (gdb) b __GI_time Function "__GI_time" not…
youngxiao
  • 21
  • 2
2
votes
0 answers

Make a function implemented as a vDSO actually syscall?

Is there a way to cause this to happen (short of recoding every instance of the call, say time() to be a call to syscall()?
John Hascall
  • 9,176
  • 6
  • 48
  • 72
2
votes
0 answers

Identifying Ifuncs in the VDSO

I see in the vdso that all functions are marked as STT_FUNC instead of STT_GNU_IFUNC. Especially I know "gettimeofday" is an Ifunc. Is it true that all the functions in the VDSO are Ifuncs so they aren't tagged as such? if not - Why aren't these…
keshchar
  • 109
  • 1
  • 6
2
votes
2 answers

Access vDSOlinux

I am studying the vdso mechanism in Linux. To find the DSO, I can parse the auxiliary vector passed to the program's entry point. The AT_SYSINFO_EHDR entry will point to the vDSO. My question is why, can't I access the vDSO using the addresses…
Giuseppe Pes
  • 7,772
  • 3
  • 52
  • 90
1
vote
0 answers

How does one do a "zero-syscall clock_gettime" without dynamic linking?

I ran the code below with strace. I can see it doesn't use a system call to get the time. After write only clock_nanosleep and exit_group are called. It correctly gives me 3 every run (I was expecting to occasionally get 2). Musl .80 release says…
Eric Stotch
  • 141
  • 4
  • 19
1
vote
1 answer

How to use syscall to change vDSO content

I am trying to implement a syscall on x86 that is able to modify the content of vDSO. Given vDSO content is read-only for userspace, I believe a syscall is needed. Otherwise it will cause segmentation fault. However, I can't do it successfully at…
2ez4rtz
  • 61
  • 4
1
vote
0 answers

Dynamic Memory Allocation in kernel's VDSO

For an experiment, I need to instrument and allocate entry nodes for a hashtable inside arch/x86/vdso/vclock_gettime.c through the following typical approach. struct h_struct *phe = (struct h_struct*) kmalloc(sizeof(struct h_struct),…
jvars
  • 47
  • 5
1
vote
1 answer

Using __kernel_vsyscall to call write system call not working

I wrote a sample program to use __kernel_vsyscall for system call #include #include int main() { unsigned long sysinfo = getauxval(AT_SYSINFO); unsigned long syscall_num = 1; // 1 is system call number for exit …
md.jamal
  • 4,067
  • 8
  • 45
  • 108
1
vote
2 answers

Is there a way to create a vDSO with the latest kernel?

I'm trying to do a vDSO using latest kernel source code. I was following this tutorial https://www.linuxjournal.com/content/creating-vdso-colonels-other-chicken?page=0,0 However I didn't find some functions like update_vsyscall() and vdso directory…
1
vote
2 answers

When do Linux system calls trigger a segfault vs returning EFAULT?

I'm trying to understand when clock_gettime() can lead to errors. The man page lists the following two possibilities: EFAULT tp points outside the accessible address space. EINVAL The clk_id specified is not supported on this system. It's easy to…
MattHusz
  • 452
  • 4
  • 15
1
vote
1 answer

what's the getpid work procedure in glibc?

The situation is as below: I am trying to do the project which hacks the kernel in github. Kernel version is linux-3.18.6. QEMU is used to simulate the environment. In my application, I try to understand the syscall procedure by follow them.The way…
xjas
  • 75
  • 2
  • 11
1
vote
0 answers

How to force vdso memory to be in fixed address?

It appears that there is no information in the executable about where vdso should be. Assuming that I can control how the program is compiled, linked and written, how can I force it to be at the address I want it to be?
JKS
  • 339
  • 1
  • 12