From 1bcf4b3aaf39cedd42bb5b34a81c6044b8a02d5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
Date: Tue, 19 Jun 2018 13:13:18 +0200
Subject: [PATCH] madvise.2: document MADV_WIPEONFORK and MADV_KEEPONFORK
---
man-pages/en/man2/madvise.2 | 39 +++++++++++++++++++++++++++++++++++++
man-pages/man2/madvise.2 | 39 +++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+)
diff --git a/man-pages/en/man2/madvise.2 b/man-pages/en/man2/madvise.2
index 4e693da..8a1c46d 100644
--- a/man-pages/en/man2/madvise.2
+++ b/man-pages/en/man2/madvise.2
@@ -265,6 +265,33 @@ file (see
.BR MADV_DODUMP " (since Linux 3.4)"
Undo the effect of an earlier
.BR MADV_DONTDUMP .
+.TP
+.BR MADV_WIPEONFORK " (since Linux 4.14)"
+.\" commit d2cd9ede6e193dd7d88b6d27399e96229a551b19
+Present the child process with zero-filled memory in this range after a
+.BR fork (2).
+This is useful in forking servers in order to ensure
+that sensitive per-process data
+(for example, PRNG seeds, cryptographic secrets, and so on)
+is not handed to child processes.
+.IP
+The
+.B MADV_WIPEONFORK
+operation can be applied only to private anonymous pages (see
+.BR mmap (2)).
+.IP
+Within the child created by
+.BR fork (2),
+the
+.B MADV_WIPEONFORK
+setting remains in place on the specified address range.
+This setting is cleared during
+.BR execve (2).
+.TP
+.BR MADV_KEEPONFORK " (since Linux 4.14)"
+.\" commit d2cd9ede6e193dd7d88b6d27399e96229a551b19
+Undo the effect of an earlier
+.BR MADV_WIPEONFORK .
.SH RETURN VALUE
On success
.BR madvise ()
@@ -308,6 +335,18 @@ but the kernel was not configured with
.BR CONFIG_KSM .
.RE
.TP
+.B EINVAL
+.I advice
+is
+.BR MADV_FREE
+or
+.BR MADV_WIPEONFORK
+but the specified address range includes file, Huge TLB,
+.BR MAP_SHARED ,
+or
+.BR VM_PFNMAP
+ranges.
+.TP
.B EIO
(for
.BR MADV_WILLNEED )
diff --git a/man-pages/man2/madvise.2 b/man-pages/man2/madvise.2
index 4e693da..8a1c46d 100644
--- a/man-pages/man2/madvise.2
+++ b/man-pages/man2/madvise.2
@@ -265,6 +265,33 @@ file (see
.BR MADV_DODUMP " (since Linux 3.4)"
Undo the effect of an earlier
.BR MADV_DONTDUMP .
+.TP
+.BR MADV_WIPEONFORK " (since Linux 4.14)"
+.\" commit d2cd9ede6e193dd7d88b6d27399e96229a551b19
+Present the child process with zero-filled memory in this range after a
+.BR fork (2).
+This is useful in forking servers in order to ensure
+that sensitive per-process data
+(for example, PRNG seeds, cryptographic secrets, and so on)
+is not handed to child processes.
+.IP
+The
+.B MADV_WIPEONFORK
+operation can be applied only to private anonymous pages (see
+.BR mmap (2)).
+.IP
+Within the child created by
+.BR fork (2),
+the
+.B MADV_WIPEONFORK
+setting remains in place on the specified address range.
+This setting is cleared during
+.BR execve (2).
+.TP
+.BR MADV_KEEPONFORK " (since Linux 4.14)"
+.\" commit d2cd9ede6e193dd7d88b6d27399e96229a551b19
+Undo the effect of an earlier
+.BR MADV_WIPEONFORK .
.SH RETURN VALUE
On success
.BR madvise ()
@@ -308,6 +335,18 @@ but the kernel was not configured with
.BR CONFIG_KSM .
.RE
.TP
+.B EINVAL
+.I advice
+is
+.BR MADV_FREE
+or
+.BR MADV_WIPEONFORK
+but the specified address range includes file, Huge TLB,
+.BR MAP_SHARED ,
+or
+.BR VM_PFNMAP
+ranges.
+.TP
.B EIO
(for
.BR MADV_WILLNEED )
--
2.17.1