On Wed, Nov 20, 2019 at 11:04:15AM -0000, Miod Vallat wrote: > Index: sys/arch/mips64/mips64/vm_machdep.c > =================================================================== > RCS file: /OpenBSD/src/sys/arch/mips64/mips64/vm_machdep.c,v > retrieving revision 1.37 > diff -u -p -r1.37 vm_machdep.c > --- sys/arch/mips64/mips64/vm_machdep.c 2 Sep 2017 15:56:29 -0000 > 1.37 > +++ sys/arch/mips64/mips64/vm_machdep.c 20 Nov 2019 11:03:22 -0000 > @@ -135,7 +135,7 @@ cpu_fork(struct proc *p1, struct proc *p > } > pcb->pcb_context.val[10] = (register_t)proc_trampoline; > pcb->pcb_context.val[8] = (register_t)pcb + > - USPACE - sizeof(struct trapframe); > + ((USPACE - sizeof(struct trapframe)) & ~_STACKALIGNBYTES); > pcb->pcb_context.val[1] = (register_t)arg; > pcb->pcb_context.val[0] = (register_t)func; > }
This also explains why variable argument functions have not caused problems in userspace. I have committed the fix. Thank you!