--- zzzz-none-000/linux-5.15.111/kernel/panic.c 2023-05-11 14:00:40.000000000 +0000 +++ puma7-arm-6670-761/linux-5.15.111/kernel/panic.c 2024-02-07 09:28:08.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. */ @@ -242,11 +247,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 +304,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,6 +314,10 @@ 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 @@ -309,12 +326,14 @@ dump_stack(); #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 +365,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,11 +444,15 @@ #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; - local_irq_enable(); + //local_irq_enable(); for (i = 0; ; i += PANIC_TIMER_STEP) { touch_softlockup_watchdog(); if (i >= i_next) { @@ -435,8 +462,11 @@ mdelay(PANIC_TIMER_STEP); } } - +#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 @@ -749,6 +779,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));