From mboxrd@z Thu Jan 1 00:00:00 1970 From: Petr Vorel Date: Tue, 23 Feb 2021 12:46:09 +0100 Subject: [LTP] [PATCH v2] Add test for possible writev() issues with NULL buffer in iovec In-Reply-To: <20210222172043.24294-1-mdoucha@suse.cz> References: <20210222172043.24294-1-mdoucha@suse.cz> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it Hi Martin, > Fixes #790 > Signed-off-by: Martin Doucha > --- > 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 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 > + * > + * 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