Skip to content

Comments

Fault injection support#66

Merged
acerv merged 2 commits intolinux-test-project:masterfrom
acerv:fault_injection
Jul 31, 2025
Merged

Fault injection support#66
acerv merged 2 commits intolinux-test-project:masterfrom
acerv:fault_injection

Conversation

@acerv
Copy link
Collaborator

@acerv acerv commented Jul 29, 2025

Add a new -F|--fault-injection option to implement runltp fault injection support.
The previous -F option has been renamed -W to maintain back compatibility with runltp.

Closes: #64
Signed-off-by: Andrea Cervesato andrea.cervesato@suse.com

@acerv acerv self-assigned this Jul 29, 2025
@acerv acerv added the enhancement New feature or request label Jul 29, 2025
"fail_io_timeout",
"fail_make_request",
"fial_page_alloc",
"failslab"
Copy link

@vigneshraman vigneshraman Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add the below also ? (From https://www.kernel.org/doc/Documentation/fault-injection/fault-injection.txt)

fail_function
fail_futex
fail_make_request
fail_mmc_request

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, if required we can extend it later. Thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the feature working for now?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes with your updated typo fix. Please see the test results below,

vignesh@debian:/opt/kirk$ ./kirk --run-suite syscalls
Host information

	Hostname:   debian
	Python:     3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0]
	Directory:  /tmp/kirk.vignesh/tmp9knknqnw

Connecting to SUT: host
Warning: Run as root to use kernel fault injection

Starting suite: syscalls
-------------------------
abort01: pass  (0.011s)
accept01: pass  (0.004s)
accept02: pass  (0.006s)
accept03: broken  (0.004s)
accept4_01: skip  (0.006s)
access01: skip  (0.005s)
access02: skip  (0.003s)
access03: skip  (0.003s)
access04: skip  (0.002s)
acct01: broken  (0.003s)
acct02: broken  (0.003s)
add_key01: skip  (0.003s)
add_key02: pass  (0.003s)
add_key03: skip  (0.004s)
add_key04: pass  (0.004s)
add_key05: skip  (0.003s)
adjtimex01: skip  (0.002s)
adjtimex02: skip  (0.002s)
adjtimex03: pass  (0.004s)
alarm02: pass  (0.004s)
alarm03: pass  (0.004s)
vignesh@debian:/opt/kirk$ sudo ./kirk --run-suite syscalls
Host information

	Hostname:   debian
	Python:     3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0]
	Directory:  /tmp/kirk.root/tmpko7pd7sg

Connecting to SUT: host
Error: Can't setup failure budget for /sys/kernel/debug/fail_io_timeout/probability

Disconnecting from SUT: host
Session stopped
vignesh@debian:/opt/kirk$ sudo ./kirk -F 100 --run-suite syscalls
[sudo] password for vignesh: 
Host information

	Hostname:   debian
	Python:     3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0]
	Directory:  /tmp/kirk.root/tmptmyhgqb8

Connecting to SUT: host

Starting suite: syscalls
-------------------------
abort01: pass  (0.018s)
accept01: pass  (0.002s)
accept02: pass  (0.005s)
accept03: skip  (0.007s)
accept4_01: skip  (1.436s)
access01: pass  (0.044s)
access02: pass  (0.012s)
access03: pass  (0.005s)
access04: pass  (0.037s)
acct01: broken  (0.002s)
acct02: broken  (0.001s)
add_key01: skip  (0.002s)
add_key02: pass  (0.014s)
add_key03: pass  (0.004s)
add_key04: pass  (0.013s)
add_key05: pass  (0.243s)
adjtimex01: pass  (0.002s)
adjtimex02: skip  (0.014s)
adjtimex03: pass  (0.001s)
alarm02: pass  (0.002s)
alarm03: pass  (0.002s)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you also add a new tag in kirk?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you also add a new tag in kirk?

do you mean one more configuration? I'm actually following the runltp way, then we will eventually add more configurations if required

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you also add a new tag in kirk?

do you mean one more configuration? I'm actually following the runltp way, then we will eventually add more configurations if required

