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 8B69EC4332F for ; Wed, 16 Nov 2022 18:16:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 05D356B0073; Wed, 16 Nov 2022 13:16:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F28036B0074; Wed, 16 Nov 2022 13:16:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D7B186B0075; Wed, 16 Nov 2022 13:16:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C791D6B0073 for ; Wed, 16 Nov 2022 13:16:56 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8F9F81203F9 for ; Wed, 16 Nov 2022 18:16:56 +0000 (UTC) X-FDA: 80140111632.21.9BB6EB1 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by imf16.hostedemail.com (Postfix) with ESMTP id 9F34D18000A for ; Wed, 16 Nov 2022 18:16:53 +0000 (UTC) Received: by mail-qk1-f174.google.com with SMTP id 8so12230248qka.1 for ; Wed, 16 Nov 2022 10:16:53 -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=JQywi8isl/eKq644MI8PRT/7jZAH9Cgd8pVUsCKqzppYTlG28j/CX5OTjWzDegu+2j W4tkSvTdLaM/kg041r2lfCSfw+2bzkDUR/dhnfLEBtM6ZWh0f2Vqskar/pY5WdfWhsqH J9ayHb3uTZlsLNl6XQ62dfoqdNWSvw88wRDdy1e47xIF0Ubc9gAKe55/cSt8Xl6b5ajd 7h1VjzlJl1Gq/KIUiBBCag3ecAc1Ju1FrnBrc7BUAq+n9mJqlA3XfjxmTJ5qgOsQFsiJ TTuDIg+ruBXbpF+8Kn/VRzvLTK5FMKg9jt1d03hycT4U49sRS7RRNKQIkfM5Sjyj/u++ 281w== X-Gm-Message-State: ANoB5pnUyl34wLzmFv+cngvdHxip5BLcBw+8df5T3eUXF/7V8/jCI0mR IQd/0MHwaAQwEr5JVVEEfYLecNZrU/i9sg== X-Google-Smtp-Source: AA0mqf6yapL73OgoKKW9bQj7F8dxZnLzgeImdKeyDJuCbQNiNYZyTKHDxOSDhzNW8lPE0a7NOUbiIw== X-Received: by 2002:a05:620a:13c3:b0:6cf:7959:cc0c with SMTP id g3-20020a05620a13c300b006cf7959cc0cmr19996929qkl.649.1668622612225; Wed, 16 Nov 2022 10:16:52 -0800 (PST) Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com. [209.85.160.171]) by smtp.gmail.com with ESMTPSA id q6-20020a37f706000000b006ed61f18651sm10294785qkj.16.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-f171.google.com with SMTP id l2so11220305qtq.11 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" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668622614; a=rsa-sha256; cv=none; b=GjfGLi0lz74g58cdSB+86KRktNrWlP/odWdvmMEtzA4FFgmAxB0cGJXfgZblP2rU5ZuQkC BPmBO5gEzUl/qxGH3EztyGtdJpVGspzjo4FRuDNsg2CggOnl8dYE7G6KISFprMowwL95zl GYHUREeYsPsrrwcprGrCTwPlLmTfw2M= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=eH0YS14V; spf=pass (imf16.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.222.174 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668622614; 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=PBgZn+u117R7gFQNpsnvlIYlwSeo0LUTLoxlFKr3wyI=; b=LpvrwAtQwmRYtnt5X8WvSZRP8WVK0G3zJlKebhFH0CWnZZx8TuATu4TqZQNfj4N/IEB2uu uAhGLIJg524Eufis4xPsyxXIMo4qbmHKlHlF42J0avI0rCVeBH7ynI/Hh3pNW5uy8lqN1X n1cQ47LjQkuL8nGl6xb+1xsAEKY5RL4= X-Rspam-User: X-Stat-Signature: qxt3b85o51973powcsk6jai6ibtjk5in X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 9F34D18000A Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=eH0YS14V; spf=pass (imf16.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.222.174 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-HE-Tag: 1668622613-401804 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 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