Bug 200637

Summary: ARM64: bad_mode() handler may not result in panic always due to die() call in the beginning
Product: Platform Specific/Hardware Reporter: Hari Kishore Vyas (hari.vyas)
Component: ARMAssignee: linux-arm-kernel (linux-arm-kernel)
Status: NEW ---    
Severity: normal CC: hari.vyas
Priority: P1    
Hardware: ARM   
OS: Linux   
Kernel Version: 4.17,4.18 Subsystem:
Regression: No Bisected commit-id:

Description Hari Kishore Vyas 2018-07-24 07:19:37 UTC
While analyzing one issue and code walk through, it is noticed that bad_mode() handler call may not result in panic always which it must.

asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
{
        console_verbose();

        pr_crit("Bad mode in %s handler detected on CPU%d, code 0x%08x -- %s\n",
                handler[reason], smp_processor_id(), esr,
                esr_get_class_string(esr));

        die("Oops - bad mode", regs, 0);
        local_daif_mask();
        panic("bad mode");
        restore_console_loglevel();
}

die() handler calls __die() which may not return NOTIFY_STOP always with user mode and that will result in process killing. System will continue and kernel will not panic.

Probably fix could be to remove die() call from bad_mode()
Issue is difficult to produce but code walk-through showing issue clearly.