From: David Sterba <dsterba@suse.cz>
To: fdmanana@kernel.org
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org,
Filipe Manana <fdmanana@suse.com>
Subject: Re: [PATCH] generic/736: fix a buffer overflow in readdir-while-renames.c
Date: Thu, 22 Feb 2024 13:28:44 +0100 [thread overview]
Message-ID: <20240222122844.GO355@twin.jikos.cz> (raw)
In-Reply-To: <eff8549698ca7a61089e17727b3e1d45a4839e6f.1707650891.git.fdmanana@suse.com>
On Sun, Feb 11, 2024 at 11:28:26AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> The test is using a 32 characters buffer to print the full path for each
> file name, which in some setups it's not enough because $TEST_DIR can
> point to a path name longer than that, or even smaller but then the buffer
> is still not large enough after appending a file name. When that's the
> case it results in a core dump like this:
>
> generic/736 QA output created by 736
> *** buffer overflow detected ***: terminated
> /opt/xfstests/tests/generic/736: line 32: 9217 Aborted (core dumped) $here/src/readdir-while-renames $target_dir
> Silence is golden
> - output mismatch (see /opt/xfstests/results//generic/736.out.bad)
> --- tests/generic/736.out 2024-01-14 12:01:35.000000000 -0500
> +++ /opt/xfstests/results//generic/736.out.bad 2024-01-23 18:58:37.990000000 -0500
> @@ -1,2 +1,4 @@
> QA output created by 736
> +*** buffer overflow detected ***: terminated
> +/opt/xfstests/tests/generic/736: line 32: 9217 Aborted (core dumped) $here/src/readdir-while-renames $target_dir
> Silence is golden
> ...
> (Run diff -u /opt/xfstests/tests/generic/736.out /opt/xfstests/results//generic/736.out.bad to see the entire diff)
> Ran: generic/736
> Failures: generic/736
> Failed 1 of 1 tests
>
> We don't actually need to print the full path into the buffer, because we
> have previously set the current directory (chdir) to the path pointed by
> "dir_path". So fix this by printing only the relative path name which
> uses at most 5 characters (NUM_FILES is 5000 plus the nul terminator).
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
prev parent reply other threads:[~2024-02-22 12:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-11 11:28 [PATCH] generic/736: fix a buffer overflow in readdir-while-renames.c fdmanana
2024-02-12 1:18 ` David Disseldorp
2024-02-12 2:57 ` Qu Wenruo
2024-02-22 12:28 ` David Sterba [this message]
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=20240222122844.GO355@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=fdmanana@kernel.org \
--cc=fdmanana@suse.com \
--cc=fstests@vger.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).