August 21, 2006

Something about ELF auxiliary vectors

...mysterious carriers of information from kernelspace to userspace.

I hit upon them while writing my last paper on sysenter based system call mechanism. In one sentence, these vectors are the mechanism to transfer some OS specific information to the program interpreter (e.g. ld) and the process. Examples of such OS specific information are - page size, system call entry point, real and effective user ids etc. Linux 2.6 specifically uses an ELF auxiliary vector called AT_SYSINFO to pass the address of __kernel_vsyscall.

How these vectors are passed on? This work is done by the elf loader. Elf loader is responsible for loading elf binary files into the system. Elf loader puts these vectors on the process stack alongwith other information like argc, argv, envp. Isn't it new? Many programmers are unaware of these extra creatures on the stack (at least, I was one of them ;)). To make life easier for them (and for me too), I have written this article, nah a small writeup on elf auxiliary vectors.

I am sure at least some of you will find it useful. If otherwise, then don't bother to mention that ;-). At least I'll refer to it in future (I have a short memory and new things keep pushing old things out, so these kind of writeups come handy for me).

Manu Garg/"Journey is the destination of life."