exit: Remove calls of do_exit after noreturn versions of die
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 20 Oct 2021 17:43:48 +0000 (12:43 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 20 Oct 2021 18:09:47 +0000 (13:09 -0500)
On nds32, openrisc, s390, sh, and xtensa the function die never
returns.  Mark die __noreturn so that no one expects die to return.
Remove the do_exit calls after die as they will never be reached.

Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Stafford Horne <shorne@gmail.com>
Cc: openrisc@lists.librecores.org
Cc: Nick Hu <nickhu@andestech.com>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: linux-s390@vger.kernel.org
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
Cc: linux-xtensa@linux-xtensa.org
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Fixes: 2.3.16
Fixes: 2.3.99-pre8
Fixes: 3f65ce4d141e ("[PATCH] xtensa: Architecture support for Tensilica Xtensa Part 5")
Fixes: 664eec400bf8 ("nds32: MMU fault handling and page table management")
Fixes: 61e85e367535 ("OpenRISC: Memory management")
Link: https://lkml.kernel.org/r/20211020174406.17889-2-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
arch/nds32/kernel/traps.c
arch/nds32/mm/fault.c
arch/openrisc/kernel/traps.c
arch/openrisc/mm/fault.c
arch/s390/include/asm/kdebug.h
arch/s390/kernel/dumpstack.c
arch/s390/mm/fault.c
arch/sh/kernel/traps.c
arch/sh/mm/fault.c
arch/xtensa/kernel/traps.c
arch/xtensa/mm/fault.c

index f06421c645aff15a9b00d77cf9c993890f9fe176..ca75d475eda4fe94834a782a3088aa132505402f 100644 (file)
@@ -118,7 +118,7 @@ DEFINE_SPINLOCK(die_lock);
 /*
  * This function is protected against re-entrancy.
  */
-void die(const char *str, struct pt_regs *regs, int err)
+void __noreturn die(const char *str, struct pt_regs *regs, int err)
 {
        struct task_struct *tsk = current;
        static int die_counter;
index f02524eb6d567ff0c0a72671e0142492b5776e7b..1d139b11716877a5001b53dcf063221e7ed8074b 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <asm/tlbflush.h>
 
-extern void die(const char *str, struct pt_regs *regs, long err);
+extern void __noreturn die(const char *str, struct pt_regs *regs, long err);
 
 /*
  * This is useful to dump out the page tables associated with
@@ -299,10 +299,6 @@ no_context:
 
        show_pte(mm, addr);
        die("Oops", regs, error_code);
-       bust_spinlocks(0);
-       do_exit(SIGKILL);
-
-       return;
 
        /*
         * We ran out of memory, or some other thing happened to us that made
index aa1e709405acd92bec654955f53b9b8aff3404c9..0898cb159faca5a387434d0eab58c21f0583b442 100644 (file)
@@ -197,7 +197,7 @@ void nommu_dump_state(struct pt_regs *regs,
 }
 
 /* This is normally the 'Oops' routine */
-void die(const char *str, struct pt_regs *regs, long err)
+void __noreturn die(const char *str, struct pt_regs *regs, long err)
 {
 
        console_verbose();
index c730d1a516867608e069d01f916b69deb6f5e14f..f0fa6394a58ec52f089c31970724f3630740bc2e 100644 (file)
@@ -32,7 +32,7 @@ unsigned long pte_errors;     /* updated by do_page_fault() */
  */
 volatile pgd_t *current_pgd[NR_CPUS];
 
-extern void die(char *, struct pt_regs *, long);
+extern void __noreturn die(char *, struct pt_regs *, long);
 
 /*
  * This routine handles page faults.  It determines the address,
@@ -248,8 +248,6 @@ no_context:
 
        die("Oops", regs, write_acc);
 
-       do_exit(SIGKILL);
-
        /*
         * We ran out of memory, or some other thing happened to us that made
         * us unable to handle the page fault gracefully.
index d5327f0647995c7d676a01bb02a1aa7c7e32d138..4377238e475240977808e8b5b1f6fd86c72995df 100644 (file)
@@ -23,6 +23,6 @@ enum die_val {
        DIE_NMI_IPI,
 };
 
-extern void die(struct pt_regs *, const char *);
+extern void __noreturn die(struct pt_regs *, const char *);
 
 #endif
index db1bc00229caf20f04d8ee8275598536c390f70b..f45e66b8bed68a7c90f37fe25c0ef06064cde79e 100644 (file)
@@ -192,7 +192,7 @@ void show_regs(struct pt_regs *regs)
 
 static DEFINE_SPINLOCK(die_lock);
 
-void die(struct pt_regs *regs, const char *str)
+void __noreturn die(struct pt_regs *regs, const char *str)
 {
        static int die_counter;
 
index 212632d57db9c9cfd91be9acd55a5e281ece479c..d30f5986fa8567ccabef68391984f9c2899086f2 100644 (file)
@@ -260,7 +260,6 @@ static noinline void do_no_context(struct pt_regs *regs)
                       " in virtual user address space\n");
        dump_fault_info(regs);
        die(regs, "Oops");
-       do_exit(SIGKILL);
 }
 
 static noinline void do_low_address(struct pt_regs *regs)
@@ -270,7 +269,6 @@ static noinline void do_low_address(struct pt_regs *regs)
        if (regs->psw.mask & PSW_MASK_PSTATE) {
                /* Low-address protection hit in user mode 'cannot happen'. */
                die (regs, "Low-address protection");
-               do_exit(SIGKILL);
        }
 
        do_no_context(regs);
index e76b221570999776e3bc9276d6b2fd60b9132e94..cbe3201d4f21cee2f06e414dbe0efec263ef9ca7 100644 (file)
@@ -20,7 +20,7 @@
 
 static DEFINE_SPINLOCK(die_lock);
 
-void die(const char *str, struct pt_regs *regs, long err)
+void __noreturn die(const char *str, struct pt_regs *regs, long err)
 {
        static int die_counter;
 
index 88a1f453d73e1e45af4cc2cdaf75a89a09b23e9d..1e1aa75df3cad101f63af0fef064daa9313cafe0 100644 (file)
@@ -238,8 +238,6 @@ no_context(struct pt_regs *regs, unsigned long error_code,
        show_fault_oops(regs, address);
 
        die("Oops", regs, error_code);
-       bust_spinlocks(0);
-       do_exit(SIGKILL);
 }
 
 static void
index 874b6efc6fb3193ee0aacd1ed7c6f36f8d930cd0..fb056a1913397ec50a135f1baad7b612c78fbe8b 100644 (file)
@@ -527,7 +527,7 @@ void show_stack(struct task_struct *task, unsigned long *sp, const char *loglvl)
 
 DEFINE_SPINLOCK(die_lock);
 
-void die(const char * str, struct pt_regs * regs, long err)
+void __noreturn die(const char * str, struct pt_regs * regs, long err)
 {
        static int die_counter;
        const char *pr = "";
index 95a74890c7e995ebc3313d9fafa0f54800c705d5..fd6a706359625868aa12ccc838b906b2dbf682e2 100644 (file)
@@ -238,7 +238,7 @@ bad_page_fault:
 void
 bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
 {
-       extern void die(const char*, struct pt_regs*, long);
+       extern void __noreturn die(const char*, struct pt_regs*, long);
        const struct exception_table_entry *entry;
 
        /* Are we prepared to handle this kernel fault?  */
@@ -257,5 +257,4 @@ bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
                 "address %08lx\n pc = %08lx, ra = %08lx\n",
                 address, regs->pc, regs->areg[0]);
        die("Oops", regs, sig);
-       do_exit(sig);
 }