3 ms·
>Various interfaces make it straightforward for root to modify kernel code (such as loading modules or using /dev/mem), while others make it less straightforwar
by bogomipz 7y ago
>Various interfaces make it straightforward for root to modify kernel code (such as loading modules or using /dev/mem), while others make it less straightforward (being able to load new ACPI tables that can cause the ACPI interpreter to overwrite the kernel, for instance).
What exactly is the "ACPI interpreter" referenced here? I am familiar with ACPI but this is the first tine I have heard this term.
- detaro 7y agoACPI tables contain byte code (AML), which needs to be interpreted by the kernel.
- dirtydroog 7y agoIt's amazing. A ring 0 bytecode interpreter.
- matheusmoreira 7y agoACPI contains code! https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-system-description-tables https://docs.microsoft.com/en-us/windows-hardware/drivers/br... > ACPI defines an interpreted language (ACPI source language, or ASL) and an execution environment (ACPI virtual machine) for describing system devices and features, and their platform-specific controls, in an OS-agnostic way. > ASL is used to define named objects in the ACPI namespace, and the Microsoft ASL compiler is used to produce ACPI machine language (AML) byte code for transmission to the operating system in the DSDT. Linux drivers run this code via the acpi_evaluate_* functions. https://lwn.net/Articles/367630/ https://lwn.net/Articles/367630/ Microsoft defined another interface on top of ACPI called WMI. Unfortunately it seems to be widely used. https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/implementing-wmi https://docs.microsoft.com/en-us/windows-hardware/drivers/ke... https://lwn.net/Articles/391230/ https://lwn.net/Articles/391230/ On Linux it's easy to extract and decompile the DSDT: $ cat /sys/firmware/acpi/tables/DSDT > dsdt.dat $ iasl -d dsdt.dat https://wiki.archlinux.org/index.php/DSDT https://wiki.archlinux.org/index.php/DSDT
- segfaultbuserr 7y agoACPI is powered by a Turing-complete programming language. It compiles to the ACPI Machine Language, which is an assembly language executed on the ACPI virtual machine, a.k.a. the ACPI interpreter. The power management actions are actually the result of executing the living code. The justification is that it enables a lot of flexibility to adopt ACPI on different types hardware, without the limitation of being purely a configuration file. Also, the complicated power management code can be operated by the OS kernel, without writing any specific driver or calling into BIOS. Naturally its power faced a lot of criticisms. Technically, you can decide what your power button does based on the next digit of pi. This is why Mark Shuttleworth called ACPI a Trojan horse and Linus Torvalds called ACPI brain-damaged. Broken power management is often the result of low code quality. In the Hackintosh community (and Linux to a less extent), discompiling the DSDT table and manually fixing all the compiler warnings and bugs in the code is a critical step to get proper power management running.