UFFDIO_POISON(2const)
π UFFDIO_POISON(2const) π
okay bestie, so this is UFFDIO_POISON, and it lives in section 2const of the Linux man-pages. it's one of those ioctl constant pages, so buckle up, we're poisoning address ranges (in the cute, page-table way, not the illegal way π§ͺ).
β¨ NAME β¨
UFFDIO_POISON β mark an address range as "poisoned"
π LIBRARY π
Standard C library (libc, -lc) π«Ά
π SYNOPSIS π
no cap, this is the whole thing:
#include <linux/userfaultfd.h> /* Definition of UFFD* constants */
#include <sys/ioctl.h>
int ioctl(int fd, UFFDIO_POISON, ...);
#include <linux/userfaultfd.h>
struct uffdio_poison {
struct uffdio_range range;
/* Range to install poison PTE markers in */
__u64 mode; /* Flags controlling the behavior of poison */
__s64 updated; /* Number of bytes poisoned, or negated error */
};
π DESCRIPTION π
so the vibe here is: you mark an address range as "poisoned", and any future access to those addresses is gonna raise a SIGBUS signal. π rude, but that's the point.
and here's the thing that makes it different from MADV_HWPOISON: it works by installing page table entries, instead of actually "really" poisoning the underlying physical pages. it's giving illusion, not violence. which means it only affects this particular address space β your neighbors are safe, periodt. β¨
you can bitwise OR the following value into mode to change how the UFFDIO_POISON operation behaves:
UFFDIO_POISON_MODE_DONTWAKEβ do not wake up the thread that's waiting for page-fault resolution. let her sleep π€
and now, the updated field. the kernel uses it to hand you back the number of bytes that were actually poisoned, or an error, in the exact same manner as UFFDIO_COPY. so if the value that comes back in updated does not match the value you specified in range.len, the operation fails with the error EAGAIN. π€
important, bestie:updatedis output-only. it is not read by theUFFDIO_POISONoperation. don't try to talk to it, it's not listening. π
π₯ RETURN VALUE π₯
On success, 0 is returned. and in that case? the entire area was poisoned. ate. π
On error, -1 is returned and errno is set to indicate the error. classic.
π ERRORS π
EAGAINβ the number of bytes mapped (i.e., the value returned in theupdatedfield) does not equal the value that was specified in therange.lenfield.EINVALβ eitherrange.startorrange.lenwas not a multiple of the system page size; orrange.lenwas zero; or the range specified was invalid.EINVALβ an invalid bit was specified in themodefield. (yes,EINVALtwice, that's just how she is π )EEXISTβ one or more pages were already mapped in the given range. πENOENTβ the faulting process has changed its virtual memory layout simultaneously with an outstandingUFFDIO_POISONoperation. multitasking gone wrong.ENOMEMβ allocating memory for page table entries failed.ESRCHβ the faulting process has exited at the time of aUFFDIO_POISONoperation. she left πͺ
π STANDARDS π
Linux. that's it, that's the standard. π§
π¦ HISTORY π¦
Linux 6.6. so it's a newer baddie, not an ancient one.
π EXAMPLES π
See userfaultfd(2). (iykyk β the examples live over there π«Ά)
β SEE ALSO β
ioctl(2)ioctl_userfaultfd(2)userfaultfd(2)linux.git/Documentation/admin-guide/mm/userfaultfd.rst
and that's the whole page, bestie!! πβ¨ this cutie came out of Linux man-pages 6.20, dated 2026-02-08 β go poison some page tables responsibly, mwah ππ§ββοΈπΈ
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 2016, International Business Machines Corp
- Copyright 2016, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms