40 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
3
votes
1
answer
372
views
How does clock_gettime actually work in the kernel?
uint64_t getTimeLatencyNs() {
struct timespec ts1;
struct timespec ts2;
clock_gettime(CLOCK_MONOTONIC_RAW, &ts1);
clock_gettime(CLOCK_MONOTONIC_RAW, &ts2);
return ((ts2....
Mo_'s user avatar
- 2,101
1
vote
1
answer
222
views
how can you dump [vvar] segment
I'd like to dump the [vvar] segment from a linux userspace program (which may be running on x86, arm, or mips...). My problem is that only the first page(s) of the vvar segment are mapped, and I get ...
3
votes
0
answers
1k
views
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 ...
1
vote
1
answer
409
views
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 ...
3
votes
2
answers
1k
views
Why does strace ignore some syscalls (randomly) depending on environment/kernel?
If I compile the following program:
$ cat main.cpp && g++ main.cpp
#include <time.h>
int main() {
struct timespec ts;
return clock_gettime(CLOCK_MONOTONIC, &ts);
}
and then ...
3
votes
0
answers
1k
views
How to modify vdso variable (vvar)?
Recently I am study vdso in linux. I tried to modify the data in vvar section but it failed. Following is what I've tried.
According to lwn described, there're two address for vvar:
The first one is ...
0
votes
1
answer
144
views
How can I correctly create a new variable in vvar.h for my new VSDO func?
I am trying to declare a new variable in vvar.h and define it near my new VDSO function. So that I could use this variable in my vdso function.
I have a question about VVar. According to the ...
2
votes
0
answers
116
views
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.
(...
3
votes
0
answers
597
views
Why getpid() is not implemented in x86_64's vdso?
After glibc 2.25, glibc's getpid() wrapper no longer cache its result.
However, on x86_64 vdso didn't provide getpid() function.
Which means everytime getpid() is called, a syscall is triggered.
I am ...
1
vote
0
answers
117
views
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*)...
1
vote
1
answer
207
views
Using __kernel_vsyscall to call write system call not working
I wrote a sample program to use __kernel_vsyscall for system call
#include <stdio.h>
#include <sys/auxv.h>
int main()
{
unsigned long sysinfo = getauxval(AT_SYSINFO);
unsigned ...
0
votes
1
answer
47
views
Map ioport form hardware to vDSO function
I am using SAMA5d2 CPU with Linux, and want to have access to ioport from vdso function. How shoul I map ioport to userspace memory to get access to ioport in vdso function which calls from userspace?
...
68
votes
2
answers
81k
views
Where is linux-vdso.so.1 present on the file system
I am learning about VDSO, wrote a simple application which calls gettimeofday()
#define _GNU_SOURCE
#include <sys/syscall.h>
#include <sys/time.h>
#include <stdio.h>
#include <...
1
vote
2
answers
797
views
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 ...
1
vote
2
answers
1k
views
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 ...