Thu Nov 23 21:27:08 2023 UTC (178d)
stack(7): Clarify thread stack guard vs program stack guard.

Just in case this confuses anyone dealing with PR pkg/57708.

XXX pullup-10


(riastradh)
diff -r1.1 -r1.2 src/share/man/man7/stack.7

cvs diff -r1.1 -r1.2 src/share/man/man7/stack.7 (expand / switch to unified diff)

--- src/share/man/man7/stack.7 2023/11/23 21:20:49 1.1
+++ src/share/man/man7/stack.7 2023/11/23 21:27:08 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: stack.7,v 1.1 2023/11/23 21:20:49 riastradh Exp $ 1.\" $NetBSD: stack.7,v 1.2 2023/11/23 21:27:08 riastradh Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 The NetBSD Foundation, Inc. 3.\" Copyright (c) 2023 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" Redistribution and use in source and binary forms, with or without 6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions 7.\" modification, are permitted provided that the following conditions
8.\" are met: 8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright 9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer. 10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the 12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution. 13.\" documentation and/or other materials provided with the distribution.
14.\" 14.\"
@@ -233,26 +233,31 @@ The default guard size is tuned by the @@ -233,26 +233,31 @@ The default guard size is tuned by the
233.Xr sysctl 7 233.Xr sysctl 7
234knob. 234knob.
235.Pp 235.Pp
236For the main thread, 236For the main thread,
237.Xr pthread_getattr_np 3 237.Xr pthread_getattr_np 3
238returns a 238returns a
239.Em snapshot 239.Em snapshot
240of the parameters as they existed at program startup, so that stackaddr 240of the parameters as they existed at program startup, so that stackaddr
241and stacksize reflect the current accessible pages of the stack, and 241and stacksize reflect the current accessible pages of the stack, and
242guardsize is the value of the 242guardsize is the value of the
243.Li vm.guard_size 243.Li vm.guard_size
244.Xr sysctl 7 244.Xr sysctl 7
245knob at the time of program startup. 245knob at the time of program startup.
 246(Note that this means the
 247.Xr pthread 3
 248view of the main thread's stack guard may not coincide with the actual
 249stack guard \(em it may overlap with, or lie entirely in, the
 250inaccessible pages of the stack reserved on program start.)
246However, if the program changes its soft stack rlimit with 251However, if the program changes its soft stack rlimit with
247.Xr setrlimit 2 , 252.Xr setrlimit 2 ,
248this snapshot may become stale. 253this snapshot may become stale.
249.Sh SEE ALSO 254.Sh SEE ALSO
250.Xr execve 2 , 255.Xr execve 2 ,
251.Xr mmap 2 , 256.Xr mmap 2 ,
252.Xr mprotect 2 , 257.Xr mprotect 2 ,
253.Xr sigaltstack 2 , 258.Xr sigaltstack 2 ,
254.Xr ucontext 2 , 259.Xr ucontext 2 ,
255.Xr posix_spawn 3 , 260.Xr posix_spawn 3 ,
256.Xr pthread 3 , 261.Xr pthread 3 ,
257.Xr security 7 , 262.Xr security 7 ,
258.Xr sysctl 7 , 263.Xr sysctl 7 ,