|
|
Subscribe / Log in / New account

An in-kernel file loading interface

An in-kernel file loading interface

Posted Feb 21, 2016 11:43 UTC (Sun) by PaXTeam (guest, #24616)
In reply to: An in-kernel file loading interface by anselm
Parent article: An in-kernel file loading interface

before the kernel can mmap files into the userland part of the address space it has to know what and where to map and for that it needs to read and parse the ELF program headers of the main executable (and the interpreter if needed). see fs/exec.c:kernel_read() and its uses for the gory details.


to post comments

An in-kernel file loading interface

Posted Feb 21, 2016 11:54 UTC (Sun) by anselm (subscriber, #2796) [Link] (1 responses)

Makes sense to me (thank you for the clarification).

The important point as far as I'm concerned is that the kernel doesn't “read” a large executable into memory in its entirety before it is started, but maps it into memory and fetches pages from the file as required according to page faults arising from running the code.

An in-kernel file loading interface

Posted Feb 21, 2016 13:29 UTC (Sun) by PaXTeam (guest, #24616) [Link]

yes, that's how it works for userland maps however note that kernel_read has other uses such as the module loader which does read in the entire module file (finit_module->copy_module_from_fd->kernel_read).


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds