--- zzzz-none-000/linux-5.4.213/kernel/panic.c 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/kernel/panic.c 2024-08-14 09:02:11.000000000 +0000 @@ -33,6 +33,13 @@ #include #include +#if defined(CONFIG_AVM_FASTIRQ) +#include +#include +#endif /* CONFIG_AVM FASTIRQ */ +#include +#include + #define PANIC_TIMER_STEP 100 #define PANIC_BLINK_SPD 18 @@ -172,6 +179,32 @@ int state = 0; int old_cpu, this_cpu; bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers; +#if defined(CONFIG_AVM_FASTIRQ) + struct pt_regs *pregs = NULL; +#endif + + avm_set_reset_status(RS_PANIC); + +#if defined(CONFIG_AVM_FASTIRQ) + if (avm_is_rte_crash_handling_enabled()) { + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + switch (avm_rte_panic(buf)) { + case AVM_RTE_DIE_CALL_DIE: + pregs = collect_pregs(); + die(buf, pregs, 0); + break; + case AVM_RTE_DIE_TRIGGER_WD: + __set_ICDISPR(get_wdt_int(), 1, 0); + while (1) + ; + break; + case AVM_RTE_DIE_CONTINUE: + break; + } + } +#endif /* CONFIG_AVM_FASTIRQ */ /* * Disable local interrupts. This will prevent panic_smp_self_stop @@ -664,6 +697,9 @@ */ __visible void __stack_chk_fail(void) { +#ifdef CONFIG_STACKPROTECTOR_BUG_ON_FAIL + BUG(); +#endif panic("stack-protector: Kernel stack is corrupted in: %pB", __builtin_return_address(0)); }