]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
signal/powerpc: Factor the common exception code into exception_common
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 18 Sep 2018 07:37:28 +0000 (09:37 +0200)
committerEric W. Biederman <ebiederm@xmission.com>
Fri, 21 Sep 2018 13:50:26 +0000 (15:50 +0200)
It is brittle and wrong to populate si_pkey when there was not a pkey
exception.  The field does not exist for all si_codes and in some
cases another field exists in the same memory location.

So factor out the code that all exceptions handlers must run
into exception_common, leaving the individual exception handlers
to generate the signals themselves.

Reviewed-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
arch/powerpc/kernel/traps.c

index f651fa91cdc96c9bc96c07291b8ac47a197c2046..f6c778b5144faa7e7114d40aec508bbfdae05d1f 100644 (file)
@@ -338,14 +338,12 @@ static void show_signal_msg(int signr, struct pt_regs *regs, int code,
        show_user_instructions(regs);
 }
 
-void _exception_pkey(int signr, struct pt_regs *regs, int code,
-                    unsigned long addr, int key)
+static bool exception_common(int signr, struct pt_regs *regs, int code,
+                             unsigned long addr)
 {
-       siginfo_t info;
-
        if (!user_mode(regs)) {
                die("Exception in kernel mode", regs, signr);
-               return;
+               return false;
        }
 
        show_signal_msg(signr, regs, code, addr);
@@ -361,6 +359,16 @@ void _exception_pkey(int signr, struct pt_regs *regs, int code,
         */
        thread_pkey_regs_save(&current->thread);
 
+       return true;
+}
+
+void _exception_pkey(int signr, struct pt_regs *regs, int code, unsigned long addr, int key)
+{
+       siginfo_t info;
+
+       if (!exception_common(signr, regs, code, addr))
+               return;
+
        clear_siginfo(&info);
        info.si_signo = signr;
        info.si_code = code;