--- zzzz-none-000/linux-4.9.276/kernel/panic.c 2021-07-20 14:21:16.000000000 +0000 +++ falcon-5530-750/linux-4.9.276/kernel/panic.c 2023-04-05 08:19:02.000000000 +0000 @@ -26,11 +26,20 @@ #include #include #include +#include #define PANIC_TIMER_STEP 100 #define PANIC_BLINK_SPD 18 +#if defined(CONFIG_AVM_ENHANCED) && defined(CONFIG_TFFS_PANIC_LOG) +#include +#include + +int panic_on_oops = 1; +#else int panic_on_oops = CONFIG_PANIC_ON_OOPS_VALUE; +#endif /* AVM_ENHANCED && CONFIG_TFFS_PANIC_LOG */ + static unsigned long tainted_mask; static int pause_on_oops; static int pause_on_oops_flag; @@ -600,6 +609,9 @@ */ __visible void __stack_chk_fail(void) { +#ifdef CONFIG_CC_STACKPROTECTOR_BUG_ON_FAIL + BUG(); +#endif panic("stack-protector: Kernel stack is corrupted in: %p\n", __builtin_return_address(0)); } @@ -607,6 +619,17 @@ #endif +#ifdef CONFIG_ARCH_HAS_REFCOUNT +void refcount_error_report(struct pt_regs *regs, const char *err) +{ + WARN_RATELIMIT(1, "refcount_t %s at %pB in %s[%d], uid/euid: %u/%u\n", + err, (void *)instruction_pointer(regs), + current->comm, task_pid_nr(current), + from_kuid_munged(&init_user_ns, current_uid()), + from_kuid_munged(&init_user_ns, current_euid())); +} +#endif + core_param(panic, panic_timeout, int, 0644); core_param(pause_on_oops, pause_on_oops, int, 0644); core_param(panic_on_warn, panic_on_warn, int, 0644);