From patchwork Sun Oct 1 16:00:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 147172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1103110vqb; Sun, 1 Oct 2023 16:46:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFIGoiTZJUH6sb4cvqndALJR/CZb8r166XWgGIXfAb/kJR9B1ZwdEOdF6DlGH8ylFIowiKx X-Received: by 2002:aca:2415:0:b0:3ae:156f:d319 with SMTP id n21-20020aca2415000000b003ae156fd319mr9706092oic.45.1696204006755; Sun, 01 Oct 2023 16:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696204006; cv=none; d=google.com; s=arc-20160816; b=C4+Ep8mDfC/LsEEM2t5jGb9txikOUfN4jF9DJLkRVXbpfyH+CuiMWEOIZiCrlG5nE9 fJws5iN9eoC4CdcHkEXroM/9TsFIUv8y/9KdMYKtlf7MH7WzY3NWKpTMh1U91r3w1WtZ LpmAGeeADA9ed+pxyoAdw4mHNUki/zpLJjXE66W+yUO8fA/0K2z3aJ+sU6nEgSRoIsIs nSs1+h/fVivNtqpk4GJPouCqBobgP4PLVCS9ii35OeriI80po5rJxJemMlAiIdh3lW59 eUce0L2O8+EVRUxE3GpQTFecp7cZoxKo+HnOUdvEzx0NUFfV8z6LcvX8LYv7hPptjDRV 440w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pfhqMS4SBWNsRFumL7f2VoNpk2TCo8ZgiAHTNGqiqHs=; fh=mNvOpR73OaUnRrr53gRvslddDUjaIrpQi7RNpkp0Veo=; b=pXTmy6agokigxDnkLzcPNi0exVWDKzVwdBBfoUqgUeNsH832pRrdOaUW97v2qmkHzQ Eml+ykFGdEI4jUCQKeXKcC92/OfNd5yXoUmjtx9XLz+mHSTq39rIx1rIrhfveOn545qr 8J4jCzEyEbMT4rr1Jj8VtlJY9w2YuUIYtv72JOddf2wn31Cp4Gc0iaRLLSXASp7nhNAZ U5xTYBKFK5qjhp/F3zjNjkmU66yap+bPyxut59pV8NA0wgFeAKOGAQQNNAB75lhDVYXH 6JsZdqnw1K7H5NRjT4y4XrHh75mnI3MBL3DxMDB7JmagPEYr/EvWPjZ3rvvqsYFQ5tfM Nc5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OL9jdxRb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id my11-20020a17090b4c8b00b002777d51e89dsi7123882pjb.128.2023.10.01.16.46.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 16:46:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OL9jdxRb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 7BB00806FB51; Sun, 1 Oct 2023 09:00:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235184AbjJAQAR (ORCPT + 18 others); Sun, 1 Oct 2023 12:00:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235186AbjJAQAO (ORCPT ); Sun, 1 Oct 2023 12:00:14 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 471B5E3 for ; Sun, 1 Oct 2023 09:00:12 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-406618d0992so18458715e9.0 for ; Sun, 01 Oct 2023 09:00:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696176011; x=1696780811; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pfhqMS4SBWNsRFumL7f2VoNpk2TCo8ZgiAHTNGqiqHs=; b=OL9jdxRbNe4765piky1C++UOFN5BOfkLGtMtaUCnY05qx7TND1M+mmB3wInOdtdTxm dIYYB9JZI3uQpKMnzC7NrMJJtRIGF768eq9z5bT1QKwgZHokRcCfNIYmFQsZvrGRmVif aR+qF0sn0LknzKCaOiFfqAR0r8v/ybbj4YfTSA3/3J+i4B6eYSi+ekEUFooEyOOfG2m1 vLwUSZ3w92QTxt/8U3rpqVfO2e6h0JF6+bq4UqGwbv1J3u62Ew4gRNP42RiG2s9goLB/ 2HJrRilNNXjTHCvJ5+A2D3rDBFXdJzIre2NQ4YRomx9/2JJAml301z2HdYMceG6l1/W0 Vo3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696176011; x=1696780811; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pfhqMS4SBWNsRFumL7f2VoNpk2TCo8ZgiAHTNGqiqHs=; b=Qp4/cpL3+UmQtrnb4MREl2w32RGLVuP4RiOZuPIh7Ht9KPoqrstjSfaCRKujcsXx6k a/rArB7wSi4EUamQ37QsAHGRprNlOTXUuAX9NkKpmpPfwV48jMjN+Tkyxs14WA49y3mO OAlhCy2m1gHBbmGfIVOjI5fKm3YZQ7610T/it+AIFrpf1qSisyHeGJwAuZ5LL1ZDdNGf 2dMjYE73yyJrSSP8Hggl2NE3IAJO3PryGLVrW+K4YqF1GcU7zgQXqR0Xgw2SGe6xG3Hi J7kWfgFglhcbZRAnKcEWgWSuW5CJkvkmmS3G+g27oLffmzBOawKR1vXftyH+1ayl2tPv HPXg== X-Gm-Message-State: AOJu0YwqR7Sau8PcJmL1rSafyCWD/a7mQ4HIGSWgkawKh/NDw/VYFReh GkRfT9DeX557J1BowmUj5mg= X-Received: by 2002:a7b:cd15:0:b0:401:c52c:5ed9 with SMTP id f21-20020a7bcd15000000b00401c52c5ed9mr8350531wmj.32.1696176010384; Sun, 01 Oct 2023 09:00:10 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 09:00:09 -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 1/4] mm: make __access_remote_vm() static Date: Sun, 1 Oct 2023 17:00:02 +0100 Message-ID: <70436dcf596565770e604a4fc4e8f27a14c85166.1696174961.git.lstoakes@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 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 (howler.vger.email [0.0.0.0]); Sun, 01 Oct 2023 09:00:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778598812339444499 X-GMAIL-MSGID: 1778598812339444499 access_remote_vm() passes through parameters to __access_remote_vm() directly, so remove the __access_remote_vm() function from mm.h aand use access_remote_vm() in the one caller that needs it (ptrace_access_vm()). This allows future adjustments to the GUP-internal __access_remote_vm() function while keeping the access_remote_vm() function stable. Signed-off-by: Lorenzo Stoakes Reviewed-by: David Hildenbrand Reviewed-by: Jason Gunthorpe --- include/linux/mm.h | 2 -- kernel/ptrace.c | 2 +- mm/memory.c | 4 ++-- mm/nommu.c | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 52c40b3d0813..7b89f7bd420d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2415,8 +2415,6 @@ extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, unsigned int gup_flags); extern int access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf, int len, unsigned int gup_flags); -extern int __access_remote_vm(struct mm_struct *mm, unsigned long addr, - void *buf, int len, unsigned int gup_flags); long get_user_pages_remote(struct mm_struct *mm, unsigned long start, unsigned long nr_pages, diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 443057bee87c..d8b5e13a2229 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -59,7 +59,7 @@ int ptrace_access_vm(struct task_struct *tsk, unsigned long addr, return 0; } - ret = __access_remote_vm(mm, addr, buf, len, gup_flags); + ret = access_remote_vm(mm, addr, buf, len, gup_flags); mmput(mm); return ret; diff --git a/mm/memory.c b/mm/memory.c index d4820802b01b..e2743aa95b56 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5881,8 +5881,8 @@ EXPORT_SYMBOL_GPL(generic_access_phys); /* * Access another process' address space as given in mm. */ -int __access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf, - int len, unsigned int gup_flags) +static int __access_remote_vm(struct mm_struct *mm, unsigned long addr, + void *buf, int len, unsigned int gup_flags) { void *old_buf = buf; int write = gup_flags & FOLL_WRITE; diff --git a/mm/nommu.c b/mm/nommu.c index 7f9e9e5a0e12..f9553579389b 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1651,8 +1651,8 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf, } EXPORT_SYMBOL(filemap_map_pages); -int __access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf, - int len, unsigned int gup_flags) +static int __access_remote_vm(struct mm_struct *mm, unsigned long addr, + void *buf, int len, unsigned int gup_flags) { struct vm_area_struct *vma; int write = gup_flags & FOLL_WRITE;