ACPI: OSL: Panic when encountering a fatal ACPI error
Subsystems (2)
PATCH 1/1 ACPI: OSL: Panic when encountering a fatal ACPI error
The ACPI spec states that the operating system should respond to a fatal ACPI error by "performing a controlled OS shutdown in a timely fashion". Windows complies with this requirement by entering a BSOD upon executing the "Fatal()" ASL opcode, a implementation detail that is used by some firmware implementations for signaling fatal hardware errors.
Comply with the ACPI specification by triggering a kernel panic when ACPICA signals a fatal ACPI error. Users can still disable this behavior by using the acpi.panic_on_fatal kernel option to work around firmware bugs.
--- .../admin-guide/kernel-parameters.txt | 9 +++++++++ drivers/acpi/Kconfig | 11 +++++++++++ drivers/acpi/osl.c | 18 +++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +9 -0
@@ -187,6 +187,15 @@ Kernel parameters unusable. The "log_buf_len" parameter may be useful if you need to capture more output. + acpi.panic_on_fatal= [ACPI] + {0 | 1} + Causes the kernel to panic when the ACPI bytecode signals + a fatal error. The default value of this setting can + be configured using CONFIG_ACPI_PANIC_ON_FATAL. + Overriding this value should only be done for diagnosing + ACPI firmware problems, as some firmware implementations + use this mechanism to signal fatal hardware errors. + acpi_enforce_resources= [ACPI] { strict | lax | no } Check for resource conflicts between native drivers
drivers/acpi/Kconfig +11 -0
@@ -65,6 +65,17 @@ config ACPI_THERMAL_LIB depends on THERMAL bool +config ACPI_PANIC_ON_FATAL + bool "Panic on fatal ACPI error" + default y + help + The ACPI bytecode can signal that a fatal error has occurred using the Fatal() + ASL operator, normaly causing a kernel panic. Disabling this option causes such + a condition to be treated like a ordinary ACPI error. + + This setting can also be overridden during boot using the acpi.panic_on_fatal + kernel parameter. + config ACPI_DEBUGGER bool "AML debugger interface" select ACPI_DEBUG
drivers/acpi/osl.c +17 -1
@@ -12,6 +12,7 @@#define pr_fmt (fmt) "ACPI: OSL: " fmt#include <linux/module.h> +#include <linux/panic.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/mm.h>
@@ -70,6 +71,10 @@ static bool acpi_os_initialized;unsigned int acpi_sci_irq =INVALID_ACPI_IRQ ;bool acpi_permanent_mmap = false; +static bool panic_on_fatal =CONFIG_ACPI_PANIC_ON_FATAL ; +module_param (panic_on_fatal, bool,0 ); +MODULE_PARM_DESC (panic_on_fatal,"Trigger a kernel panic when encountering a fatal ACPI error" ); +/* * This list of permanent mappings is for memory that may be accessed from * interrupt context, where we can't do the ioremap().
@@ -1381,9 +1386,20 @@ acpi_status acpi_os_notify_command_complete(void)acpi_status acpi_os_signal (u32 function,void *info) { +struct acpi_signal_fatal_info *fatal_info; +switch (function) {case ACPI_SIGNAL_FATAL : -pr_err ("Fatal opcode executed\n" ); + fatal_info = info; +if (panic_on_fatal) { +panic ("Fatal ACPI BIOS error (type 0x%X code 0x%X argument 0x%X)" , + fatal_info->type, fatal_info->code, fatal_info->argument); + }else { +pr_emerg ("Fatal ACPI BIOS error (type 0x%X code 0x%X argument 0x%X)\n" , + fatal_info->type, fatal_info->code, fatal_info->argument); +add_taint (TAINT_FIRMWARE_WORKAROUND ,LOCKDEP_STILL_OK ); + } +break ;case ACPI_SIGNAL_BREAKPOINT :/*
Signature · 1 line
2.39.5
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Armin,
kernel test robot noticed the following build errors:
[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge linus/master v6.19-rc6 next-20260123] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Armin-Wolf/ACPI-OSL-Panic-when-encountering-a-fatal-ACPI-error/20260124-102043 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20260124021859.8337-1-W_Armin%40gmx.de patch subject: [PATCH] ACPI: OSL: Panic when encountering a fatal ACPI error config: loongarch-allnoconfig (https://download.01.org/0day-ci/archive/20260124/[email protected]/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260124/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/acpi/osl.c:74:30: error: use of undeclared identifier 'CONFIG_ACPI_PANIC_ON_FATAL'
74 | static bool panic_on_fatal = CONFIG_ACPI_PANIC_ON_FATAL;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~1 error generated.
vim +/CONFIG_ACPI_PANIC_ON_FATAL +74 drivers/acpi/osl.c
73
> 74 static bool panic_on_fatal = CONFIG_ACPI_PANIC_ON_FATAL;
75 module_param(panic_on_fatal, bool, 0);
76 MODULE_PARM_DESC(panic_on_fatal, "Trigger a kernel panic when encountering a fatal ACPI error");
77 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki