--- zzzz-none-000/linux-5.15.111/kernel/panic.c 2023-05-11 14:00:40.000000000 +0000 +++ puma7-atom-6670-761/linux-5.15.111/kernel/panic.c 2024-02-07 10:23:28.000000000 +0000 @@ -6,6 +6,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. */ @@ -34,6 +39,7 @@ #include #include #include +#include #define PANIC_TIMER_STEP 100 #define PANIC_BLINK_SPD 18 @@ -242,11 +248,17 @@ * * This function never returns. */ +#ifdef CONFIG_FULL_PANIC void panic(const char *fmt, ...) { static char buf[1024]; va_list args; - long i, i_next = 0, len; + long len; +#else +void tiny_panic(int a, ...) +{ +#endif + long i, i_next = 0; int state = 0; int old_cpu, this_cpu; bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers; @@ -293,6 +305,8 @@ console_verbose(); bust_spinlocks(1); + +#ifdef CONFIG_FULL_PANIC va_start(args, fmt); len = vscnprintf(buf, sizeof(buf), fmt, args); va_end(args); @@ -301,20 +315,27 @@ buf[len - 1] = '\0'; 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 +#ifdef CONFIG_FULL_PANIC /* * If kgdb is enabled, give it a chance to run before we stop all * the other CPUs or else we won't be able to debug processes left * running on them. */ kgdb_panic(buf); +#endif /* * If we have crashed and we have a crash kernel loaded let it handle @@ -346,7 +367,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 kmsg_dump(KMSG_DUMP_PANIC); @@ -421,7 +446,11 @@ #if defined(CONFIG_S390) disabled_wait(); #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 /* Do not scroll important messages printed above */ suppress_printk = 1; @@ -436,7 +465,11 @@ } } +#ifdef CONFIG_FULL_PANIC EXPORT_SYMBOL(panic); +#else +EXPORT_SYMBOL(tiny_panic); +#endif /* * TAINT_FORCED_RMMOD could be a per-module flag but the module @@ -461,6 +494,7 @@ [ TAINT_LIVEPATCH ] = { 'K', ' ', true }, [ TAINT_AUX ] = { 'X', ' ', true }, [ TAINT_RANDSTRUCT ] = { 'T', ' ', true }, + }; /** @@ -749,6 +783,9 @@ */ __visible noinstr void __stack_chk_fail(void) { + if (IS_ENABLED(CONFIG_CC_STACKPROTECTOR_BUG_ON_FAIL)) + BUG(); + instrumentation_begin(); panic("stack-protector: Kernel stack is corrupted in: %pB", __builtin_return_address(0));