/proc/pid/exe
PR_SET_MM_EXE_FILE2const
Modify kernel memory map descriptor fields
Usage
#include <linux/prctl.h> /* Definition of PR_* constants */ #include <sys/prctl.h>
int prctl(PR_SET_MM, PR_SET_MM_EXE_FILE, long fd, 0L, 0L);
Library
Standard C library (libc, -lc)
Overview
Supersede the /proc/pid/exe symbolic link with a new one pointing to a new executable file identified by the file descriptor provided in the fd argument. The file descriptor should be obtained with a regular open(2) call.
To change the symbolic link, one needs to unmap all existing executable memory areas, including those created by the kernel itself (for example the kernel usually creates at least one executable memory area for the ELF .text section).
Return value
On success, 0 is returned. On error, -1 is returned, and errno is set to indicate the error.
Errors
EACCES
|
The file is not executable. |
|---|---|
EBADF
|
The file descriptor passed in fd is not valid. |
EBUSY
|
This is the second attempt to change the /proc/pid/exe symbolic link. |
Files
Releases
2 releases since Debian 13 (Trixie); the text changed 1 time.