Hacker News new | ask | show | jobs
by emidln 1001 days ago
The source code to the kernel's elf "binfmt"[0] is very readable. The elf binfmt is registered (along with a few others like `binfmt_misc`) and you get dispatched there via `exec_binprm`[1] which is invoked by the `execve` syscall[2]. When loading a shared library, you also dispatch to a binfmt via the `uselib`[3] syscall.

[0] https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be5...

[1] https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be5...

[2] https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be5...

[3] https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be5...