No, not the configuration. I meant the release tags https://github.com/linux-test-project/kirk/releases/tag/v2.1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will be done at the next release, yes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, failure triggered by kernel fault injection.

[ 3036.123772] EXT4-fs (loop0): unmounting filesystem 4cad1b4a-abdf-4fad-b65b-ad3b26a8a14e.
[ 3036.989842] FAULT_INJECTION: forcing a failure.
[ 3036.989842] name failslab, interval 100, probability 100, space 0, times -1
[ 3036.990912] CPU: 0 UID: 0 PID: 16779 Comm: kworker/u4:4 Not tainted 6.14.0-rc4-g8e449e155a5b #1
[ 3036.990914] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 3036.990915] Workqueue: loop0 loop_rootcg_workfn
[ 3036.990920] Call Trace:
[ 3036.990923]  <TASK>
[ 3036.990925]  dump_stack_lvl+0x83/0xc0
[ 3036.990929]  should_fail_ex+0x3aa/0x3c0
[ 3036.990938]  ? __es_insert_extent+0x253/0x620
[ 3036.990940]  should_failslab+0x4f/0x60
[ 3036.990943]  kmem_cache_alloc_noprof+0x51/0x280
[ 3036.990946]  __es_insert_extent+0x253/0x620
[ 3036.990949]  ext4_es_insert_delayed_extent+0x212/0x490
[ 3036.990954]  ext4_da_get_block_prep+0x412/0x550
[ 3036.990956]  ? lock_release+0xdb/0x270
[ 3036.990960]  ext4_block_write_begin+0x176/0x4b0
[ 3036.990962]  ? __folio_batch_add_and_move+0x1ed/0x2f0
[ 3036.990965]  ? trace_ext4_da_release_space+0xa0/0xa0
[ 3036.990968]  ? lock_acquire+0xb7/0x1a0
[ 3036.990970]  ext4_da_write_begin+0x1b6/0x290
[ 3036.990974]  generic_perform_write+0xe6/0x240
[ 3036.990978]  ext4_buffered_write_iter+0xc6/0x160
[ 3036.990980]  ext4_file_write_iter+0x64/0x7d0
[ 3036.990983]  ? lock_acquire+0xb7/0x1a0
[ 3036.990984]  ? vfs_iter_write+0xb1/0x1b0
[ 3036.990987]  do_iter_readv_writev+0x18f/0x1d0
[ 3036.990991]  vfs_iter_write+0xc7/0x1b0
[ 3036.990993]  loop_process_work+0x676/0x930
[ 3036.991000]  ? lock_acquire+0xb7/0x1a0
[ 3036.991001]  ? process_scheduled_works+0x266/0x510
[ 3036.991005]  ? process_scheduled_works+0x1ef/0x510
[ 3036.991007]  ? process_scheduled_works+0x266/0x510
[ 3036.991009]  process_scheduled_works+0x29c/0x510
[ 3036.991014]  worker_thread+0x25e/0x330
[ 3036.991016]  ? _raw_spin_unlock_irqrestore+0x31/0x50
[ 3036.991019]  ? pr_cont_work+0x190/0x190
[ 3036.991021]  kthread+0x207/0x220
[ 3036.991023]  ? kthread_blkcg+0x30/0x30
[ 3036.991025]  ret_from_fork+0x34/0x40
[ 3036.991027]  ? kthread_blkcg+0x30/0x30
[ 3036.991029]  ret_from_fork_asm+0x11/0x20
[ 3036.991033]  </TASK>

@acerv acerv force-pushed the fault_injection branch 2 times, most recently from 443092d to 2112bae Compare July 31, 2025 08:50
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
@acerv acerv force-pushed the fault_injection branch from 2112bae to 506bf7a Compare July 31, 2025 09:38
Add --fault-injection|-F option and change the short version of the
--force-parallel option to -W. In this way we keep runltp back
compatibility.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
@acerv acerv force-pushed the fault_injection branch from 506bf7a to 04a3c0e Compare July 31, 2025 11:25
@acerv acerv merged commit cdc81ed into linux-test-project:master Jul 31, 2025
9 checks passed
@acerv acerv deleted the fault_injection branch September 16, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add support for kernel fault injection

2 participants