--- zzzz-none-000/linux-4.9.279/kernel/panic.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/kernel/panic.c 2023-02-08 11:43:43.000000000 +0000 @@ -5,6 +5,11 @@ */ /* + * Includes Intel Corporation's changes/modifications dated: 2017. + * Changed/modified portions - Copyright (c) 2017, Intel Corporation. + */ + +/* * This function is used through-out the kernel (including mm and fs) * to indicate a major problem. */ @@ -26,6 +31,7 @@ #include #include #include +#include #define PANIC_TIMER_STEP 100 #define PANIC_BLINK_SPD 18 @@ -128,10 +134,15 @@ * * This function never returns. */ +#ifdef CONFIG_FULL_PANIC void panic(const char *fmt, ...) { static char buf[1024]; va_list args; +#else +void tiny_panic(int a, ...) +{ +#endif long i, i_next = 0; int state = 0; int old_cpu, this_cpu; @@ -169,16 +180,23 @@ console_verbose(); bust_spinlocks(1); + +#ifdef CONFIG_FULL_PANIC va_start(args, fmt); vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); pr_emerg("Kernel panic - not syncing: %s\n", buf); +#else + pr_emerg("Kernel panic - not syncing\n"); +#endif + #ifdef CONFIG_DEBUG_BUGVERBOSE /* * Avoid nested stack-dumping if a panic occurs during oops processing */ if (!test_taint(TAINT_DIE) && oops_in_progress <= 1) dump_stack(); + dump_event_node_stats(NULL); #endif /* @@ -212,7 +230,11 @@ * Run any panic handlers, including those that might need to * add information to the kmsg dump output. */ +#ifdef CONFIG_FULL_PANIC atomic_notifier_call_chain(&panic_notifier_list, 0, buf); +#else + atomic_notifier_call_chain(&panic_notifier_list, 0, ""); +#endif /* Call flush even twice. It tries harder with a single online CPU */ printk_nmi_flush_on_panic(); @@ -289,7 +311,11 @@ disabled_wait(caller); } #endif +#ifdef CONFIG_FULL_PANIC pr_emerg("---[ end Kernel panic - not syncing: %s\n", buf); +#else + pr_emerg("---[ end Kernel panic - not syncing\n"); +#endif local_irq_enable(); for (i = 0; ; i += PANIC_TIMER_STEP) { touch_softlockup_watchdog(); @@ -301,8 +327,11 @@ } } +#ifdef CONFIG_FULL_PANIC EXPORT_SYMBOL(panic); - +#else +EXPORT_SYMBOL(tiny_panic); +#endif struct tnt { u8 bit; @@ -600,6 +629,9 @@ */ __visible void __stack_chk_fail(void) { + if (IS_ENABLED(CONFIG_CC_STACKPROTECTOR_BUG_ON_FAIL)) + BUG(); + panic("stack-protector: Kernel stack is corrupted in: %p\n", __builtin_return_address(0)); }