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 A67D4C433EF for ; Mon, 4 Jul 2022 20:55:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E6606B0073; Mon, 4 Jul 2022 16:55:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 196496B0074; Mon, 4 Jul 2022 16:55:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 05EAB6B0075; Mon, 4 Jul 2022 16:55:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EB3966B0073 for ; Mon, 4 Jul 2022 16:55:14 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 94E3C341F7 for ; Mon, 4 Jul 2022 20:55:14 +0000 (UTC) X-FDA: 79650622548.23.032B579 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by imf30.hostedemail.com (Postfix) with ESMTP id 2A66280021 for ; Mon, 4 Jul 2022 20:55:14 +0000 (UTC) Received: by mail-lf1-f48.google.com with SMTP id t19so16793187lfl.5 for ; Mon, 04 Jul 2022 13:55:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/yAZeAbMlA0MlzGxn2hN3/XK5qxO5T7qF19l5UEr4Zc=; b=W2hmMHZIlVX17hX5ZnI6HTuqm3ZJ5p54D5d8aHf5QuKGwRZw6Y8EIH14PLiK5scdIY S9pthMsINqNnHDQkpKpYyIuOQlL07OnPavYF6D5xWccffjl/XEumDJl0Z3l2tdCrOtCA Dnuf6bnFzN/s3d72H3m8z7XBSeLvJTx0CJSdg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/yAZeAbMlA0MlzGxn2hN3/XK5qxO5T7qF19l5UEr4Zc=; b=jn/ohcM+ECOET5gwXARbkEcJ6ZP46g2Ff2HHpWd7BpKe5z6nR9pQtHadB0RicMyRZL r4fbO04SV240KV9pDExHU1vPoTL2kbXxEuq7Xa5ScagEc+xbX1ScJEehntxUdKOpvMSB 9VqpOv88xJW3zk7w3sEyG2qftySyCRAxAXwdVbE29Jg68Y9oXzXgD3HW/dc3cPYrOezW kDC49cV/tvxsuMJ/pGk4r/+oWSjUTE1wFTesxmowpTnfJ0Sf3ylgjQ13l7N6djCwq+J/ /fBDdFpN0ACx88xoOkLoY7CjMKh9scvoYAWzCEhMUnp1ZT1xu08iDbnm/2f5uoL5/6W9 /gZA== X-Gm-Message-State: AJIora+dH1WSsZLedLmcpWiL2Jwt6nJ2olm5HHaIjHzAugC+Ae5R/gQR XDFoDeA/3tD7PvjryQ2RHL/xlZlhVXYxG7S920Y= X-Google-Smtp-Source: AGRyM1tdhrcxkeX22mBifO9639Z1T0eYD+9TQ3RIhknvOam193T+G2Ii7aWmfFstYSVxQznTWOwPNw== X-Received: by 2002:a05:6512:3c84:b0:47f:7781:e49a with SMTP id h4-20020a0565123c8400b0047f7781e49amr21395583lfv.370.1656968112250; Mon, 04 Jul 2022 13:55:12 -0700 (PDT) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com. [209.85.167.52]) by smtp.gmail.com with ESMTPSA id x9-20020ac24889000000b004786d37229csm5291578lfc.155.2022.07.04.13.55.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Jul 2022 13:55:12 -0700 (PDT) Received: by mail-lf1-f52.google.com with SMTP id g11so2201393lfb.11 for ; Mon, 04 Jul 2022 13:55:11 -0700 (PDT) X-Received: by 2002:a5d:59a5:0:b0:21d:205b:3c5b with SMTP id p5-20020a5d59a5000000b0021d205b3c5bmr28828449wrr.97.1656967686356; Mon, 04 Jul 2022 13:48:06 -0700 (PDT) MIME-Version: 1.0 References: <20220701142310.2188015-1-glider@google.com> <20220701142310.2188015-44-glider@google.com> In-Reply-To: From: Linus Torvalds Date: Mon, 4 Jul 2022 13:47:50 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 43/45] namei: initialize parameters passed to step_into() To: Al Viro Cc: Alexander Potapenko , 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 Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656968114; h=from:from: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=/yAZeAbMlA0MlzGxn2hN3/XK5qxO5T7qF19l5UEr4Zc=; b=Tvf01drbpDmHGjegvs20bLVqu++riCurNeB0bDU+vy55O8PXM4Mo+D4Bu29tp/51GY1bkS hUFuz61cF0u4TK2zp0yW8NH0c6fjZPTRSzvviwrbQ+E31KkoX5zJ8arCDJ82aRlGxfJcwB wTPh1VDfMPuJhwmJp5NF8FxujOJ+CpE= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=W2hmMHZI; dmarc=none; spf=pass (imf30.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.167.48 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656968114; a=rsa-sha256; cv=none; b=U/3xa8g4kjbleCiotq4njVHQCuhmP4EIURd48fMO7sjryGSYBv8s6D/9xisKPVAxJFUkZp Ko4ItmnxcI+RddlyxiiaebhanaGDeUiLFUy8zxfrNPpXwefe+GKAl74elN+BtuNaE4oscP tuIwHlWFfsbvk5pltESyuku54FMh9jo= Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=W2hmMHZI; dmarc=none; spf=pass (imf30.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.167.48 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org X-Stat-Signature: gsc44eqjnfr3qq8pyuucs9fh6whz5wci X-Rspamd-Queue-Id: 2A66280021 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1656968114-726320 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 4, 2022 at 1:24 PM Linus Torvalds wrote: > > The mount point check should go around the "check dentry mount point", > but it's a separate issue from the whole "we are now jumping to a > different dentry, we should check that the previous dentry hasn't > changed". Maybe it doesn't really matter, because we never actually end up dereferencing the previous dentry (exactly since we're following the mount point on it). It feels like the sequence point checks are basically tied to the "we're looking at the inode that the dentry pointed to", and because the mount-point traversal doesn't need to look at the inode, the sequence point check also isn't done. But it feels wrong to traverse a dentry under RCU - even if we don't then look at the inode itself - without having verified that the dentry is still valid. Yes, the d_seq lock protects against the inode going away (aka "unlink()") and that cannot happen when it's a mount-point. But it _also_ ends up changing for __d_move() when the name of the dentry changes. And I think that name change is relevant even to "look up a mount point", exactly because we used that name to look up the dentry in the first place, so if the name is changing, we shouldn't traverse that mount point. But I may have just confused myself terminally here. Linus