NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/60653: posix_spawn(3) causes incorrect stack base information



The following reply was made to PR kern/60653; it has been noted by GNATS.

From: Thomas Klausner <wiz%netbsd.org@localhost>
To: NetBSD bugtracking <gnats-bugs%netbsd.org@localhost>
Cc: 
Subject: Re: kern/60653: posix_spawn(3) causes incorrect stack base
 information
Date: Wed, 26 Aug 2026 22:15:14 +0200

 Just in case, here is the output from a NetBSD 10 system, showing it's
 a long-standing problem (it's still there in 11.99.7):
 
 # ./posix_spawn_stack_bug
 parent pid=27310
       real stack top (ps_strings) = 0x7f7fff0fb000
       AT_STACKBASE                = 0x7f7fff0fb000
       p_stackbase (getcontext)    = 0x7f7fff0fb000
       pthread main stack          = 0x7f7ffecfb000 .. 0x7f7fff0fb000
 
 
 --- fork + execve ---
 fork+exec pid=2245
       real stack top (ps_strings) = 0x7f7fffe28000
       AT_STACKBASE                = 0x7f7fffe28000
       p_stackbase (getcontext)    = 0x7f7fffe28000
       pthread main stack          = 0x7f7fffa28000 .. 0x7f7fffe28000
 
 fork+exec pid=19353
       real stack top (ps_strings) = 0x7f7fffa23000
       AT_STACKBASE                = 0x7f7fffa23000
       p_stackbase (getcontext)    = 0x7f7fffa23000
       pthread main stack          = 0x7f7fff623000 .. 0x7f7fffa23000
 
 
 --- posix_spawn ---
 posix_spawn pid=25804
       real stack top (ps_strings) = 0x7f7fff042000
       AT_STACKBASE                = 0x7f7fffa23000   <-- WRONG
       p_stackbase (getcontext)    = 0x7f7fffa23000   <-- WRONG
       pthread main stack          = 0x7f7fff623000 .. 0x7f7fffa23000   <-- WRONG
       => off by +10358784 bytes (+10116 kiB); the reported stack runs past the end of the mapping
 
 posix_spawn pid=17587
       real stack top (ps_strings) = 0x7f7fff252000
       AT_STACKBASE                = 0x7f7fffa23000   <-- WRONG
       p_stackbase (getcontext)    = 0x7f7fffa23000   <-- WRONG
       pthread main stack          = 0x7f7fff623000 .. 0x7f7fffa23000   <-- WRONG
       => off by +8196096 bytes (+8004 kiB); the reported stack runs past the end of the mapping
 
 
 parent after spawn pid=27310
       real stack top (ps_strings) = 0x7f7fff0fb000
       AT_STACKBASE                = 0x7f7fff0fb000
       p_stackbase (getcontext)    = 0x7f7fff252000   <-- WRONG
       pthread main stack          = 0x7f7ffecfb000 .. 0x7f7fff0fb000
 
 
 parent p_stackbase changed after spawns: 0x7f7fff0fb000 -> 0x7f7fff252000
 
  Thomas
 



Home | Main Index | Thread Index | Old Index