From c31333b91a316ccea014e86db235d624178e01be Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Wed, 20 Dec 2006 13:57:06 +1100 Subject: [PATCH] --- yaml --- r: 44766 b: refs/heads/master c: 1c9bb1a01ac1bc92a0d98cf3e40a7922ee684dc0 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/powerpc/kernel/signal_32.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 6a358742bcb8..6f8c980db7ff 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bb63ab13515951f4d09b16c9e8bd6e50b0f20d1e +refs/heads/master: 1c9bb1a01ac1bc92a0d98cf3e40a7922ee684dc0 diff --git a/trunk/arch/powerpc/kernel/signal_32.c b/trunk/arch/powerpc/kernel/signal_32.c index e4ebe1a6228e..6b405a3f43f9 100644 --- a/trunk/arch/powerpc/kernel/signal_32.c +++ b/trunk/arch/powerpc/kernel/signal_32.c @@ -835,11 +835,21 @@ long sys_swapcontext(struct ucontext __user *old_ctx, return -EINVAL; if (old_ctx != NULL) { + struct mcontext __user *mctx; + + /* + * old_ctx might not be 16-byte aligned, in which + * case old_ctx->uc_mcontext won't be either. + * Because we have the old_ctx->uc_pad2 field + * before old_ctx->uc_mcontext, we need to round down + * from &old_ctx->uc_mcontext to a 16-byte boundary. + */ + mctx = (struct mcontext __user *) + ((unsigned long) &old_ctx->uc_mcontext & ~0xfUL); if (!access_ok(VERIFY_WRITE, old_ctx, sizeof(*old_ctx)) - || save_user_regs(regs, &old_ctx->uc_mcontext, 0) + || save_user_regs(regs, mctx, 0) || put_sigset_t(&old_ctx->uc_sigmask, ¤t->blocked) - || __put_user(to_user_ptr(&old_ctx->uc_mcontext), - &old_ctx->uc_regs)) + || __put_user(to_user_ptr(mctx), &old_ctx->uc_regs)) return -EFAULT; } if (new_ctx == NULL)