summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2018-09-18 09:14:49 +0200
committerEric W. Biederman <ebiederm@xmission.com>2018-09-21 15:49:04 +0200
commit8eb2ba25e3c8a9928f10f19311911d556ca16795 (patch)
tree921eab6f481b054f0fbc408b414ab18010113595
parent9f2ee693890a8dea723cf789622004cbb75959f8 (diff)
downloadlinux-stable-8eb2ba25e3c8a9928f10f19311911d556ca16795.tar.gz
linux-stable-8eb2ba25e3c8a9928f10f19311911d556ca16795.tar.bz2
linux-stable-8eb2ba25e3c8a9928f10f19311911d556ca16795.zip
signal/powerpc: Call _exception_pkey directly from bad_key_fault_exception
This removes the need for other code paths to deal with pkey exceptions. Reviewed-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
-rw-r--r--arch/powerpc/mm/fault.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index e5725fa96a48..5afc1ee55043 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -145,7 +145,17 @@ static noinline int bad_area(struct pt_regs *regs, unsigned long address)
static int bad_key_fault_exception(struct pt_regs *regs, unsigned long address,
int pkey)
{
- return __bad_area_nosemaphore(regs, address, SEGV_PKUERR, pkey);
+ /*
+ * If we are in kernel mode, bail out with a SEGV, this will
+ * be caught by the assembly which will restore the non-volatile
+ * registers before calling bad_page_fault()
+ */
+ if (!user_mode(regs))
+ return SIGSEGV;
+
+ _exception_pkey(SIGSEGV, regs, SEGV_PKUERR, address, pkey);
+
+ return 0;
}
static noinline int bad_access(struct pt_regs *regs, unsigned long address)