bug in stack(7)?

Thomas Klausner <[email protected]> Thu, 23 Apr 2026 16:07:38 +0200
Newsgroups gmane.os.netbsd.current
Message-ID <[email protected]>
Hi!

stack(7) has these paragraphs:

   Non-main threads
     Threads created with pthread_create(3) have stacks allocated at
     dynamically chosen addresses outside the main thread's stack region by
     default, and their stacks cannot be resized after creation.  On
     architectures where the stack grows down, the layout is:

     +--------------------+ stack base = stackaddr + stacksize + guardsize
     | stack              |
     | .                  |
     | .                  | <-- stack pointer (varies during execution)
     | .                  |
     +--------------------+ stackaddr
     | guard/redzone      |
     +--------------------+ stackaddr - guardsize

     On architectures where the stack grows up, the layout is:

     +--------------------+ stackaddr + stacksize + guardsize
     | guard/redzone      |
     +--------------------+ stackaddr + stacksize
     | .                  |
     | .                  | <-- stack pointer (varies during execution)
     | .                  |
     | stack              |
     +--------------------+ stack base = stackaddr



I think that in the first diagram, instead of "stack base = stackaddr
+ stacksize + guardsize" it should be "stack base = stackaddr +
stacksize".

Can someone please confirm this before I fix the man page?

Thanks,
 Thomas