mirror of
https://github.com/adulau/aha.git
synced 2024-12-31 21:26:18 +00:00
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: Andreas Schwab <schwab@suse.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
ec5d7657f7
commit
77eb50aefa
1 changed files with 15 additions and 3 deletions
|
@ -941,9 +941,21 @@ long sys_swapcontext(struct ucontext __user *old_ctx,
|
||||||
#ifdef CONFIG_PPC64
|
#ifdef CONFIG_PPC64
|
||||||
unsigned long new_msr = 0;
|
unsigned long new_msr = 0;
|
||||||
|
|
||||||
if (new_ctx &&
|
if (new_ctx) {
|
||||||
get_user(new_msr, &new_ctx->uc_mcontext.mc_gregs[PT_MSR]))
|
struct mcontext __user *mcp;
|
||||||
return -EFAULT;
|
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
|
* Check that the context is not smaller than the original
|
||||||
* size (with VMX but without VSX)
|
* size (with VMX but without VSX)
|
||||||
|
|
Loading…
Reference in a new issue