From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] Add test for possible writev() issues with NULL buffer in iovec
Date: Tue, 23 Feb 2021 12:46:09 +0100 [thread overview]
Message-ID: <YDTrAVVmOXB98Xjt@pevik> (raw)
In-Reply-To: <20210222172043.24294-1-mdoucha@suse.cz>
Hi Martin,
> Fixes #790
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
> This test triggers temporary write of invalid data into test file on some
> file systems on kernel 4.4.21 and older.
> Changes since v1:
> - Simplify main thread
> - Use atomic load/store when passing read limit between threads (I hope I'm
> doing it correctly)
> - Check for too big writes just in case
> - Require at least 2 CPUs, the bugs are not reproducible on single-CPU systems
Reviewed-by: Petr Vorel <pvorel@suse.cz>
It takes some time to run due .all_filesystems, but I guess there is a reason to
test it on all available fs.
...
> diff --git a/testcases/kernel/syscalls/writev/writev03.c b/testcases/kernel/syscalls/writev/writev03.c
> new file mode 100644
> index 000000000..58d6931d2
> --- /dev/null
> +++ b/testcases/kernel/syscalls/writev/writev03.c
> @@ -0,0 +1,145 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2021 SUSE LLC <mdoucha@suse.cz>
> + *
> + * Check for potential issues in writev() if the first iovec entry is NULL
> + * and the next one is not present in RAM. This can result in a brief window
> + * where writev() first writes uninitialized data into the file (possibly
> + * exposing internal kernel structures) and then overwrites it with the real
> + * iovec contents later. Bugs fixed in:
Maybe this doc part should be in * [DESCRIPTION] to get into docparse.
The rest LGTM.
Kind regards,
Petr
next prev parent reply other threads:[~2021-02-23 11:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-22 17:20 [LTP] [PATCH v2] Add test for possible writev() issues with NULL buffer in iovec Martin Doucha
2021-02-23 11:46 ` Petr Vorel [this message]
2021-02-23 12:00 ` Martin Doucha
2021-02-24 9:40 ` Richard Palethorpe
2021-02-24 18:05 ` Petr Vorel
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=YDTrAVVmOXB98Xjt@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/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