From 075e40c91c1a9ae0ce415699b0278d880c098128 Mon Sep 17 00:00:00 2001 From: Zhihao Cheng Date: Mon, 11 Nov 2024 17:08:22 +0800 Subject: tests: ubifs_tools: fsck_tests: Add corrupt+fsck+fault_inject test Inject memory/io fault while doing fsck for corrupted UBIFS images. This testcase mainly checks whether fsck.ubifs has problems (eg. UAF, null-ptr-def, etc.) in random error paths. Besides, it provides a similar way to simulate powercut during fsck, and checks whether the fsck.ubifs can fix an UBIFS image after many rounds interrupted by kinds of errors. Signed-off-by: Zhihao Cheng Signed-off-by: David Oberhollenzer --- tests/ubifs_tools-tests/lib/common.sh.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/ubifs_tools-tests/lib/common.sh.in') diff --git a/tests/ubifs_tools-tests/lib/common.sh.in b/tests/ubifs_tools-tests/lib/common.sh.in index 5a07ebc..a27fe10 100755 --- a/tests/ubifs_tools-tests/lib/common.sh.in +++ b/tests/ubifs_tools-tests/lib/common.sh.in @@ -234,12 +234,13 @@ function encryption_gen_key() function encryption_set_key() { mnt=$1 + ignore_err=$2 # https://github.com/google/fscryptctl key=$(fscryptctl add_key $mnt < $KEY_FILE) fscryptctl set_policy $key $mnt #fscryptctl get_policy $mnt ret=$? - if [[ $ret != 0 ]]; then + if [[ $ret != 0 && $ignore_err != 1 ]]; then fatal "set encryption policy failed" fi } -- cgit v1.2.3