You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
exit: Add and use make_task_dead.
There are two big uses of do_exit. The first is it's design use to be the guts of the exit(2) system call. The second use is to terminate a task after something catastrophic has happened like a NULL pointer in kernel code. Add a function make_task_dead that is initialy exactly the same as do_exit to cover the cases where do_exit is called to handle catastrophic failure. In time this can probably be reduced to just a light wrapper around do_task_dead. For now keep it exactly the same so that there will be no behavioral differences introducing this new concept. Replace all of the uses of do_exit that use it for catastraphic task cleanup with make_task_dead to make it clear what the code is doing. As part of this rename rewind_stack_do_exit rewind_stack_and_make_dead. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
@@ -190,7 +190,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15)
|
||||
local_irq_enable();
|
||||
while (1);
|
||||
}
|
||||
do_exit(SIGSEGV);
|
||||
make_task_dead(SIGSEGV);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_MATHEMU
|
||||
@@ -575,7 +575,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
|
||||
|
||||
printk("Bad unaligned kernel access at %016lx: %p %lx %lu\n",
|
||||
pc, va, opcode, reg);
|
||||
do_exit(SIGSEGV);
|
||||
make_task_dead(SIGSEGV);
|
||||
|
||||
got_exception:
|
||||
/* Ok, we caught the exception, but we don't want it. Is there
|
||||
@@ -630,7 +630,7 @@ got_exception:
|
||||
local_irq_enable();
|
||||
while (1);
|
||||
}
|
||||
do_exit(SIGSEGV);
|
||||
make_task_dead(SIGSEGV);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -204,7 +204,7 @@ retry:
|
||||
printk(KERN_ALERT "Unable to handle kernel paging request at "
|
||||
"virtual address %016lx\n", address);
|
||||
die_if_kernel("Oops", regs, cause, (unsigned long*)regs - 16);
|
||||
do_exit(SIGKILL);
|
||||
make_task_dead(SIGKILL);
|
||||
|
||||
/* We ran out of memory, or some other thing happened to us that
|
||||
made us unable to handle the page fault gracefully. */
|
||||
|
||||
@@ -333,7 +333,7 @@ static void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
|
||||
if (panic_on_oops)
|
||||
panic("Fatal exception");
|
||||
if (signr)
|
||||
do_exit(signr);
|
||||
make_task_dead(signr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -111,7 +111,7 @@ static void die_kernel_fault(const char *msg, struct mm_struct *mm,
|
||||
show_pte(KERN_ALERT, mm, addr);
|
||||
die("Oops", regs, fsr);
|
||||
bust_spinlocks(0);
|
||||
do_exit(SIGKILL);
|
||||
make_task_dead(SIGKILL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -235,7 +235,7 @@ void die(const char *str, struct pt_regs *regs, int err)
|
||||
raw_spin_unlock_irqrestore(&die_lock, flags);
|
||||
|
||||
if (ret != NOTIFY_STOP)
|
||||
do_exit(SIGSEGV);
|
||||
make_task_dead(SIGSEGV);
|
||||
}
|
||||
|
||||
static void arm64_show_signal(int signo, const char *str)
|
||||
|
||||
@@ -302,7 +302,7 @@ static void die_kernel_fault(const char *msg, unsigned long addr,
|
||||
show_pte(addr);
|
||||
die("Oops", regs, esr);
|
||||
bust_spinlocks(0);
|
||||
do_exit(SIGKILL);
|
||||
make_task_dead(SIGKILL);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KASAN_HW_TAGS
|
||||
|
||||
@@ -294,7 +294,7 @@ bad_area:
|
||||
__func__, opcode, rz, rx, imm, addr);
|
||||
show_regs(regs);
|
||||
bust_spinlocks(0);
|
||||
do_exit(SIGKILL);
|
||||
make_dead_task(SIGKILL);
|
||||
}
|
||||
|
||||
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)addr);
|
||||
|
||||
@@ -109,7 +109,7 @@ void die(struct pt_regs *regs, const char *str)
|
||||
if (panic_on_oops)
|
||||
panic("Fatal exception");
|
||||
if (ret != NOTIFY_STOP)
|
||||
do_exit(SIGSEGV);
|
||||
make_dead_task(SIGSEGV);
|
||||
}
|
||||
|
||||
void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr)
|
||||
|
||||
@@ -67,7 +67,7 @@ static inline void no_context(struct pt_regs *regs, unsigned long addr)
|
||||
pr_alert("Unable to handle kernel paging request at virtual "
|
||||
"addr 0x%08lx, pc: 0x%08lx\n", addr, regs->pc);
|
||||
die(regs, "Oops");
|
||||
do_exit(SIGKILL);
|
||||
make_task_dead(SIGKILL);
|
||||
}
|
||||
|
||||
static inline void mm_fault_error(struct pt_regs *regs, unsigned long addr, vm_fault_t fault)
|
||||
|
||||
@@ -106,7 +106,7 @@ void die(const char *str, struct pt_regs *fp, unsigned long err)
|
||||
dump(fp);
|
||||
|
||||
spin_unlock_irq(&die_lock);
|
||||
do_exit(SIGSEGV);
|
||||
make_dead_task(SIGSEGV);
|
||||
}
|
||||
|
||||
static int kstack_depth_to_print = 24;
|
||||
|
||||
@@ -51,7 +51,7 @@ asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
|
||||
printk(" at virtual address %08lx\n", address);
|
||||
if (!user_mode(regs))
|
||||
die("Oops", regs, error_code);
|
||||
do_exit(SIGKILL);
|
||||
make_dead_task(SIGKILL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ int die(const char *str, struct pt_regs *regs, long err)
|
||||
panic("Fatal exception");
|
||||
|
||||
oops_exit();
|
||||
do_exit(err);
|
||||
make_dead_task(err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr)
|
||||
spin_unlock(&mca_bh_lock);
|
||||
|
||||
/* This process is about to be killed itself */
|
||||
do_exit(SIGKILL);
|
||||
make_task_dead(SIGKILL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -85,7 +85,7 @@ die (const char *str, struct pt_regs *regs, long err)
|
||||
if (panic_on_oops)
|
||||
panic("Fatal exception");
|
||||
|
||||
do_exit(SIGSEGV);
|
||||
make_task_dead(SIGSEGV);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ retry:
|
||||
regs = NULL;
|
||||
bust_spinlocks(0);
|
||||
if (regs)
|
||||
do_exit(SIGKILL);
|
||||
make_task_dead(SIGKILL);
|
||||
return;
|
||||
|
||||
out_of_memory:
|
||||
|
||||
@@ -1131,7 +1131,7 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr)
|
||||
pr_crit("%s: %08x\n", str, nr);
|
||||
show_registers(fp);
|
||||
add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
|
||||
do_exit(SIGSEGV);
|
||||
make_task_dead(SIGSEGV);
|
||||
}
|
||||
|
||||
asmlinkage void set_esp0(unsigned long ssp)
|
||||
|
||||
@@ -48,7 +48,7 @@ int send_fault_sig(struct pt_regs *regs)
|
||||
pr_alert("Unable to handle kernel access");
|
||||
pr_cont(" at virtual address %p\n", addr);
|
||||
die_if_kernel("Oops", regs, 0 /*error_code*/);
|
||||
do_exit(SIGKILL);
|
||||
make_task_dead(SIGKILL);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -44,10 +44,10 @@ void die(const char *str, struct pt_regs *fp, long err)
|
||||
pr_warn("Oops: %s, sig: %ld\n", str, err);
|
||||
show_regs(fp);
|
||||
spin_unlock_irq(&die_lock);
|
||||
/* do_exit() should take care of panic'ing from an interrupt
|
||||
/* make_task_dead() should take care of panic'ing from an interrupt
|
||||
* context so we don't handle it here
|
||||
*/
|
||||
do_exit(err);
|
||||
make_task_dead(err);
|
||||
}
|
||||
|
||||
/* for user application debugging */
|
||||
|
||||
@@ -422,7 +422,7 @@ void __noreturn die(const char *str, struct pt_regs *regs)
|
||||
if (regs && kexec_should_crash(current))
|
||||
crash_kexec(regs);
|
||||
|
||||
do_exit(sig);
|
||||
make_task_dead(sig);
|
||||
}
|
||||
|
||||
extern struct exception_table_entry __start___dbe_table[];
|
||||
|
||||
@@ -223,7 +223,7 @@ inline void handle_fpu_exception(struct pt_regs *regs)
|
||||
}
|
||||
} else if (fpcsr & FPCSR_mskRIT) {
|
||||
if (!user_mode(regs))
|
||||
do_exit(SIGILL);
|
||||
make_task_dead(SIGILL);
|
||||
si_signo = SIGILL;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user