]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
signal/powerpc: Call _exception_pkey directly from bad_key_fault_exception
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 18 Sep 2018 07:14:49 +0000 (09:14 +0200)
committerEric W. Biederman <ebiederm@xmission.com>
Fri, 21 Sep 2018 13:49:04 +0000 (15:49 +0200)
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>
arch/powerpc/mm/fault.c

index e5725fa96a4811f337f13b84414fbbbbd15ca11b..5afc1ee55043aecec04a5efdb6ecff70a4abf235 100644 (file)
@@ -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)