From: Wang Yugui <wangyugui@e16-tech.com>
To: fdmanana@kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: send: fix buffer overflow detection when copying path to cache entry
Date: Sun, 22 Sep 2024 06:02:47 +0800 [thread overview]
Message-ID: <20240922060246.B4CE.409509F4@e16-tech.com> (raw)
In-Reply-To: <ee24884b0255f717071ca932bda1ab398707d9cf.1726782272.git.fdmanana@suse.com>
Hi,
> From: Filipe Manana <fdmanana@suse.com>
>
> Starting with commit c0247d289e73 ("btrfs: send: annotate struct
> name_cache_entry with __counted_by()") we annotated the variable length
> array "name" from the name_cache_entry structure with __counted_by() to
> improve overflow detection. However that alone was not correct, because
> the length of that array does not match the "name_len" field - it matches
> that plus 1 to include the nul string terminador, so that makes a
> fortified kernel think there's an overflow and report a splat like this:
xfstests generic/591 failed with this patch.
generic/591 1s ... - output mismatch (see
/usr/hpc-bio/xfstests/results//generic/591.out.bad)
--- tests/generic/591.out 2024-08-06 21:26:52.100477701 +0800
+++ /usr/hpc-bio/xfstests/results//generic/591.out.bad 2024-09-22 06:00:37.920543850 +0800
@@ -1,5 +1,10 @@
QA output created by 591
concurrent reader with O_DIRECT
+splice-test: open: /mnt/test/a: Is a directory
concurrent reader without O_DIRECT
+splice-test: open: /mnt/test/a: Is a directory
sequential reader with O_DIRECT
+splice-test: open: /mnt/test/a: Is a directory
...
(Run 'diff -u /usr/hpc-bio/xfstests/tests/generic/591.out /usr/hpc-bio/xfstests/results//generic/591.out.bad' to see the entire diff)
R
Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2024/09/22
next prev parent reply other threads:[~2024-09-21 22:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 21:50 [PATCH] btrfs: send: fix buffer overflow detection when copying path to cache entry fdmanana
2024-09-21 22:02 ` Wang Yugui [this message]
2024-09-22 1:10 ` Wang Yugui
2024-09-22 11:15 ` Filipe Manana
2024-09-24 14:41 ` Josef Bacik
2024-09-24 21:18 ` 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=20240922060246.B4CE.409509F4@e16-tech.com \
--to=wangyugui@e16-tech.com \
--cc=fdmanana@kernel.org \
--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