Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1016985rwb; Wed, 16 Nov 2022 10:43:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ccoDCUN/4oehVk1FK37msKUrrmlRkB4S8waFHfYx84XetQ6b5Ct/5MAM0akTsvlNHQzE5 X-Received: by 2002:a17:907:80c5:b0:7ad:f43a:cb07 with SMTP id io5-20020a17090780c500b007adf43acb07mr18297950ejc.562.1668624231116; Wed, 16 Nov 2022 10:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668624231; cv=none; d=google.com; s=arc-20160816; b=Zf2stNMbzNrKGdKu4szbgiQoN3/1ZNfulpvqo7Tdtuq8rYybKhsK4JndXOVS1ZVUSR Xu8T1y6acCI9gNDBQ8bF8AkbeqvqlcOxrGkF29mUSxUjFvEcE86VLlZutYGTvNqG0nwX ioQaNYA7KYl8DSdmt9wQ9oXo5gD22yZYoMz9iKri0WmA7rS3cjF2kOCVi6lGV+Rd85Ca Kkp9wO7dKEk7Uam0lo7dUJQlF+IlKsZ6LPz3v3KD9drT86rd3h9JIsSoDc330O2g6tjQ lVvCZVrlYeduDwq5oK8tzwom3Uj4Y1hBYA2zYJCMv4MYi3n8mjZQ08wzTzp3FYwuQUtM PykQ== 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=PBgZn+u117R7gFQNpsnvlIYlwSeo0LUTLoxlFKr3wyI=; b=dlWveFvTeSVyyoUQYG0ZxtrvEXpBWj5El81Q1+KwJje7DO706Rvs/D73frr5I+g3/0 v3qBu4k0Pu4GoUqPXtfMVZe9rNiBGyzXtVvglAjytGQsCQWt052jc9DwcTCiL0zUwCiA q6nxBU+oTJSHPNUkC3HSm53pySsiiwlpPCAg4v0GzwDUD5qgkV+q+08HFUFDkV1q2zJ+ cvQyt8QVBvM9EKBmtxRhdjja/0Af98l6KWxw5fXOPFTccr5A+U/bleLJ7ZdBZL4S3SLc TXwE/ls4gxefs8LM0P6wikfV+djobWvLDZE54PPFZGOkMihIV0XtnAKbQ0Q87CIFqMIv Zg2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=eH0YS14V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u23-20020a170906655700b0077ed84da316si12605826ejn.217.2022.11.16.10.43.29; Wed, 16 Nov 2022 10:43:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=eH0YS14V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238854AbiKPSRC (ORCPT + 91 others); Wed, 16 Nov 2022 13:17:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239081AbiKPSQz (ORCPT ); Wed, 16 Nov 2022 13:16:55 -0500 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F40261BB4 for ; Wed, 16 Nov 2022 10:16:54 -0800 (PST) Received: by mail-qk1-x72a.google.com with SMTP id k2so12218028qkk.7 for ; Wed, 16 Nov 2022 10:16:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=PBgZn+u117R7gFQNpsnvlIYlwSeo0LUTLoxlFKr3wyI=; b=eH0YS14VezMu1YoYc8i9L/9V4Rda12NtBPhbyEQG9con1K8dLIyV9b4KNCmIq0wzpX WqxRC9GRz2SSVMeoKLZbZ25GRVxvk4TLZwapfzc9KJm3PzFnUZgrmijMI3uqPEOn38/b +5K39+JbiCr6klzOuT84Gyzf87KIYKFM/ltfQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PBgZn+u117R7gFQNpsnvlIYlwSeo0LUTLoxlFKr3wyI=; b=NamEq/RJyoG6CKPEfJgg5YwN1B44PWUlWNffR6lXOepnZYa3guJ+oGErQyR1N9dEEB M40xlfjJCMfmufWG0i5SZ9U/FM2bV3k/CEVdBXWdugH379m7S6UwMiSetJ5dT/TmtNag SNs1qjUUGvnDcLx4Kapok5VrxIyzAILt1lhm5xXNY7huVAtZAQTFRSSpm/VQ0djfgdRs 6PhciU8+PveBPZrsir84EN69NdLrUMswtGj1zRN6ckS+5Yr/nIxFblj+afLCevbDHtW/ 473ZDMl0ggodZ+75DFoFP0fzp9P5ibrJgdHmMru1/US2zm8fWg6Evc6FsmHNIhUvpluH UfOg== X-Gm-Message-State: ANoB5pnULKElR8XoGeyFtzuHaFK2wyFSMDInyo+TDCChgfxhSDp8Lnxi LCaPqHX0qnE+qf7FUDlpxgNB4KOYkNTzPg== X-Received: by 2002:a05:620a:1370:b0:6fa:3e49:3a86 with SMTP id d16-20020a05620a137000b006fa3e493a86mr20958052qkl.414.1668622613009; Wed, 16 Nov 2022 10:16:53 -0800 (PST) Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com. [209.85.160.181]) by smtp.gmail.com with ESMTPSA id s36-20020a05622a1aa400b0039cc944ebdasm9201627qtc.54.2022.11.16.10.16.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Nov 2022 10:16:51 -0800 (PST) Received: by mail-qt1-f181.google.com with SMTP id h24so11220889qta.9 for ; Wed, 16 Nov 2022 10:16:51 -0800 (PST) X-Received: by 2002:a05:622a:1c15:b0:3a5:49fa:3983 with SMTP id bq21-20020a05622a1c1500b003a549fa3983mr21860304qtb.436.1668622610752; Wed, 16 Nov 2022 10:16:50 -0800 (PST) MIME-Version: 1.0 References: <20221116102659.70287-1-david@redhat.com> <20221116102659.70287-21-david@redhat.com> In-Reply-To: <20221116102659.70287-21-david@redhat.com> From: Linus Torvalds Date: Wed, 16 Nov 2022 10:16:34 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH mm-unstable v1 20/20] mm: rename FOLL_FORCE to FOLL_PTRACE To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-perf-users@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kselftest@vger.kernel.org, Andrew Morton , Jason Gunthorpe , John Hubbard , Peter Xu , Greg Kroah-Hartman , Andrea Arcangeli , Hugh Dickins , Nadav Amit , Vlastimil Babka , Matthew Wilcox , Mike Kravetz , Muchun Song , Shuah Khan , Lucas Stach , David Airlie , Oded Gabbay , Arnd Bergmann , Christoph Hellwig , Alex Williamson , Oleg Nesterov , Richard Henderson , Ivan Kokshaysky , Matt Turner , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Richard Weinberger , Anton Ivanov , Johannes Berg , Eric Biederman , Kees Cook , Alexander Viro , Peter Zijlstra , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Kentaro Takeda , Tetsuo Handa , Paul Moore , James Morris , "Serge E. Hallyn" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 16, 2022 at 2:30 AM David Hildenbrand wrote: > > Let's make it clearer that functionality provided by FOLL_FORCE is > really only for ptrace access. I'm not super-happy about this one. I do understand the "let's rename the bit so that no new user shows up". And it's true that the main traditional use is ptrace. But from the patch itself it becomes obvious that no, it's not *just* ptrace. At least not yet. It's used for get_arg_page(), which uses it to basically look up (and install) pages in the newly created VM. Now, I'm not entirely sure why it even uses FOLL_FORCE, - I think it might be historical, because the target should always be the new stack vma. Following the history of it is a big of a mess, because there's a number of renamings and re-organizations, but it seems to go back to 2007 and commit b6a2fea39318 ("mm: variable length argument support"). Before that commit, we kept our own array of "this is the set of pages that I will install in the new VM". That commit basically just inserts the pages directly into the VM instead, getting rid of the array size limitation. So at a minimum, I think that FOLL_FORCE would need to be removed before any renaming to FOLL_PTRACE, because that's not some kind of small random case. It *might* be as simple as just removing it, but maybe there's some reason for having it that I don't immediately see. There _are_ also small random cases too, like get_cmdline(). Maybe that counts as ptrace, but the execve() case most definitely does not. Linus