1

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), GFP_HIGHUSER);

that I have tested and used in other areas of kernel where it compiled and worked as expected. However, in the case of VDSO it results in the failed linking

 CC arch/x86/vdso/vclock_gettime.o
 VDSO arch/x86/vdso/vdso.so.dbg
arch/x86/vdso/vclock_gettime.o: In function `kmalloc':
linux-3.10.0/include/linux/slub_def.h:171: undefined reference to `kmalloc_caches'
linux-3.10.0/include/linux/slub_def.h:171: undefined reference to `kmem_cache_alloc_trace'
collect2: error: ld returned 1 exit status
 OBJCOPY arch/x86/vdso/vdso.so

I am aware that VDSO has a special status, where although allocated in kernel space is mapped into userspace in the address space of every process.

I wonder, if someone more experienced can spot or suggest the way to allocate memory in vdso for my needs.

P.S. malloc can't be used as that requires stdlib.h which results in linking against glibc

asked Oct 20, 2020 at 17:52

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.