From e1b93c9e66c8bf47bef5b54ad01effcdf21c7f1b Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Sat, 27 Sep 2003 19:07:22 +1000 Subject: [PATCH] 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. --- arch/ppc/kernel/signal.c | 13 +++++-------- include/asm-ppc/ucontext.h | 5 ++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/arch/ppc/kernel/signal.c b/arch/ppc/kernel/signal.c index 3558caa4c2be2..4f2be30b038a1 100644 --- a/arch/ppc/kernel/signal.c +++ b/arch/ppc/kernel/signal.c @@ -272,7 +272,7 @@ restore_user_regs(struct pt_regs *regs, struct mcontext __user *sr) sizeof(sr->mc_vregs))) return 1; } else if (current->thread.used_vr) - memset(¤t->thread.vr, 0, sizeof(current->thread.vr)); + memset(¤t->thread.vr, 0, ELF_NVRREG * sizeof(vector128)); /* Always get VRSAVE back */ 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, &rt_sf->uc.uc_stack.ss_flags) || __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) - || __copy_to_user(&rt_sf->uc.uc_oldsigmask, oldset, sizeof(*oldset)) || __copy_to_user(&rt_sf->uc.uc_sigmask, oldset, sizeof(*oldset))) goto badframe; @@ -363,12 +362,13 @@ badframe: static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs) { 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; restore_sigmask(&set); - - if (restore_user_regs(regs, &ucp->uc_mcontext)) + if (restore_user_regs(regs, mcp)) return -EFAULT; return 0; @@ -385,9 +385,6 @@ int sys_swapcontext(struct ucontext __user *old_ctx, || save_user_regs(regs, &old_ctx->uc_mcontext, 0) || __copy_to_user(&old_ctx->uc_sigmask, ¤t->blocked, sizeof(sigset_t)) - /* the next 2 things aren't strictly necessary */ - || __copy_to_user(&old_ctx->uc_oldsigmask, - ¤t->blocked, sizeof(sigset_t)) || __put_user(&old_ctx->uc_mcontext, &old_ctx->uc_regs)) return -EFAULT; } diff --git a/include/asm-ppc/ucontext.h b/include/asm-ppc/ucontext.h index 1d6e70c4306d3..53da26040a0e8 100644 --- a/include/asm-ppc/ucontext.h +++ b/include/asm-ppc/ucontext.h @@ -16,12 +16,11 @@ struct ucontext { struct ucontext *uc_link; stack_t uc_stack; int uc_pad[7]; - struct mcontext *uc_regs; /* backward compat */ - sigset_t uc_oldsigmask; /* backward compat */ - int uc_pad2; + struct mcontext *uc_regs; /* points to uc_mcontext field */ sigset_t uc_sigmask; /* glibc has 1024-bit signal masks, ours are 64-bit */ int uc_maskext[30]; + int uc_pad2[3]; struct mcontext uc_mcontext; }; -- 2.53.0