Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of using mce-inject

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the use of mce-inject". Friends who are interested may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the use of mce-inject?"

Mce-inject function

Mce-inject is used to test whether mcelog can correctly obtain hardware error messages and decode them correctly. Mce-inject can inject specified error messages into the kernel, so it is convenient to know whether the function of mcelog is normal.

It should be noted that when users use mce-inject tools to inject unrecoverable errors (such as fatal) into the kernel, panic reboot will occur. Of course, this phenomenon can be avoided by changing the tolerate file under the sys file system.

Tolerate file configuration

Location: / sys/devices/system/machinecheck/machinecheck*/

Note: the * number in machinecheck* is determined by the number of CPU. If it is dual-core, there are two directories, machinecheck0 and machinecheck1. There is a tolerate file in the corresponding directory, and the tolerance value is stored in tolerate.

Function: provide the user with an optional degree of tolerance (tolerate) when the corresponding hardware error occurs, for example, when the value of tolerate is 1, the fatal error will crash and restart, and the error message will not be recorded. When the value of tolerate is 3 (note that this value is used for testing only), when a fatal error occurs, the machine will tolerate the error and do not respond, there will be no panic restart, and relevant error messages will be recorded.

View tolerate

As root, go to the appropriate directory and view it. Such as:

# cd / sys/devices/system/machinecheck/machinecheck0

# cat tolerate

View the update value of CPU0.

Set up tolerate

As root, you can go to the appropriate directory and modify it. There are many ways to set tolerate, such as:

# cd / sys/devices/system/machinecheck/machinecheck0

# echo 3 > tolerate

Numerical meaning

The values of tolerate can be 0, 1, 2, 3.

0: always panic on uncorrected errors, log corrected errors

1: panic or SIGBUS on uncorrected errors, log corrected errors

2: SIGBUS or log uncorrected errors (if possible), log corrected errors

3: never panic or SIGBUS, log all errors (for testing only)

Mce-inject usage

The method of using mce-inject is also very simple, but before using it, change the value of tolerate to 3 to prevent the panic restart event, and then execute it as root on the terminal:

Mce-inject filename...

Filename stores the specific types of errors to be injected

For example, a mce-filename file correct has the following contents:

CPU 1 BANK 2

STATUS corrected

RIP 0x12341234

When executing, simply enter at the terminal:

# mce-inject. / correct

The injection can be successful, and the detailed output can be viewed in the / var/log/mcelog file.

Of course, you can write the relevant injection scripts yourself.

At this point, I believe you have a deeper understanding of "what is the use of mce-inject?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report