| @@ -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 |
234 | knob. | | 234 | knob. |
235 | .Pp | | 235 | .Pp |
236 | For the main thread, | | 236 | For the main thread, |
237 | .Xr pthread_getattr_np 3 | | 237 | .Xr pthread_getattr_np 3 |
238 | returns a | | 238 | returns a |
239 | .Em snapshot | | 239 | .Em snapshot |
240 | of the parameters as they existed at program startup, so that stackaddr | | 240 | of the parameters as they existed at program startup, so that stackaddr |
241 | and stacksize reflect the current accessible pages of the stack, and | | 241 | and stacksize reflect the current accessible pages of the stack, and |
242 | guardsize is the value of the | | 242 | guardsize is the value of the |
243 | .Li vm.guard_size | | 243 | .Li vm.guard_size |
244 | .Xr sysctl 7 | | 244 | .Xr sysctl 7 |
245 | knob at the time of program startup. | | 245 | knob at the time of program startup. |
| | | 246 | (Note that this means the |
| | | 247 | .Xr pthread 3 |
| | | 248 | view of the main thread's stack guard may not coincide with the actual |
| | | 249 | stack guard \(em it may overlap with, or lie entirely in, the |
| | | 250 | inaccessible pages of the stack reserved on program start.) |
246 | However, if the program changes its soft stack rlimit with | | 251 | However, if the program changes its soft stack rlimit with |
247 | .Xr setrlimit 2 , | | 252 | .Xr setrlimit 2 , |
248 | this snapshot may become stale. | | 253 | this 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 , |