The time has come for a kernel interfacing library layer

Joerg Sonnenberger joerg at
Sun May 8 05:28:14 PDT 2005

On Sat, May 07, 2005 at 09:57:35AM -0700, Matthew Dillon wrote:
>     How will this work?  The concept is simple:  Instead of implementing
>     system calls directly, all userland programs instead implement a 
>     special named-section containing system call stubs.  This will be a
>     BSS section (not contain actual code).  The kernel loader (and ld-elf
>     when it loads things) will automatically detect the existance of the
>     section and automatically mmap() the actual syscall layer into the 
>     BSS space, as well as mmap() anything else that it needs for system
>     interfacing (any additional mmap()'d sections will be not be directly
>     visible to userland.  Userland only sees the stub table).

Right, time for me to clean our ELF loader :)

>     The kernel will select the layer file that it maps in based on the ABI
>     version of the userland program verses the ABI version of the kernel.

As I said before, it's a bit more complicated because you can have _multiple_
ABI versions in one program, simply because you can use shared libraries
compiled at different times. That's something we _additionally_ have to
deal in libc with.

>     This theoretically means that we can make any old program work with any
>     new kernel by building the correct layer, independant of both the
>     original program's and the original kernel's compilation.  This also
>     means that we can make any new program work with any old kernel through
>     the same means.

The latter will always be a problem because the new program is most likely
build for a reason against the newer world. E.g. if you add a syscall or
ioctl, it's very difficult to make it work on an old kernel without updating

>     Joerg, to make this work I need two other things:
>     * We need to have the kernel automatically setup the initial TLS
>       space.

Why? Do you want to completely eliminate the syscall wrappers from libc?
That's going to add problems later I fear. I'd instead change it the
interface between library layer and syscall functions in libc to always
provide a pointer to errno as argument. That would solve the problems
e.g. with RTLD too.


More information about the Kernel mailing list