提交 77eb50ae 编写于 作者: A Andreas Schwab 提交者: Paul Mackerras

powerpc: Fix msr check in compat_sys_swapcontext

The new context may not be 16-byte aligned, so the real address of the
mcontext structure should be read from the uc_regs pointer instead of
directly using the (unaligned) uc_mcontext field.
Signed-off-by: NAndreas Schwab <schwab@suse.de>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 ec5d7657
......@@ -941,9 +941,21 @@ long sys_swapcontext(struct ucontext __user *old_ctx,
#ifdef CONFIG_PPC64
unsigned long new_msr = 0;
if (new_ctx &&
get_user(new_msr, &new_ctx->uc_mcontext.mc_gregs[PT_MSR]))
return -EFAULT;
if (new_ctx) {
struct mcontext __user *mcp;
u32 cmcp;
/*
* Get pointer to the real mcontext. No need for
* access_ok since we are dealing with compat
* pointers.
*/
if (__get_user(cmcp, &new_ctx->uc_regs))
return -EFAULT;
mcp = (struct mcontext __user *)(u64)cmcp;
if (__get_user(new_msr, &mcp->mc_gregs[PT_MSR]))
return -EFAULT;
}
/*
* Check that the context is not smaller than the original
* size (with VMX but without VSX)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册