Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp951649rdb; Sun, 1 Oct 2023 12:34:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQprD1C94KXRNHLo/US7ZF2DjspxMH5/MUCCRCYmikR39q194Cj6oOSmzqgJTLDDCAlAhE X-Received: by 2002:a05:6870:230e:b0:1bb:7d24:eabb with SMTP id w14-20020a056870230e00b001bb7d24eabbmr11223331oao.0.1696188853844; Sun, 01 Oct 2023 12:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696188853; cv=none; d=google.com; s=arc-20160816; b=ggKxN+DPochMrBujn7pXQR69ZNh1+IS2jJbeGsc+KmPW0+S1FgKkfIqkQACUw9dtTN +Iz5H3cbpA64fSvebqA402ik+46QxBZUelWty5dUg8ErWCYsWnrxa6AF1tARAPGAT03T r7xafInBIBFMcAPaT2KS2n+Tge7pulMCZL26zWBs9FnId1z7Qk/WHkI+ky8wGNZEErdZ leRiEhd8PSyYwBvHa9atVk/9vtqtXOr+tVwKTlvslo/JNzEPCnhCOAC/TmGheF2D3Wd3 6CZktFWY2coj4PPkK5QCf1Kwc/afRBoam+nYRRlhx6KTcHasLIlNQA5iksaAOVH4lnf5 b3Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=qbQ2+MNx7iQKlTg6jhWJ9e8ngVQbdAZdbk2tukIrGRw=; fh=mNvOpR73OaUnRrr53gRvslddDUjaIrpQi7RNpkp0Veo=; b=b88aluOWxPjkS+1Dz4O+djy2Z4adBix26azPFbgE551MSV4tNpcKGbrMzON7IhXfRM fcapSjcR4ZlGPng9poF01munkSqjTlO5GMvjHgF40mFADD3TDNq1IyqsGKpJu2qd0mnM h8xCoAAw7sKvW3srds2XLx7/71ijV76IDhZ4NJK13t3ZPzFJg81PQczq4BOmuq4GgobK mWg/sF4eH/UFe9F8yZH179xmXG/y7avv9YWmZlEh9jKrsIJ+f0Q8uC3kueNz3LyFNRFg OUEDkIw98B8eMk0rDVsL3N+7FVRoughkjYXKVbf0qlMWzW7LvOfhn3Aunw1FSKhT3I9y DQsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IVRm8T0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z1-20020a63c041000000b0056ad77ddd4csi6217655pgi.438.2023.10.01.12.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 12:34:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IVRm8T0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 66FB2802D51C; Sun, 1 Oct 2023 09:00:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235185AbjJAQAO (ORCPT + 99 others); Sun, 1 Oct 2023 12:00:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235093AbjJAQAN (ORCPT ); Sun, 1 Oct 2023 12:00:13 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB3A0DF for ; Sun, 1 Oct 2023 09:00:10 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-406402933edso73933055e9.2 for ; Sun, 01 Oct 2023 09:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696176009; x=1696780809; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qbQ2+MNx7iQKlTg6jhWJ9e8ngVQbdAZdbk2tukIrGRw=; b=IVRm8T0V976mZ9cTdEnp23eUgJqclHZFvpe5N6nVDwaCGxt8aYCLNtA5lRF1MpPyUv 1XjtCpfA2GBvPb4ysyuutwMdTN2mw9cIU86LpPVaYHWXkhGBvR3Vfjbry2euyn9yKSKu k4KA90KaSJzrOsqqOG355vhEVv+/zoL32ibAJfpodhFLuamR7q2ll6KCKxO3g7UNJ/i9 WoqoTf3zRg2iERk297zbpPeMlyz6+EaXVurZ9OvACAmmxCFFgeC6oD7McpQVeq0SnAnL xcAHJJuHopkI/wJ6YJoJhhG6xHVTNVktruod3QpZGW2HPNlMHLyQfjkF3Ccqs6vbDdl+ ijmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696176009; x=1696780809; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qbQ2+MNx7iQKlTg6jhWJ9e8ngVQbdAZdbk2tukIrGRw=; b=bp+pw1DAJY+puMzIEebxSdQpoz2o/DJq3YcxBGH0dp1LxSPwRw4s1OueSvU4qt9o4d xWwoip+04JFlWKFkqof2SGVaKDh2tqdevQ5o0uscf0myHnmiH353zyx/FRR831yCys80 O/ZK1vaPqEwqhEk/KQIf1vu+rDkS2kpjQ/cm5zmK4ruYHgGIbYLgltLHOeOXqID5C8R/ IGBYx36eV45Zt50Ykcp8fBNFfha1KuLlG06m+TSgt9DXViLz10fzaO1O06YXcNcfaIny 1Mt4mbmAXlFZSt8tsj3K87wXbPeO0TNC2cW7OpUQmER71/fcwG0CBHGrWKy01n1npGKq 2GFQ== X-Gm-Message-State: AOJu0YzDovH3uxB7PgA6HXtfWfdwh0VN3bQ6Z4Lwp5LXq5narPR6DU8f /3oo861ooIhv6Mrc9fmPeDM= X-Received: by 2002:a05:600c:6027:b0:406:535a:cfb4 with SMTP id az39-20020a05600c602700b00406535acfb4mr7987766wmb.1.1696176008738; Sun, 01 Oct 2023 09:00:08 -0700 (PDT) Received: from lucifer.home ([2a00:23c5:dc8c:8701:1663:9a35:5a7b:1d76]) by smtp.googlemail.com with ESMTPSA id s16-20020a05600c045000b0040536dcec17sm5487695wmb.27.2023.10.01.09.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 09:00:07 -0700 (PDT) From: Lorenzo Stoakes To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Catalin Marinas , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland Cc: Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Oleg Nesterov , Richard Cochran , Jason Gunthorpe , John Hubbard , Arnd Bergmann , Lorenzo Stoakes Subject: [PATCH 0/4] various improvements to the GUP interface Date: Sun, 1 Oct 2023 17:00:01 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 01 Oct 2023 09:00:16 -0700 (PDT) A series of fixes to simplify and improve the GUP interface with an eye to providing groundwork to future improvements:- * __access_remote_vm() and access_remote_vm() are functionally identical, so make the former static such that in future we can potentially change the external-facing implementation details of this function. * Extend is_valid_gup_args() to cover the missing FOLL_TOUCH case, and simplify things by defining INTERNAL_GUP_FLAGS to check against. * Adjust __get_user_pages_locked() to explicitly treat a failure to pin any pages as an error in all circumstances other than FOLL_NOWAIT being specified, bringing it in line with the nommu implementation of this function. * (With many thanks to Arnd who suggested this in the first instance) Update get_user_page_vma_remote() to explicitly only return a page or an error, simplifying the interface and avoiding the questionable IS_ERR_OR_NULL() pattern. Lorenzo Stoakes (4): mm: make __access_remote_vm() static mm/gup: explicitly define and check internal GUP flags, disallow FOLL_TOUCH mm/gup: make failure to pin an error if FOLL_NOWAIT not specified mm/gup: adapt get_user_page_vma_remote() to never return NULL arch/arm64/kernel/mte.c | 4 ++-- include/linux/mm.h | 18 +++++++++++++----- kernel/events/uprobes.c | 4 ++-- kernel/ptrace.c | 2 +- mm/gup.c | 16 +++++++++++++--- mm/internal.h | 3 +++ mm/memory.c | 7 +++---- mm/nommu.c | 4 ++-- 8 files changed, 39 insertions(+), 19 deletions(-) -- 2.42.0