This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: {make,set,swap}context broken on powerpc32


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]