elf_read_phdrs(9)
π elf_read_phdrs π
okay so real talk bestie, this one lives in the Kernel API Manual, section 9 β the kernel-functions girlies, you know the vibe π
β¨ NAME β¨
elf_read_phdrs β the one that reads the program headers from the buffer π¦
β¨ SYNOPSIS β¨
int elf_read_phdrs (const char *buf , size_t len , struct kexec_elf_info
*elf_info );
like, that's the whole signature, no notes π
β¨ ARGUMENTS β¨
ngl the original page is giving mystery with these, so I'm not gonna invent anything β here's exactly what we've got:
bufβ undescribed π no literally, that's all it sayslenβ undescribed π« same energyelf_infoβ undescribed π three for three
okay bestie I know, I know β the manpage really said "figure it out" for all three. I'm not gonna make stuff up though, because that would be a whole lie and we don't do that here π
β¨ DESCRIPTION β¨
so here's the thing that actually matters: this function assumes that the program header table was checked for sanity. like, it just trusts you. it's walking in with main character energy and full faith in your table π
if it wasn't checked?? use elf_is_ehdr_sane β that's the sanity check, go do it first, no cap β
β¨ SEE ALSO β¨
the whole friend group π«Ά all from the kernel file ./kernel/kexec_elf.c:
elf_is_ehdr_sane(9)elf_is_phdr_sane(9)elf_read_from_buffer(9)kexec_free_elf_info(9)kexec_build_elf_info(9)kexec_elf_load(9)
π and that's the page! shoutout to ./kernel for the source, and this one's stamped October 2026 β iconic, obsessed, bye bestie! πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms