Commit e1b93c9e authored by Paul Mackerras's avatar Paul Mackerras

PPC32: Adjust ucontext to conform with historical practice and with glibc.

This moves the uc_sigmask field back to where it was before.  We now don't
assume the registers are at a fixed offset in the ucontext, but instead
access them through the uc_regs field as in the past.  This corresponds with
a recent change in glibc CVS.
parent 580c41c7
...@@ -272,7 +272,7 @@ restore_user_regs(struct pt_regs *regs, struct mcontext __user *sr) ...@@ -272,7 +272,7 @@ restore_user_regs(struct pt_regs *regs, struct mcontext __user *sr)
sizeof(sr->mc_vregs))) sizeof(sr->mc_vregs)))
return 1; return 1;
} else if (current->thread.used_vr) } else if (current->thread.used_vr)
memset(&current->thread.vr, 0, sizeof(current->thread.vr)); memset(&current->thread.vr, 0, ELF_NVRREG * sizeof(vector128));
/* Always get VRSAVE back */ /* Always get VRSAVE back */
if (__get_user(current->thread.vrsave, (u32 *)&sr->mc_vregs[32])) if (__get_user(current->thread.vrsave, (u32 *)&sr->mc_vregs[32]))
...@@ -328,7 +328,6 @@ handle_rt_signal(unsigned long sig, struct k_sigaction *ka, ...@@ -328,7 +328,6 @@ handle_rt_signal(unsigned long sig, struct k_sigaction *ka,
&rt_sf->uc.uc_stack.ss_flags) &rt_sf->uc.uc_stack.ss_flags)
|| __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size) || __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size)
|| __put_user(&rt_sf->uc.uc_mcontext, &rt_sf->uc.uc_regs) || __put_user(&rt_sf->uc.uc_mcontext, &rt_sf->uc.uc_regs)
|| __copy_to_user(&rt_sf->uc.uc_oldsigmask, oldset, sizeof(*oldset))
|| __copy_to_user(&rt_sf->uc.uc_sigmask, oldset, sizeof(*oldset))) || __copy_to_user(&rt_sf->uc.uc_sigmask, oldset, sizeof(*oldset)))
goto badframe; goto badframe;
...@@ -363,12 +362,13 @@ handle_rt_signal(unsigned long sig, struct k_sigaction *ka, ...@@ -363,12 +362,13 @@ handle_rt_signal(unsigned long sig, struct k_sigaction *ka,
static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs) static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs)
{ {
sigset_t set; sigset_t set;
struct mcontext *mcp;
if (__copy_from_user(&set, &ucp->uc_sigmask, sizeof(set))) if (__copy_from_user(&set, &ucp->uc_sigmask, sizeof(set))
|| __get_user(mcp, &ucp->uc_regs))
return -EFAULT; return -EFAULT;
restore_sigmask(&set); restore_sigmask(&set);
if (restore_user_regs(regs, mcp))
if (restore_user_regs(regs, &ucp->uc_mcontext))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -385,9 +385,6 @@ int sys_swapcontext(struct ucontext __user *old_ctx, ...@@ -385,9 +385,6 @@ int sys_swapcontext(struct ucontext __user *old_ctx,
|| save_user_regs(regs, &old_ctx->uc_mcontext, 0) || save_user_regs(regs, &old_ctx->uc_mcontext, 0)
|| __copy_to_user(&old_ctx->uc_sigmask, || __copy_to_user(&old_ctx->uc_sigmask,
&current->blocked, sizeof(sigset_t)) &current->blocked, sizeof(sigset_t))
/* the next 2 things aren't strictly necessary */
|| __copy_to_user(&old_ctx->uc_oldsigmask,
&current->blocked, sizeof(sigset_t))
|| __put_user(&old_ctx->uc_mcontext, &old_ctx->uc_regs)) || __put_user(&old_ctx->uc_mcontext, &old_ctx->uc_regs))
return -EFAULT; return -EFAULT;
} }
......
...@@ -16,12 +16,11 @@ struct ucontext { ...@@ -16,12 +16,11 @@ struct ucontext {
struct ucontext *uc_link; struct ucontext *uc_link;
stack_t uc_stack; stack_t uc_stack;
int uc_pad[7]; int uc_pad[7];
struct mcontext *uc_regs; /* backward compat */ struct mcontext *uc_regs; /* points to uc_mcontext field */
sigset_t uc_oldsigmask; /* backward compat */
int uc_pad2;
sigset_t uc_sigmask; sigset_t uc_sigmask;
/* glibc has 1024-bit signal masks, ours are 64-bit */ /* glibc has 1024-bit signal masks, ours are 64-bit */
int uc_maskext[30]; int uc_maskext[30];
int uc_pad2[3];
struct mcontext uc_mcontext; struct mcontext uc_mcontext;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment