---
name: "PR_SET_MM_EXE_FILE"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/PR_SET_MM_EXE_FILE"
---

# PR\_SET\_MM\_EXE\_FILE(2const)

modify kernel memory map descriptor fields

## NAME

PR\_SET\_MM\_EXE\_FILE - modify kernel memory map descriptor fields

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#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);**

## DESCRIPTION

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)](/open/2.md) 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

- */proc/*pid*/exe*

  ## STANDARDS

Linux.

## HISTORY

Linux 3.5.

In Linux 4.9 and earlier, the **PR\_SET\_MM\_EXE\_FILE** operation can be performed only once in a process's lifetime; attempting to perform the operation a second time results in the error **EPERM**. This restriction was enforced for security reasons that were subsequently deemed specious, and the restriction was removed in Linux 4.10 because some user-space applications needed to perform this operation more than once.

## SEE ALSO

[**prctl**(2)](/prctl/2.md), [**PR\_SET\_MM**(2const)](/PR_SET_MM/2const.md), [**proc\_pid\_exe**(5)](/proc_pid_exe/5.md)
