git: b52405d11db5 - stable/13 - posix_spawn(3): document POSIX_SPAWN_DISABLE_ASLR_NP

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 11 Mar 2024 00:30:33 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=b52405d11db5f959106f19568d4a8f94e951cee3

commit b52405d11db5f959106f19568d4a8f94e951cee3
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-03-03 22:19:22 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-03-11 00:29:51 +0000

    posix_spawn(3): document POSIX_SPAWN_DISABLE_ASLR_NP
    
    (cherry picked from commit a725a7a24de585e996f21e190b5af41261ebc774)
---
 lib/libc/gen/posix_spawn.3              | 12 +++++++++++-
 lib/libc/gen/posix_spawnattr_getflags.3 |  3 ++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/libc/gen/posix_spawn.3 b/lib/libc/gen/posix_spawn.3
index a9ff7b2b21da..55559ae7222b 100644
--- a/lib/libc/gen/posix_spawn.3
+++ b/lib/libc/gen/posix_spawn.3
@@ -32,7 +32,7 @@
 .\" the referee document.  The original Standard can be obtained online at
 .\"	http://www.opengroup.org/unix/online.html.
 .\"
-.Dd November 28, 2021
+.Dd March 4, 2024
 .Dt POSIX_SPAWN 3
 .Os
 .Sh NAME
@@ -297,6 +297,15 @@ and the signals being indicated in the spawn-sigdefault attribute
 of the object referenced by
 .Fa attrp .
 .Pp
+The Address Space Layout Randomization for the newly spawned process
+can be disabled by specifying the
+.Dv POSIX_SPAWN_DISABLE_ASLR_NP
+flag in the spawn-flags attribute.
+This setting is inherited by future children of the child as well.
+See
+.Xr procctl 2
+for more details.
+.Pp
 If the value of the
 .Fa attrp
 pointer is NULL, then the default values are used.
@@ -432,6 +441,7 @@ action.
 .Xr execve 2 ,
 .Xr fcntl 2 ,
 .Xr open 2 ,
+.Xr procctl 2 ,
 .Xr sched_setparam 2 ,
 .Xr sched_setscheduler 2 ,
 .Xr setpgid 2 ,
diff --git a/lib/libc/gen/posix_spawnattr_getflags.3 b/lib/libc/gen/posix_spawnattr_getflags.3
index 18cf6683e935..308bbb386d76 100644
--- a/lib/libc/gen/posix_spawnattr_getflags.3
+++ b/lib/libc/gen/posix_spawnattr_getflags.3
@@ -32,7 +32,7 @@
 .\" the referee document.  The original Standard can be obtained online at
 .\"	http://www.opengroup.org/unix/online.html.
 .\"
-.Dd March 24, 2008
+.Dd March 4, 2024
 .Dt POSIX_SPAWNATTR_GETFLAGS 3
 .Os
 .Sh NAME
@@ -75,6 +75,7 @@ It is the bitwise-inclusive OR of zero or more of the following flags
 .It Dv POSIX_SPAWN_SETSIGMASK
 .It Dv POSIX_SPAWN_SETSCHEDPARAM
 .It Dv POSIX_SPAWN_SETSCHEDULER
+.It Dv POSIX_SPAWN_DISABLE_ASLR_NP
 .El
 .Pp
 These flags are defined in