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

# UFFDIO\_REGISTER(2const)

register a memory address range with the userfaultfd object

## NAME

UFFDIO\_REGISTER - register a memory address range with the userfaultfd object

## LIBRARY

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

## SYNOPSIS

```
#include <linux/userfaultfd.h>  /* Definition of UFFD* constants */
#include <sys/ioctl.h>
```

**int ioctl(int** *fd***, UFFDIO\_REGISTER, struct uffdio\_register \****argp***);**

**#include \<linux/userfaultfd.h\>**

```
struct uffdio_range {
    __u64  start;   /* Start of range */
    __u64  len;     /* Size of range (bytes) */
};
struct uffdio_register {
    struct uffdio_range  range;
    __u64                mode;    /* Desired mode of operation (input) */
    __u64                ioctls;  /* Available ioctl()s (output) */
};
```

## DESCRIPTION

Register a memory address range with the userfaultfd object. The pages in the range must be “compatible”. Please refer to the list of register modes below for the compatible memory backends for each mode.

The *argp-\>range* field defines a memory range starting at *argp-\>range.start* and continuing for *argp-\>range.len* bytes that should be handled by the userfaultfd.

The *argp-\>mode* field defines the mode of operation desired for this memory region. The following values may be bitwise ORed to set the userfaultfd mode for the specified range:

- **UFFDIO\_REGISTER\_MODE\_MISSING**

  Track page faults on missing pages. Since Linux 4.3, only private anonymous ranges are compatible. Since Linux 4.11, hugetlbfs and shared memory ranges are also compatible.

- **UFFDIO\_REGISTER\_MODE\_WP**

  Track page faults on write-protected pages. Since Linux 5.7, only private anonymous ranges are compatible.

- **UFFDIO\_REGISTER\_MODE\_MINOR**

  Track minor page faults. Since Linux 5.13, only hugetlbfs ranges are compatible. Since Linux 5.14, compatibility with shmem ranges was added.

- **UFFDIO\_REGISTER\_MODE\_RWP** (since Linux 7.2)

  Track page faults on read-write-protected pages. Every access (read or write) to a page present within the registered range generates a notification once the range has been protected with [**UFFDIO\_RWPROTECT**(2const)](/UFFDIO_RWPROTECT/2const.md). This mode cannot be combined with **UFFDIO\_REGISTER\_MODE\_WP**; attempting to do so fails with **EINVAL**. Anonymous, shmem, and hugetlbfs ranges are compatible.

If the operation is successful, the kernel modifies the *argp-\>ioctls* bit-mask field to indicate which [**ioctl**(2)](/ioctl/2.md) operations are available for the specified range. This returned bit mask can contain the following bits:

- **1 \<\< \_UFFDIO\_COPY**

  The **UFFDIO\_COPY** operation is supported.

- **1 \<\< \_UFFDIO\_WAKE**

  The **UFFDIO\_WAKE** operation is supported.

- **1 \<\< \_UFFDIO\_WRITEPROTECT**

  The **UFFDIO\_WRITEPROTECT** operation is supported.

- **1 \<\< \_UFFDIO\_ZEROPAGE**

  The **UFFDIO\_ZEROPAGE** operation is supported.

- **1 \<\< \_UFFDIO\_CONTINUE**

  The **UFFDIO\_CONTINUE** operation is supported.

- **1 \<\< \_UFFDIO\_POISON**

  The **UFFDIO\_POISON** operation is supported.

- **1 \<\< \_UFFDIO\_RWPROTECT** (since Linux 7.2)

  The **UFFDIO\_RWPROTECT** operation is supported. This bit is reported only when the range was registered with **UFFDIO\_REGISTER\_MODE\_RWP** (which itself requires **UFFD\_FEATURE\_RWP** to have been negotiated).

## RETURN VALUE

On success, 0 is returned. On error, -1 is returned and *errno* is set to indicate the error.

## ERRORS

- **EBUSY**

  A mapping in the specified range is registered with another userfaultfd object.

- **EFAULT**

  *argp* refers to an address that is outside the calling process's accessible address space.

- **EINVAL**

  An invalid or unsupported bit was specified in the *mode* field; or the *mode* field was zero.

- **EINVAL**

  There is no mapping in the specified address range.

- **EINVAL**

  *range.start* or *range.len* is not a multiple of the system page size; or, *range.len* is zero; or these fields are otherwise invalid.

- **EINVAL**

  There as an incompatible mapping in the specified address range.

## STANDARDS

Linux.

## HISTORY

Linux 4.3.

## EXAMPLES

See [**userfaultfd**(2)](/userfaultfd/2.md).

## SEE ALSO

[**ioctl**(2)](/ioctl/2.md), [**ioctl\_userfaultfd**(2)](/ioctl_userfaultfd/2.md), [**UFFDIO\_UNREGISTER**(2const)](/UFFDIO_UNREGISTER/2const.md), [**userfaultfd**(2)](/userfaultfd/2.md)

*linux.git/Documentation/admin-guide/mm/userfaultfd.rst*
