Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/4] btrfs-progs: fix the filename sanitization of btrfs-image
Date: Mon,  8 Jul 2024 14:44:14 +0930	[thread overview]
Message-ID: <cover.1720415116.git.wqu@suse.com> (raw)

There are several bugs in btrfs-image filename sanitization:

- Ensured kernel path resolution bug
  Since during path resolution btrfs uses hash to find the child inode,
  with garbage filled DIR_ITEMs, it's definitely unable to properly
  resolve the path.

  A warning is added to the man page by the first patch.

- Only the last item got properly sanitized
  All the remaining INODE_REF/DIR_INDEX/DIR_ITEM are not sanitized at
  all.

  This is fixed by the second patch.

- Sanitized filename contains non-ASCII chars
  This is fixed by the third patch.


Finally a new test case is introduced to verify the filename
sanitization behavior of btrfs-image.

Qu Wenruo (4):
  btrfs-progs: add warning for -s option of btrfs-image
  btrfs-progs: image: fix the bug that filename sanitization not working
  btrfs-progs: fix rand_range()
  btrfs-progs: misc-tests: add a test case for filename sanitization

 Documentation/btrfs-image.rst               | 17 ++++++-----
 common/utils.c                              | 10 +++----
 image/sanitize.c                            |  8 ++++-
 tests/misc-tests/065-image-filename/test.sh | 33 +++++++++++++++++++++
 4 files changed, 55 insertions(+), 13 deletions(-)
 create mode 100755 tests/misc-tests/065-image-filename/test.sh

--
2.45.2


             reply	other threads:[~2024-07-08  5:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08  5:14 Qu Wenruo [this message]
2024-07-08  5:14 ` [PATCH 1/4] btrfs-progs: add warning for -s option of btrfs-image Qu Wenruo
2024-07-08  5:14 ` [PATCH 2/4] btrfs-progs: image: fix the bug that filename sanitization not working Qu Wenruo
2024-07-08  5:14 ` [PATCH 3/4] btrfs-progs: fix rand_range() Qu Wenruo
2024-07-08  5:14 ` [PATCH 4/4] btrfs-progs: misc-tests: add a test case for filename sanitization Qu Wenruo
2024-07-14 22:09 ` [PATCH 0/4] btrfs-progs: fix the filename sanitization of btrfs-image Qu Wenruo
2024-07-18 15:47   ` David Sterba
2024-07-18 22:38     ` Qu Wenruo
2024-07-18 22:55       ` David Sterba
2024-07-19  0:46         ` Qu Wenruo

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=cover.1720415116.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@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