Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2167009rdb; Mon, 9 Oct 2023 15:19:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5j11cXCM74kpYzWTjZmnpToKU+wgVCp9UcuSzXSqwsmFkpZyksY9wYdFYz/1hXi3YK+Aw X-Received: by 2002:a17:902:7682:b0:1bd:d15f:bdfa with SMTP id m2-20020a170902768200b001bdd15fbdfamr11653791pll.68.1696889979944; Mon, 09 Oct 2023 15:19:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696889979; cv=pass; d=google.com; s=arc-20160816; b=sfjFlcexPsajhYYStPRiRUPQWOdOaVZtyxXwZSuaTrLw9cCX7HYkVcwBjHKVDFCvS8 aaJTXPd//bZQGaQGz+rWif7aI4Sf7ln1DL1O4bWO40HX8HJpZkQxPRB5yuHNjcrglH8g aPivNPPBfYDfvvVCPbRz3J64p7lhd6QR0rfL1SSkmYJX+nrkwWGMN16BP15GCg3+5Ha0 Z24omGl2ostmurZh6SqV2B8k1rD0vASKtQzNvIPAqZawmlaeh+2GPvcYIRBynwWaU7BO MnvukyIw/qb7ewalL/ruG8mAYGb9PtEokHdXlMNxTR1mD42RHZLiNeiyv4Zh9xJv9gdM kZNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oee/L9NO56WFyPqdSGDL0rghx/f7Z3HNHj8Ot00tnHA=; fh=5yNDa4NxZzJAYVQ40v2UpxvkigO4SG0g06GcCBDt+9Y=; b=xHoskBfgLIjQU/h3j7ILybi1WjAFVhSfEaHQO03uv6uAam357OnMfBQOwfBESfXo+3 iRsBd7062j8/qTyD2svdQJ/OFJdsc99KgnphPZ1Zp6CHGM1bHqXv1NQiqYYo25L6z5q6 EwFIDX0LdzEPTZ9DGatxjdtz8ncrQ/3rxHzJ1EZSHiElBvFKRDfBBiTx4RK79gBD6D7e NFNoeSRjVM26mgi9xpyPZJlifI4pCbE8gj5RohtFN+GEp4obFXATSPG9dacOV1dnf9FY PZHSN9OkVIALXl3rpLfFM07LPCq8kODJca4HI5eR4pwdmqJ0C4RYmRi15YxYmvDRi2fK 4qxg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SjRpm97h; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id km5-20020a17090327c500b001c3c75842f1si9936192plb.14.2023.10.09.15.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 15:19:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SjRpm97h; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 9B45881E3B90; Mon, 9 Oct 2023 15:19:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376891AbjJIWT3 (ORCPT + 99 others); Mon, 9 Oct 2023 18:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232390AbjJIWT2 (ORCPT ); Mon, 9 Oct 2023 18:19:28 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2041.outbound.protection.outlook.com [40.107.237.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED66DAF for ; Mon, 9 Oct 2023 15:19:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NArmRUti+Jv/O/fnxey4n3dL5MfV/bJlYyD8kXc7RnoXmWb2bd2iZ/eKJaKdDO6tnNGRqzE7QLlDRphNUQmJIaHlrqmOFtpcTk68i3y6c+9qMJ8png8teIpxIdhHg4WXpq9JjKIk5YhGvX+XyA6EmS2ggEqLxP27c9cFrqs4kpspPnk9kDexa/XED4WppNrx8vs61jJ0d3IkE0yfoWjdNsZQJw663pH22K9F10muQvJ2XD7R37F8XS2k5kcvtU5i/tLsB+x1LFkW9myXyfvziqid94TGe1PO8ttfsasSfNlJkP3ObpG8qVnNfoXW6cxFD3i5ew8KlNwZhyCRlgaleg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oee/L9NO56WFyPqdSGDL0rghx/f7Z3HNHj8Ot00tnHA=; b=Ew535213vOVV9wBMuvJShOyA5nRcjfugfsBsP9Mz65vliQ43Chj6PV4YOg9vc0jCt9M3uJ3YICOk7QMmzdzFoTL5rKL/UZbssUvypedLE/g0UIqLtWP2i7vu0o0AajAATcwWnZyu51LVOfaYJ7RfpvA9NXox56YuNVMv6u/4O+UfrC6E0GLY3jMBPGRqXfYHN04rjc3LiTTeLN3X211kGZ9N0OUZ/qA+s1IT+HVR/E0XQcc2mKojOApX7ce5liNnS5/CgodWRgOxRMeOR5Xh4qFUmhHlQ6njlEhaUUXnnEjGQDweYGE74O0ShpaNM5dG4lZT1usu4ntdjSn3W1vZSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oee/L9NO56WFyPqdSGDL0rghx/f7Z3HNHj8Ot00tnHA=; b=SjRpm97hGhuqhL/rie4Kih/sYmXBeBHRizJ1I0ofjaT4pUSBV4oCdIhxDFWy0bT+5sa1Q4zwrnI4UGPQIShWr5/EAreW60uUsfmzIxVvBVojkuL64mttttnZ9AyKJzx6JlrIFMewi7NE3McRcj8rh8ShTTIBDhQBGDz/lCkX86diVqtGZ5FjBO6U2MAXAdpr7m+jpqC+TTP4IvrSeuf6tVS94zryE2YSSB/Mnjp1B18DChwWpbWhgo5k8X9K1jGXKlTWf4CvvoOAQ0EQuwBPbRjsBvDR7VlOgPdmmqoYP0S4R2kMc6uXelalgbeG+trGV4367hpcbVnmSWoq2hw3uw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by CY8PR12MB7243.namprd12.prod.outlook.com (2603:10b6:930:58::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36; Mon, 9 Oct 2023 22:19:23 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::3f66:c2b6:59eb:78c2]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::3f66:c2b6:59eb:78c2%6]) with mapi id 15.20.6838.040; Mon, 9 Oct 2023 22:19:23 +0000 Date: Mon, 9 Oct 2023 19:19:22 -0300 From: Jason Gunthorpe To: Lorenzo Stoakes Cc: 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 , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Oleg Nesterov , Richard Cochran , John Hubbard , Arnd Bergmann Subject: Re: [PATCH 2/4] mm/gup: explicitly define and check internal GUP flags, disallow FOLL_TOUCH Message-ID: <20231009221922.GC3952@nvidia.com> References: <5b20f3cda7cd841555c2626f98d23aa25a039828.1696174961.git.lstoakes@gmail.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5b20f3cda7cd841555c2626f98d23aa25a039828.1696174961.git.lstoakes@gmail.com> X-ClientProxiedBy: MN2PR07CA0011.namprd07.prod.outlook.com (2603:10b6:208:1a0::21) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|CY8PR12MB7243:EE_ X-MS-Office365-Filtering-Correlation-Id: 35e09d08-6d7a-47b8-7c21-08dbc915ca4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W9YEgK5uZgOyGCCYsUVXoFq/cylAckxHqeQBaUJLNXELTwvwRVvdjBtWpkTkz6oebBM8F1JxiNcYehT7jpXtuEB4j9F11ad1Owrt+BI8CbyeaJdvbQFI+LW0ZuaSis64PhcJ1bC+V/f0xgIjNkQynEIjq8b8mr4s4FRAhdz7OvANZ8G/8lp67kIxltQ+WB26ydmoYF4SLmtfLTHigRTlQw1DrXYY/nZ5ZyP3//Ux3mIIMgjLzlsMnxL+UxrSPqbtlbcm6IMyrNt0hkw3ROZR5cjJw07BA/E3pqqmV1uJW+AuHx/XmVQbblXiki5BI7FDDkwVIRvNJqT/5IlITnwUZ8qk5N4zuaPgKbu0Wk/inhWFGyCGbtiPpsVHHpBxcuxQkrVTbCBZYX/QNnXH/e69eLL9NMJectAjk6Daxf5LULxPfiPIu2bLMSoQ+/fDQ41ivPz31j+HQrbBvZBsZXu5aOy9uyl8+WApqLj6u1FMN6Tg5dxcowxztEk0GfGRJWfUP/wvuBqApuXt5sOEr56ii+894cRpSmEWItLuJqGtBj1rS0SyuVB7ZMC2bu+e+Lsh X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(346002)(376002)(366004)(39860400002)(136003)(230922051799003)(64100799003)(1800799009)(451199024)(186009)(2616005)(1076003)(26005)(4744005)(66476007)(54906003)(66556008)(6916009)(7416002)(2906002)(66946007)(83380400001)(86362001)(36756003)(33656002)(5660300002)(6506007)(478600001)(6486002)(6512007)(8676002)(4326008)(8936002)(316002)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0Wk9/ThpQuTMKlTiOyQdYGNdxOL2TfxZMTndV1E1H8/ArcnlNs4Z/KVb6AFx?= =?us-ascii?Q?MGyiru6PwilwzzotibN+LeWbeuB3H/qli+kF2p0GVKawoup1Vwd4rIs5E7Zq?= =?us-ascii?Q?kG6Gav73ks7OPOG2pLFvEKjvarYjGAZqfOLdFaLJvXfXOicdptOShmlkRDlU?= =?us-ascii?Q?y96FeIZMAp8l8OjLH8XZr6KNw9ocPbTRtzLuryrAM2gZVOG/D7NFvzaYSZss?= =?us-ascii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N2F20OuvZuUlipe?= =?us-ascii?Q?GnzEn4pscpsxP4sfbIfgPsKO9zBrMd1100KRHZGy8xrF9uoBfwd868MCYQ+E?= =?us-ascii?Q?oOWN+GVG6npLjKnFJmrNj97ogOTZACTt6IdzIiLpDbC5jKHT3cw6DXDdkDJM?= =?us-ascii?Q?QJSjgG7CfbJI1LqqSgjEmRscTpLLDHzgk24xWSEj8tKydTwpaeVsHJPhpmDy?= =?us-ascii?Q?NV6P+4O33awTmqGMYB+ObEfOHU8Q/87C+I3Ztuc8erDeOvmBVPXVm6b6w6Fs?= =?us-ascii?Q?Kn9zh2DUBdyOxtRuBpd5Nk9h93VeaOV5aeiy1oc2W6SRg+Yq89YO8pJlwrA4?= =?us-ascii?Q?0qWFKEYsc/QCwGcPHKNxx8JDrFLWMR+hDCt1yP8P/DNJbKvJMAQARruKUOxe?= =?us-ascii?Q?BzlJ45fLSaVv3+JUkQLq7zYtgpEusr1fnFy4yOTQvzS8aOkzB5DfbfBo/w3r?= =?us-ascii?Q?UmqR7h9124vevSqbH/o=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35e09d08-6d7a-47b8-7c21-08dbc915ca4e X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2023 22:19:23.0024 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GxxZ7UA7zhfxTp4dJP1UdPv2CzWSZfhXFYpTpzF1lwA1hSd/rhvBNkhe//AIebpj X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7243 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,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 fry.vger.email 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 (fry.vger.email [0.0.0.0]); Mon, 09 Oct 2023 15:19:37 -0700 (PDT) X-Spam-Level: ** On Sun, Oct 01, 2023 at 05:00:03PM +0100, Lorenzo Stoakes wrote: > Rather than open-coding a list of internal GUP flags in > is_valid_gup_args(), define which ones are internal. > > In addition, we were not explicitly checking to see if the user passed in > FOLL_TOUCH somehow, this patch fixes that. > > Signed-off-by: Lorenzo Stoakes > --- > mm/gup.c | 5 ++--- > mm/internal.h | 3 +++ > 2 files changed, 5 insertions(+), 3 deletions(-) Does gup_test still work? It uses FOLL_TOUCH? Hmm. I guess it was broken for a while anyhow: /* Just the flags we need, copied from mm.h: */ #define FOLL_WRITE 0x01 /* check pte is writable */ #define FOLL_TOUCH 0x02 /* mark page accessed */ Aside from that this seems OK Reviewed-by: Jason Gunthorpe Jason