Re: [PATCH] prctl: allow prctl_set_mm_exe_file without unmapping old exe
From: tblodt
Date: Wed Aug 28 2024 - 11:50:53 EST
> Interestingly, the man page states:
>
> "You can even type /proc/pid/exe to run another copy of the same executable that is being run by process pid."
>
> Is that still true (with that binfmt_misc magic) once we change /proc/self/exe? Or does it with changing /proc/self/exe to point at the non-emulator exe even work as expected regarding this documentation?
This is actually one of the reasons for an emulator to want to update /proc/self/exe. If it points to the interpreter, running /proc/pid/exe starts a copy of the emulator, but without any idea of what program it was supposed to be running. If it points to the emulated program, running /proc/pid/exe will still start the emulator because it's registered in binfmt_misc, but with the emulated program. The intended result is for references to /proc/self/exe to function the same way they would without the emulator.
~Theodore