From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C71AC43334 for ; Mon, 4 Jul 2022 13:55:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2DB16B0073; Mon, 4 Jul 2022 09:55:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F038C6B0074; Mon, 4 Jul 2022 09:55:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA40D6B0075; Mon, 4 Jul 2022 09:55:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CE62E6B0073 for ; Mon, 4 Jul 2022 09:55:39 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id AB6B860C03 for ; Mon, 4 Jul 2022 13:55:39 +0000 (UTC) X-FDA: 79649565198.17.EC38B6E Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) by imf25.hostedemail.com (Postfix) with ESMTP id 42C26A0039 for ; Mon, 4 Jul 2022 13:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=sFBRrsK/nUCO/qpurgOa37xWDf0Rw4TWhvCcPDzVFrw=; b=fGvBCBUUizUVOtp0n9eFyK6qEp BlBJ2LXAd0hh4Ac/kOInhtYaicGuP0Wm+9RpmeAcNCveOfiNg2HalpF71G6tE0sxRAOoJnnnJ8jDo LzrOgSbBh27d4lrinBT/6BTlPxLOemUmVcp9N08w+0hNimZQPMPk331algyiCyhqUh44lkkWpPmmY R0/v2bo6OqfBLfb3ZP66/skFycQymC2OCzUed8HfkyDvpKdX2Zugr38vE288P/qWfhzbrVpgSoItW lZComXKs5lJQWRJj/s21c22jLyTgHTbTtCNo+CUvRSFL+2Lib/Pig8sU6eh28YZ87NBq8C1awuPRj X1SbUxKA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1o8MXa-0081o6-IG; Mon, 04 Jul 2022 13:55:06 +0000 Date: Mon, 4 Jul 2022 14:55:06 +0100 From: Al Viro To: Alexander Potapenko Cc: Linus Torvalds , Alexei Starovoitov , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Mark Rutland , Matthew Wilcox , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Steven Rostedt , Thomas Gleixner , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , kasan-dev , Linux-MM , linux-arch , Linux Kernel Mailing List , Evgenii Stepanov , Nathan Chancellor , Nick Desaulniers , Segher Boessenkool , Vitaly Buka , linux-toolchains Subject: Re: [PATCH v4 43/45] namei: initialize parameters passed to step_into() Message-ID: References: <20220701142310.2188015-1-glider@google.com> <20220701142310.2188015-44-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656942939; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sFBRrsK/nUCO/qpurgOa37xWDf0Rw4TWhvCcPDzVFrw=; b=CTWIzvW5fUKrVgLcxmujZL8n3PkpoyyKIB2EFrL7OJU6Qc67uYDUoRQGAZCgbLodNlMQ8q HbXJjCmBWIvgY6Vad/CgAke0LSJKXsQKpimQVDQwWOkQNLCco/drnDLtAI+Nyt1hHAPpoH A8eg3qL6bpmdyPM557gQ9U9VB28tII4= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=linux.org.uk header.s=zeniv-20220401 header.b=fGvBCBUU; dmarc=pass (policy=none) header.from=zeniv.linux.org.uk; spf=none (imf25.hostedemail.com: domain of viro@ftp.linux.org.uk has no SPF policy when checking 62.89.141.173) smtp.mailfrom=viro@ftp.linux.org.uk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656942939; a=rsa-sha256; cv=none; b=EcLjBULHQdfBf5PcHnUAyo6kOgEUFAAx9FhVLyGu/vXc2teoowiZhAZ7dmuIKK+7IrXxW2 seCloEx+YdldApewBko+z7ze2U8S6r5X0ZXpsERjxm5CMta8WZkeTRP064OwXaIt7s6ugR 7ns7DeZ1URcUkEnPi3+HTdpu2HbbJd0= Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linux.org.uk header.s=zeniv-20220401 header.b=fGvBCBUU; dmarc=pass (policy=none) header.from=zeniv.linux.org.uk; spf=none (imf25.hostedemail.com: domain of viro@ftp.linux.org.uk has no SPF policy when checking 62.89.141.173) smtp.mailfrom=viro@ftp.linux.org.uk X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 42C26A0039 X-Stat-Signature: mms3qohzpf69b8a17deamuobfdpeedy4 X-Rspam-User: X-HE-Tag: 1656942936-786716 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jul 04, 2022 at 02:44:00PM +0100, Al Viro wrote: > On Mon, Jul 04, 2022 at 10:20:53AM +0200, Alexander Potapenko wrote: > > > What makes you think they are false positives? Is the scenario I > > described above: > > > > """ > > In particular, if the call to lookup_fast() in walk_component() > > returns NULL, and lookup_slow() returns a valid dentry, then the > > `seq` and `inode` will remain uninitialized until the call to > > step_into() > > """ > > > > impossible? > > Suppose step_into() has been called in non-RCU mode. The first > thing it does is > int err = handle_mounts(nd, dentry, &path, &seq); > if (err < 0) > return ERR_PTR(err); > > And handle_mounts() in non-RCU mode is > path->mnt = nd->path.mnt; > path->dentry = dentry; > if (nd->flags & LOOKUP_RCU) { > [unreachable code] > } > [code not touching seqp] > if (unlikely(ret)) { > [code not touching seqp] > } else { > *seqp = 0; /* out of RCU mode, so the value doesn't matter */ > } > return ret; Make that [code assigning ret a non-negative value and never using seqp] if (unlikely(ret)) { [code never using seqp or ret] } else { *seqp = 0; /* out of RCU mode, so the value doesn't matter */ } return ret; so if (err < 0) in the caller is equivalent to if (err).