Documentation/fault-injection/provoke-crashes.rst GitHub 원문 ↗

Linux 6.18.37 · Fault Injection

Provoking crashes with Linux Kernel Dump Test Module (LKDTM)

LKDTM crash point, action, hit count와 DIRECT debugfs trigger의 한국어 전문 번역입니다.

Source pathDocumentation/fault-injection/provoke-crashes.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

provoke-crashes.rst:1-57

LKDTM은 KPROBE crash point 또는 debugfs DIRECT를 통해 PANIC, BUG, EXCEPTION, LOOP, OVERFLOW 같은 kernel failure를 유발해 exception handling과 crash dump를 검증합니다.

LKDTM 선택 축
선택
LocationIRQ·tasklet·FS·memory·SCSI·DIRECT
ActionPANIC·BUG·EXCEPTION·LOOP·OVERFLOW
Count기본 10회, DIRECT는 즉시

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 ============================================================
4 Provoking crashes with Linux Kernel Dump Test Module (LKDTM)
5 ============================================================
6
7 The lkdtm module provides an interface to disrupt (and usually crash)
8 the kernel at predefined code locations to evaluate the reliability of
9 the kernel's exception handling and to test crash dumps obtained using
10 different dumping solutions. The module uses KPROBEs to instrument the
11 trigger location, but can also trigger the kernel directly without KPROBE
12 support via debugfs.
13
14 You can select the location of the trigger ("crash point name") and the
15 type of action ("crash point type") either through module arguments when
16 inserting the module, or through the debugfs interface.
17
18 Usage::
19
20 insmod lkdtm.ko [recur_count={>0}] cpoint_name=<> cpoint_type=<>
21 [cpoint_count={>0}]
22
23 recur_count
24 Recursion level for the stack overflow test. By default this is
25 dynamically calculated based on kernel configuration, with the
26 goal of being just large enough to exhaust the kernel stack. The
27 value can be seen at `/sys/module/lkdtm/parameters/recur_count`.
28
29 cpoint_name
30 Where in the kernel to trigger the action. It can be
31 one of INT_HARDWARE_ENTRY, INT_HW_IRQ_EN, INT_TASKLET_ENTRY,
32 FS_SUBMIT_BH, MEM_SWAPOUT, TIMERADD, SCSI_QUEUE_RQ, or DIRECT.
33
34 cpoint_type
35 Indicates the action to be taken on hitting the crash point.
36 These are numerous, and best queried directly from debugfs. Some
37 of the common ones are PANIC, BUG, EXCEPTION, LOOP, and OVERFLOW.
38 See the contents of `/sys/kernel/debug/provoke-crash/DIRECT` for
39 a complete list.
40
41 cpoint_count
42 Indicates the number of times the crash point is to be hit
43 before triggering the action. The default is 10 (except for
44 DIRECT, which always fires immediately).
45
46 You can also induce failures by mounting debugfs and writing the type to
47 <debugfs>/provoke-crash/<crashpoint>. E.g.::
48
49 mount -t debugfs debugfs /sys/kernel/debug
50 echo EXCEPTION > /sys/kernel/debug/provoke-crash/INT_HARDWARE_ENTRY
51
52 The special file `DIRECT` will induce the action directly without KPROBE
53 instrumentation. This mode is the only one available when the module is
54 built for a kernel without KPROBEs support::
55
56 # Instead of having a BUG kill your shell, have it kill "cat":
57 cat <(echo WRITE_RO) >/sys/kernel/debug/provoke-crash/DIRECT
58

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

LKDTM crash와 exception handling 시험

1-17

Linux Kernel Dump Test Module(LKDTM)은 미리 정의된 code location에서 kernel 동작을 교란하고 보통 crash를 일으켜 exception handling의 신뢰성과 여러 dump solution이 만든 crash dump를 시험합니다.

Module은 KPROBE로 trigger 위치를 계측하지만 debugfs의 direct trigger를 사용하면 KPROBE 지원 없이도 kernel action을 실행할 수 있습니다.

Module 삽입 argument 또는 debugfs에서 trigger 위치인 crash point name과 수행할 action인 crash point type을 선택합니다.

LKDTM 시험 구성
Load LKDTM or mount debugfsChoose crash point nameChoose crash point typeWait for hit count or trigger DIRECTCollect exception handling and crash dump results

Trigger location과 action type을 분리해 원하는 kernel failure를 재현합니다.

.. SPDX-License-Identifier: GPL-2.0

============================================================
Provoking crashes with Linux Kernel Dump Test Module (LKDTM)
============================================================

The lkdtm module provides an interface to disrupt (and usually crash)
the kernel at predefined code locations to evaluate the reliability of
the kernel's exception handling and to test crash dumps obtained using
different dumping solutions. The module uses KPROBEs to instrument the
trigger location, but can also trigger the kernel directly without KPROBE
support via debugfs.

