2015-09-05 20:47 GMT+02:00 erik quanstrom <quanstro@quanstro.net>:
> May be my problem is that p is global in my case?

global variables are in the bss, and thus shared. p will have
the same value in each thread, but *p should point into the
stack, and thus the same virtual address will be mapped to
different physical pages of memory.

however, if *p is assigned to a non-zero value before the process
is created, the new page allocated for the new process' stack will
have a copy of the old value, and thus not be 0.

- erik


That's exactly what happened.
I misread privalloc(2), and assumed that privalloc()ed addresses were somehow reset on rfork.
This is probably something to explicitly state the man page.

Thanks you all!


Giacomo