Linux User/Kernel ABI: the realities of how C and C++ programs talk to the OS

Linux User/Kernel ABI: the realities of how C and C++ programs talk to the OS

All programs need to interact with the wider system in order to do useful work. C and C++ programmers typically write to the C library. It provides a mapping onto the OS that is a not-quite-perfect model of the OS underneath, and surprising behaviours can result. To be an expert programmer it is important to understand the ABI you are really programming to, for such times as you find yourself debugging via strace or without source code, fine grained profiling and optimisation, writing intercept libraries, etc.

There are many gotchas. This talk covers how system calls are really implemented (int 0x80, sysenter, the vdso and the vsyscall page, and how return codes are translated into errno); how signal handlers really work (including the surprising syscall restart mechanism); how pthreads map onto OS primitives; the finer details of ptrace (the mechanism on top of which strace and gdb are built); and some interesting and surprising results when the subtleties of these various mechanism combine. Some of the other subtleties covered include what it means when things are in an uninterruptible sleep, and very useful info that can be gathered from the /proc filesystem.

Stay informed. Get the latest in your inbox.

Leave a Reply

Your email address will not be published.Required fields are marked *