From 4607213d6b4922f43cb8a3f75f41ba98fe8afae5 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Wed, 22 Jul 2015 09:18:26 +0200 Subject: [PATCH] mprotect.2: Note ENOMEM error that can occur when we reach limit on maximum VMAs Signed-off-by: Michael Kerrisk --- man2/mprotect.2 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/man2/mprotect.2 b/man2/mprotect.2 index 203aad72a..1daffdd38 100644 --- a/man2/mprotect.2 +++ b/man2/mprotect.2 @@ -109,6 +109,18 @@ or specify one or more pages that are not mapped. (Before kernel 2.4.19, the error .BR EFAULT was incorrectly produced for these cases.) +.TP +.B ENOMEM +Changing the protection of a memory region would result in the total number of +mappings with distinct attributes (e.g., read versus read/write protection) +exceeding the allowed maximum. +.\" I.e., the number of VMAs would exceed the 64kB maximum +(For example, making the protection of a range +.BR PROT_READ +in the middle of a region currently protected as +.BR PROT_READ|PROT_WRITE +would result in three mappings: +two read/write mappings at each end and a read-only mapping in the middle.) .SH CONFORMING TO SVr4, POSIX.1-2001. .\" SVr4 defines an additional error