Thread (4 messages) flat view 4 messages, 3 authors, 2021-02-11

Re: Declaring unrecoverable_exception() as __noreturn ?

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2021-02-11 04:43:29

Nicholas Piggin [off-list ref] writes:
Excerpts from Christophe Leroy's message of February 11, 2021 2:44 am:
quoted
As far as I can see, almost all callers of unrecoverable_exception() expect it to never return.

Can we mark it __noreturn ?
I don't see why not, do_exit is noreturn. We could make die() noreturn 
as well.
I'm always nervous about that, because we can return if a debugger is
involved:

DEFINE_INTERRUPT_HANDLER(unrecoverable_exception)
{
	pr_emerg("Unrecoverable exception %lx at %lx (msr=%lx)\n",
		 regs->trap, regs->nip, regs->msr);
	die("Unrecoverable exception", regs, SIGABRT);
}

void die(const char *str, struct pt_regs *regs, long err)
{
	unsigned long flags;

	/*
	 * system_reset_excption handles debugger, crash dump, panic, for 0x100
	 */
	if (TRAP(regs) != 0x100) {
		if (debugger(regs))
			return;


We obviously don't want to optimise for that case, but it worries me
slightly if we're marking things noreturn when they can actually return.

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help