You can select the location of the trigger ("crash point name") and the
type of action ("crash point type") either through module arguments when
inserting the module, or through the debugfs interface.

recur_count·cpoint_name·type·count

18-45

Module 형식은 `insmod lkdtm.ko [recur_count={>0}] cpoint_name=<> cpoint_type=<> [cpoint_count={>0}]`입니다.

`recur_count`는 stack overflow test의 recursion level입니다. 기본값은 kernel configuration을 바탕으로 stack을 겨우 소진할 정도로 동적 계산되며 `/sys/module/lkdtm/parameters/recur_count`에서 확인할 수 있습니다.

`cpoint_name`은 action이 발생할 kernel 위치입니다. `INT_HARDWARE_ENTRY`, `INT_HW_IRQ_EN`, `INT_TASKLET_ENTRY`, `FS_SUBMIT_BH`, `MEM_SWAPOUT`, `TIMERADD`, `SCSI_QUEUE_RQ`, `DIRECT`를 사용할 수 있습니다.

`cpoint_type`은 crash point에서 수행할 action으로 `PANIC`, `BUG`, `EXCEPTION`, `LOOP`, `OVERFLOW` 등이 있습니다. 전체 목록은 `/sys/kernel/debug/provoke-crash/DIRECT` 내용에서 확인합니다.

`cpoint_count`는 action을 실행하기 전에 crash point를 몇 번 hit할지 지정합니다. 기본값은 10이며 `DIRECT`는 항상 즉시 실행합니다.

LKDTM module parameter
Parameter의미기본·예
`recur_count`Stack overflow recursion depth동적 계산
`cpoint_name`Trigger할 kernel 위치IRQ·tasklet·FS·memory·SCSI·DIRECT
`cpoint_type`실행할 failure actionPANIC·BUG·EXCEPTION·LOOP·OVERFLOW
`cpoint_count`Action 전 hit 수10, DIRECT는 즉시

Usage::

        insmod lkdtm.ko [recur_count={>0}] cpoint_name=<> cpoint_type=<>
                        [cpoint_count={>0}]

recur_count
        Recursion level for the stack overflow test. By default this is
        dynamically calculated based on kernel configuration, with the
        goal of being just large enough to exhaust the kernel stack. The
        value can be seen at `/sys/module/lkdtm/parameters/recur_count`.

cpoint_name
        Where in the kernel to trigger the action. It can be
        one of INT_HARDWARE_ENTRY, INT_HW_IRQ_EN, INT_TASKLET_ENTRY,
        FS_SUBMIT_BH, MEM_SWAPOUT, TIMERADD, SCSI_QUEUE_RQ, or DIRECT.

cpoint_type
        Indicates the action to be taken on hitting the crash point.
        These are numerous, and best queried directly from debugfs. Some
        of the common ones are PANIC, BUG, EXCEPTION, LOOP, and OVERFLOW.
        See the contents of `/sys/kernel/debug/provoke-crash/DIRECT` for
        a complete list.

cpoint_count
        Indicates the number of times the crash point is to be hit
        before triggering the action. The default is 10 (except for
        DIRECT, which always fires immediately).

Debugfs와 DIRECT trigger

46-57

Debugfs를 mount한 뒤 `<debugfs>/provoke-crash/<crashpoint>`에 action type을 쓰면 module argument 없이도 failure를 유발할 수 있습니다. 예제는 `INT_HARDWARE_ENTRY`에 `EXCEPTION`을 씁니다.

특수 파일 `DIRECT`는 KPROBE 계측 없이 action을 즉시 실행합니다. KPROBE 지원 없이 빌드된 kernel에서 사용할 수 있는 유일한 mode입니다.

`echo WRITE_RO > DIRECT`를 shell에서 직접 실행하면 BUG가 shell을 종료할 수 있습니다. 예제처럼 process substitution을 `cat`으로 전달하면 action의 희생 process를 `cat`으로 제한할 수 있습니다.

LKDTM debugfs trigger
Mount debugfsChoose `/provoke-crash/<crashpoint>`Write an action typeUse `DIRECT` when KPROBEs are absentIsolate a destructive action in a disposable process

KPROBE crash point 또는 DIRECT action을 명시적으로 실행합니다.

You can also induce failures by mounting debugfs and writing the type to
<debugfs>/provoke-crash/<crashpoint>. E.g.::

  mount -t debugfs debugfs /sys/kernel/debug
  echo EXCEPTION > /sys/kernel/debug/provoke-crash/INT_HARDWARE_ENTRY

The special file `DIRECT` will induce the action directly without KPROBE
instrumentation. This mode is the only one available when the module is
built for a kernel without KPROBEs support::

  # Instead of having a BUG kill your shell, have it kill "cat":
  cat <(echo WRITE_RO) >/sys/kernel/debug/provoke-crash/DIRECT