Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp885684pxb; Thu, 19 Aug 2021 13:54:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQ1iTfvbzVoKbvPCD9pg3g6fWt5nNfafTbx8y2V2gVcRkQy5hSNz8sEg+/zp1ch8PY2dju X-Received: by 2002:a17:907:2bc1:: with SMTP id gv1mr18280935ejc.58.1629406474182; Thu, 19 Aug 2021 13:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629406474; cv=none; d=google.com; s=arc-20160816; b=P54Aw6fcG7gSCufWHPPtXqE2Db5kZWNC4zSALoURKumyWc0tOzg6sVtpyrdMVsFL2n rWv0pFiZmLGaUhSXm5PL9f5jyhg/hXSwyPj0O7A3GHIuddQ6TkYugwMPpqhql6ywNjwp HIX3GkUC+rHq2g0qke6VSobEr6thcYKYw4B3SXR+HShQ3VWe0rxNcAbcv9vC6Lt1n3MD Qp8tLqw0BOfrdYvShDfBPX2lroahOg8VPgYnvkqczuerybd+vpDdqm+NzD2AoZyEk2rC F418ym96YR8xahcSpmLvTXrW6+X1uRXUCAJwuhHXCRuNhqEmHX5T8BglFWBN9YM9LFLX ByuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RJyUMpRvCKY0Vh89D3w3gONjiQnSaoV/zmqyDYmDpUA=; b=BNSzgyNwSwMG4LTk2rP8qiqM2Fc1M8rFAWNZhu4avBZcXOXcWP7M7VX03hiGGSw/8D 3lWu4uqjmwL2V4LgmAdT434QghSBNljkuORBYekCrprMzml/DsQkExXlC/5uj4KKgbEj mdiO4rRcZp9jSjw6c182KbwqKDt9Y6RA014mdLgbweEC8hXkNbAXHmuLp77YUIGit7H7 HyjlLdYDKpa/qzc+T6kWrN0FNHr1+b83sObwuKKLOxumgfNCn3eBvk+O1eYk/LmCGzfw SliWTl0IkSK0fV9a/0xM9sqv4EnPcAGg0M83p5d1OtC31p4C2s/eW9VGIyf+cTogJvb/ OTEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Y+pU8j9v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p23si4604787edw.186.2021.08.19.13.54.09; Thu, 19 Aug 2021 13:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Y+pU8j9v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235804AbhHSUws (ORCPT + 99 others); Thu, 19 Aug 2021 16:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235810AbhHSUwq (ORCPT ); Thu, 19 Aug 2021 16:52:46 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8688C061764 for ; Thu, 19 Aug 2021 13:52:09 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id f2so13669975ljn.1 for ; Thu, 19 Aug 2021 13:52:09 -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=RJyUMpRvCKY0Vh89D3w3gONjiQnSaoV/zmqyDYmDpUA=; b=Y+pU8j9vQaWTxEhQ0j0tkQUmizFhaaD+mBD4UKDchtCcNJDPjhu50XdOkmR7wRhVkU sO/ZAyNE37DjaIrX3Jupm5Lmzorw4l3UwqrPdvdUzj38oBpjeDPsJPwAdFT5IzBfsdoc aflzICp2BeWzdnFJvaqwcQw0cXI2edPGK5Q7U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RJyUMpRvCKY0Vh89D3w3gONjiQnSaoV/zmqyDYmDpUA=; b=nllSbZPwXTcDYTnMvGP/Arn9MkJFkN/24Yy/x09j1yd+7a6A0fKFeG+LQc4hX4LJLp pZ4iIQ+1+pkRmi5BVurcKKAaLJJwSraw1/fo3FRf1CTq+f/7JknT6xQydMU7pWZdC9H2 VfXTmrxXHEJodLlpd6R95WsKZWgUzFIpTgmfLlGqYIGhgbhyg/C5kF0qXkK5PffUUgtb iPeHpv5e5tiBZqGkPhg3JAEhAJe68O+pfdrQy3LqUCkultHOFFlnG40Nz+7nBpFddcyp D1NxOHpLz+PhI9b0MXGgBP4JOjwxiNejURv8i4ha8BTn8MuRiqvF6mC67r+F88vqPqWn zv6A== X-Gm-Message-State: AOAM533L/d2MTc1For0Iqgl8J5iJpjrV3niNaTqEs/lct+vBkIpCuXRO hRMin6aR8Z3C2zo21TBmHV+pMDLMwId9sYVz9Jo= X-Received: by 2002:a2e:a54a:: with SMTP id e10mr12991452ljn.503.1629406327882; Thu, 19 Aug 2021 13:52:07 -0700 (PDT) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com. [209.85.167.44]) by smtp.gmail.com with ESMTPSA id o20sm413680lfu.148.2021.08.19.13.52.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Aug 2021 13:52:07 -0700 (PDT) Received: by mail-lf1-f44.google.com with SMTP id o10so15636480lfr.11 for ; Thu, 19 Aug 2021 13:52:07 -0700 (PDT) X-Received: by 2002:a19:4f1a:: with SMTP id d26mr11559422lfb.377.1629406326706; Thu, 19 Aug 2021 13:52:06 -0700 (PDT) MIME-Version: 1.0 References: <20210816194840.42769-1-david@redhat.com> <20210816194840.42769-3-david@redhat.com> In-Reply-To: <20210816194840.42769-3-david@redhat.com> From: Linus Torvalds Date: Thu, 19 Aug 2021 13:51:50 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/7] kernel/fork: factor out replacing the current MM exe_file To: David Hildenbrand Cc: Linux Kernel Mailing List , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Alexander Viro , Alexey Dobriyan , Steven Rostedt , Peter Zijlstra , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Petr Mladek , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Kees Cook , "Eric W. Biederman" , Greg Ungerer , Geert Uytterhoeven , Mike Rapoport , Vlastimil Babka , Vincenzo Frascino , Chinwen Chang , Catalin Marinas , "Matthew Wilcox (Oracle)" , Huang Ying , Jann Horn , Feng Tang , Kevin Brodsky , Michael Ellerman , Shawn Anastasio , Steven Price , Nicholas Piggin , Christian Brauner , Jens Axboe , Gabriel Krisman Bertazi , Peter Xu , Suren Baghdasaryan , Shakeel Butt , Marco Elver , Daniel Jordan , Nicolas Viennot , Thomas Cedeno , Michal Hocko , Miklos Szeredi , Chengguang Xu , =?UTF-8?Q?Christian_K=C3=B6nig?= , Florian Weimer , David Laight , linux-unionfs@vger.kernel.org, Linux API , "the arch/x86 maintainers" , linux-fsdevel , Linux-MM Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So I like this series. However, logically, I think this part in replace_mm_exe_file() no longer makes sense: On Mon, Aug 16, 2021 at 12:50 PM David Hildenbrand wrote: > > + /* Forbid mm->exe_file change if old file still mapped. */ > + old_exe_file = get_mm_exe_file(mm); > + if (old_exe_file) { > + mmap_read_lock(mm); > + for (vma = mm->mmap; vma && !ret; vma = vma->vm_next) { > + if (!vma->vm_file) > + continue; > + if (path_equal(&vma->vm_file->f_path, > + &old_exe_file->f_path)) > + ret = -EBUSY; > + } > + mmap_read_unlock(mm); > + fput(old_exe_file); > + if (ret) > + return ret; > + } and should just be removed. NOTE! I think it makes sense within the context of this patch (where you just move code around), but that it should then be removed in the next patch that does that "always deny write access to current MM exe_file" thing. I just quoted it in the context of this patch, since the next patch doesn't actually show this code any more. In the *old* model - where the ETXTBUSY was about the mmap() of the file - the above tests make sense. But in the new model, walking the mappings just doesn't seem to be a sensible operation any more. The mappings simply aren't what ETXTBUSY is about in the new world order, and so doing that mapping walk seems nonsensical. Hmm? Linus