FS/XFS testing framework
 help / color / mirror / Atom feed
From: Sun Ke <sunke32@huawei.com>
To: <fstests@vger.kernel.org>
Cc: <sunke32@huawei.com>
Subject: [PATCH] ext4: test for illegal memory access caused by quota index information error
Date: Thu, 25 Nov 2021 16:00:36 +0800	[thread overview]
Message-ID: <20211125080036.2211159-1-sunke32@huawei.com> (raw)

The quota index information in the image is tampered, causing illegal
memory access.
It is a regression test for Kernel commit 9bf3d2033129 quota: check block
number when reading the block in quota file and commit d0e36a62bd4c
quota: correct error number in free_dqentry().

Signed-off-by: Sun Ke <sunke32@huawei.com>
---
 tests/ext4/054     | 36 ++++++++++++++++++++++++++++++++++++
 tests/ext4/054.out |  1 +
 2 files changed, 37 insertions(+)
 create mode 100755 tests/ext4/054
 create mode 100644 tests/ext4/054.out

diff --git a/tests/ext4/054 b/tests/ext4/054
new file mode 100755
index 00000000..286b5ecb
--- /dev/null
+++ b/tests/ext4/054
@@ -0,0 +1,36 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021 Huawei.  All Rights Reserved.
+#
+# FS QA Test 054
+#
+# Regression test for kernel
+# commit 9bf3d2033129 quota: check block number when reading the block in quota file
+# commit d0e36a62bd4c quota: correct error number in free_dqentry()
+#
+# The test is based on a testcase from Zhang Yi <yi.zhang@huawei.com>.
+#
+. ./common/preamble
+_begin_fstest auto
+
+# real QA test starts here
+
+# Modify as appropriate.
+_require_scratch
+_supported_fs ext4
+_require_user fsgqa
+_require_user fsgqa2
+
+_scratch_mkfs "-F -O quota -b 1024" > $seqres.full 2>&1
+debugfs -w -R "zap_block -o 0 -l 1 -p 6 -f <3> 1" $SCRATCH_DEV >> $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+chown fsgqa:fsgqa $SCRATCH_MNT >> $seqres.full 2>&1
+touch $SCRATCH_MNT/foo >> $seqres.full 2>&1
+rm -f $SCRATCH_MNT/foo
+chown fsgqa2:fsgqa2 $SCRATCH_MNT >> $seqres.full 2>&1
+
+umount $SCRATCH_MNT
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/054.out b/tests/ext4/054.out
new file mode 100644
index 00000000..03e258bb
--- /dev/null
+++ b/tests/ext4/054.out
@@ -0,0 +1 @@
+QA output created by 054
-- 
2.13.6


             reply	other threads:[~2021-11-25  7:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25  8:00 Sun Ke [this message]
2021-11-28 14:58 ` [PATCH] ext4: test for illegal memory access caused by quota index information error Eryu Guan
2021-11-28 15:13   ` Eryu Guan
2021-12-16  6:27   ` Sun Ke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211125080036.2211159-1-sunke32@huawei.com \
    --to=sunke32@huawei.com \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox