{make,set,swap}context broken on powerpc32
Paul Mackerras
paulus@samba.org
Wed Dec 13 14:52:00 GMT 2006
Jakub Jelinek writes:
> uc_mcontext.uc_regs pointer the swapcontext call creates is not
> aligned though:
Now that I can believe, since the register saving code is derived from
the code used to construct signal frames, and therefore assumes that
the ucontext is 16-byte aligned. So yes, that's a kernel bug.
Note that sys_swapcontext can happily use, as its second argument, a
ucontext where the uc_mcontext.uc_regs field is not 16-byte aligned,
though, so glibc could work around the kernel bug by doing the memmove
in makecontext as you suggest.
When I fix the kernel bug, which of these two options would you
prefer?
(a) the kernel sets ucp->uc_mcontext.uc_regs to the value it uses now,
rounded up to a 16-byte boundary, and stores the registers there; or
(b) the kernel relies on glibc to have set ucp->uc_mcontext.uc_regs
appropriately and stores the registers where it points to (i.e. the
kernel does not alter ucp->uc_mcontext.uc_regs).
Regards,
Paul.
More information about the Libc-alpha
mailing list