Linux is getting a tool that crashes your system on purpose

The Linux 7.5 source tree will introduce a new tool called hwpoison-panic that deliberately induces certain memory issues in your computer to cause a crash.Developers can use the tool to test the Linux kernel and ensure it crashes when expected Add How-To Geek on Google Add as Preferred Source Follow on Google Discover According to the release notes on the Linux Kernel Archives, hwpoison-panic "picks a kernel-owned PFN and writes its physical address to hard_offline_page.Three page kinds are selectable with -k: rodata (default), slab or pgtable.

In all cases, the host should panic.It tests that the vm.panic_on_unrecoverable_memory_failure properly triggers an immediate kernel panic when certain types of kernel memory suffer an unrecoverable error.Developers can inject these errors to test the response without waiting for an actual hardware failure.

"The hwpoison-panic tool to intentionally trigger the kernel panic injects a hardware poison error on a kernel owned page with the ability to target the kernel read-only data "rodata" range, a slab page, or a page-table page.Successfully running the tool will crash the running kernel and thus the argument is also needed to avoid accidentally triggering this tool," Phoronix explains.The reason you'd use this tool is that continuing to use your computer after hardware failure can be much worse than a simple crash.

If damaged memory holds any essential kernel data, it can cause the system to behave unexpectedly or corrupt your data.A kernel panic is a crash response that stops your computer from performing any functions that could continue to corrupt your data.A crash can also provide important diagnostic data to help isolate the underlying problems, depending on your setup.

How to use hwpoison-panic The Linux Kernel Archives provides an example of what the tool looks like in action."Example: # ./hwpoison-panic -k slab --yes-panic-my-kernel injecting hwpoison at phys 0x100032000 (pfn 0x100032, kind=slab) expecting kernel panic: 'Memory failure: : unrecoverable page' In dmesg," it said."You will see: Memory failure: 0x100032: unhandlable page.

Memory failure: 0x100032: recovery action for reserved kernel page: Ignored Kernel panic — not syncing: Memory failure: 0x100032: unrecoverable page.This lives in tools/mm rather than selftests/mm because every successful run crashes the machine, which is not something to run from CI.In plainer English, this means you use a command to run the tool and select a kernel memory to target.

It will then simulate a memory failure (the longer hexadecimal numbers mark the location of the faulty memory).After this, you should get results that indicate an unrecoverable memory failure, followed by a kernel panic.If the system crashes, it generally means the test worked.

Related Ubuntu doesn't care enough about desktop users, and Linux Mint is the proof Ubuntu could be doing a ton of stuff better.Posts 30 By  Arol Wright Because the tool brings down your entire system, developers should avoid using it as part of regular routine tests.Instead, developers use this niche tool for specific memory failure tests.

It's mainly used to test virtual machines, where devs can record diagnostic messages to confirm that the kernel crashed.Developers can rerun the test whenever Linux updates to check that their system still stops when these memory errors occur.Source: Phoronix via The Linux Kernel Archives.org

Read More
Related Posts