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