From: Eric W. Biederman Date: Tue, 18 Sep 2018 07:14:49 +0000 (+0200) Subject: signal/powerpc: Call _exception_pkey directly from bad_key_fault_exception X-Git-Tag: v5.4-rc1~2401^2~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8eb2ba25e3c8a9928f10f19311911d556ca16795;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: "Eric W. Biederman" --- diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index e5725fa..5afc1ee 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)