replace_mm_exe_file(9)
π replace_mm_exe_file β Kernel API Manual β¨
okay so you found the replace_mm_exe_file page in the Kernel API Manual and you're like "bestie what is this" β don't worry, I got you π«Ά it's genuinely not that deep, it's literally one function that swaps out which file counts as a process's "executable" π
β¨ NAME β¨
replace_mm_exe_file β replace a reference to the mm's executable file π
πΈ SYNOPSIS πΈ
int replace_mm_exe_file (struct mm_struct *mm , struct file
*new_exe_file );
like, it takes two things and gives you back an int, that's the whole vibe π
π¦ ARGUMENTS π¦
mmβ the mm you're changing. that's your main character right there πnew_exe_fileβ the new file you wanna use. the glow-up file π
π DESCRIPTION π
so what it does: it changes mm's executable file β and yes, that's the one you see as the symlink at /proc/[pid]/exe π§ like, when you peek at that path, this is the thing you're peeking at, no cap β¨
the main user of this is sys_prctl(PR_SET_MM_MAP/EXE_FILE) β that's the one calling the shots π₯
ngl it's a small function but it's doing real work in there, respect it π«‘
π SEE ALSO π
sibling functions, the whole friend group π all from the Kernel file ./kernel/fork.c:
set_mm_exe_file(9)get_mm_exe_file(9)get_task_exe_file(9)get_task_mm(9)dup_mm(9)pidfd_prepare(9)clone3_stack_valid(9)sys_clone3(9)
aaaand that's the page π source is ./kernel, version date October 2026, and the header was still screaming replace_mm_exe_file(9) at us the whole time because of course it was π go read fork.c bestie, it's giving required reading πβ
π¦ 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