From patchwork Thu Dec 12 15:36:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13905552 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 62723E7717F for ; Thu, 12 Dec 2024 16:22:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B18206B0085; Thu, 12 Dec 2024 11:22:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A9F976B0088; Thu, 12 Dec 2024 11:22:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A3756B0089; Thu, 12 Dec 2024 11:22:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 63D176B0085 for ; Thu, 12 Dec 2024 11:22:07 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 67DE7C03C5 for ; Thu, 12 Dec 2024 16:21:47 +0000 (UTC) X-FDA: 82886822760.02.652DCEF Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf20.hostedemail.com (Postfix) with ESMTP id 1FEC51C000A for ; Thu, 12 Dec 2024 16:21:17 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=B9ZGeBYQ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="O5nl/G4h"; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf20.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734020487; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RPMwFte6ft3Ci0McZVbfCvwGByLKCsXDAFOmeVJDhmU=; b=CkuA2NUXMd0KEi+YRBVdggd4nS3JFpgDGKiLusU5maxGObR+JRDOWECSBhtD2GmmYdfMgL mJntL7+Cn95zfFCbsxophIdoqP73BGuPDtfhXW8FEoP4S4rcSoNZCUWToDmRFOuhDWmBvr 8lViYjhaiNpksckO+ytCp1Hr0EaGMew= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1734020487; a=rsa-sha256; cv=pass; b=6Oi+5z+HR+c8q4+pVzCbsC6lU97QQImEvP68QscIU7P3cnKj+aAhDodu/gwLm2m19eHCe8 lAxTrrN9V2GJwga3qU92I34xOBjypUMCp44dtgrihsu8sXr7+SAFrE0u5NVa4zbr8oY4MO 3/sIUkqG42oY0+f9gjN+MJaxSClH5MU= ARC-Authentication-Results: i=2; imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=B9ZGeBYQ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="O5nl/G4h"; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf20.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BCCWuUB021240; Thu, 12 Dec 2024 15:37:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=RPMwFte6ft3Ci0McZVbfCvwGByLKCsXDAFOmeVJDhmU=; b= B9ZGeBYQ52FMV6+8w3ZboVm9zTmi4ewniviXP1xWwEp2vKhSmFyNq/ghUAS5Fw2i Rc1RfUiv6aQNMe3J79vnpV3olSm+7en/QaB5aPRBGs44BepqpwysWcbaEOUSG+sO scagjPX2byCPvRuonn8vQELp84mt3b91s+DaECSUzRn78fPMCyuSD1fIlYhBMF0C /fqmmnkf8dafaDAFNfeF2hMCeeBHqfw4ra6KIc8H+Hr3LUrkpoNVhioUI682B0w/ Sk2mWTyiMoWiaeGsWa5Cahba4Bma3yxiI5tNOzXSBDe8uMgJfaVBM/brcIv4ixVb aij6xu7UgDgy90T1ZJf57g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43ce89b7n5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Dec 2024 15:37:34 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4BCEwPSw020564; Thu, 12 Dec 2024 15:37:32 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2172.outbound.protection.outlook.com [104.47.73.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 43cctbap6a-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Dec 2024 15:37:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WWhF8gmf+rWIxDflVQXbUFBeZpoxMhpmZ7JY5FjPjVwWpjEygJrLSeUs5dAhYPlrYMQsLf1/lAmo7xN68kfczXRzrsrx+IgpEPTepv38QSRF/5BncivNJOm9/n8LPKlJ42dw1ALeF8hSae98hCFS+LBKx3atMad5bv7sic1TgsX6OjCPSQWKOLRfUVz1wch0/6r+7/pOcJ+ohMBoZErOpItFi+PLXtSkn9hHbZ5d79pXjEFXSLOr/wZHNqLOYR4i3cgK8ZYOhCrRb1YLFVvJ2tFtY1qmCxL9EO7Z/VOtF5CiBH5sDp0iMQbp5cq+Dmt2cpzmnQvUnjMV6ASn8xx14Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=RPMwFte6ft3Ci0McZVbfCvwGByLKCsXDAFOmeVJDhmU=; b=sUdbOhnGnrDHoPFtiqjVgma277XGv5rPVZdEvI3Coc0a5fPG2HFggsSHD1qVfjFGd32ZEFMrdJjlwoTYdud3ZvaZ10dTBpWnyl2puW2UzTJtVCkTC7YcFL/FL1wyow5de00jjaFPIns+b9Nf2+zwj8HPO7WdfJmQYCL+KiHeoyWFvvrko8IdkRwhuMpf/I1Bjoh/B0xXitzBxEa0iSJcTMHlWgYdV1gy+t+PQuwZ1wf9CnAyM5BVWxuCfJLBmyQKLSlXtvS/VssMxorURA7kEfExzsOuCNjxLY74ACmkI1AlrUDSPYan49HZGCBHTQeF3GZLyE3JOSRN/KDELC8nPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RPMwFte6ft3Ci0McZVbfCvwGByLKCsXDAFOmeVJDhmU=; b=O5nl/G4hZFlWV4SlrmEBEOiQq3EKF+EZZZO/2vFM3O9jB8MqqouK5y8/VY6TiVCZ9UWkadtGd6XOdZtZzUsygbS/t62k3SZw7TotMhydZvb1PE3afFrwydigxjmIe65u+pUNifLleGqpFwW+QUWr/+sWGPHQ7tftAu3ZZxswiO0= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SJ0PR10MB5804.namprd10.prod.outlook.com (2603:10b6:a03:428::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Thu, 12 Dec 2024 15:37:25 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%7]) with mapi id 15.20.8251.008; Thu, 12 Dec 2024 15:37:25 +0000 From: Lorenzo Stoakes To: Andrew Morton , "Liam R . Howlett" Cc: Thomas Bogendoerfer , Vlastimil Babka , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Subject: [RFC PATCH 1/2] mips: vdso: prefer do_mmap() to mmap_region() Date: Thu, 12 Dec 2024 15:36:46 +0000 Message-ID: <8f409e14df19bc722ad77e15ce03a95be9f829af.1734017293.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: X-ClientProxiedBy: LNXP265CA0045.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::33) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SJ0PR10MB5804:EE_ X-MS-Office365-Filtering-Correlation-Id: f099a0a0-3463-4a5f-50e0-08dd1ac2e0b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: bGTvdEdIDNqQYi41FUL4ImN96m4IQgoS9QMYXjAOgQc6h3CaKejL6nDInxwvonTagyckJ/BW1QQDMLHpGtSheEFVCitfUh3mli3TBlflF7dyJ0gkpJPcvb4dNNI/dWeRQqSLEhGqH4L7iaKhWL9pVRtAVwPV8eGQD5L7q6y4eWIQa9tqKpvt8fig6UxDgO5qoATK3c8R+qCXAI1+qcTlD1OFrnJGdZFH4n92StUUlD+KTUlKFYO9jSQItbaCziPapRPzdmk1uwzPBr9TnJIbdmGnA0uoM9ywz+IwEJJVYrzuDUX5uPUXFvh02tkTTsa9/4ss+TW8UxYyTXj0ywPrHPZeNK8TnK1fuN3cbOdTuj4j08rXiOZZCG1/21j8e2Ki7pnJdEtxutypxIMwFuLELxFsMMmC6xkWI4YddzDw6+zZv44j4VVY6dj/y+g/z/CpO0s8RSv4O6bWPzwo0PRzRxBkZw5DbE1IHdIt/GDBbldBDpVavvQDWc1J4puTo0ZiC76TONIzRQQxACX0ymvvhODjfQ1E20wbWprayb5JDlwahR2Tyn1EryZmffP8TpFsBXbXQWDoWmqg6Dbid4chAidTGwEBuPL97y/ZRulntz6uqTGWm+vOesEDUbHOYy7GkkZhiK1+RUO+ng/M5J+bZeodO2QlrOM+RlRMPm662YPAaZS5jTvl7oRwxURG/fVgVLPO66mn/+dzmqbUnrEJS4FNeXgU3mdmtlcmqB3cfJGH3LhIG8/mtHELHjIyLjdU3KX5twG7bVyLRHe0js8liLYeN4p8DPM+NDQ0Ffs+olRwWm6Iz2eSD6ffmVCnCYeQGBUDSx/saXvpRJZZY0tWeL/Y239hHETbCT4UDM6pSphYtQoKcmAN3DtnbpIS418fh9A+JOww1qPy7i1eP0lFFiN1m/x9QDHBX+Fmt/cYDrIdczA5HRZQSX3ac5hEpxNivLrng8+uaylSFyX6i+OKX53n0EnyNW/9jqO36iOIIfek+uwHuBJHEKCfANK+ZIDzecGg5bWJLAT0amOhTsRueXyeFAYxv7kJv6xQxQZSPFg8XRmSOCymwKnKHLiq8z32UnP6TCQUYbwLE809rPB0ZP9QDigQyiW1SIkAnu/V7kBmJ21qQlG2EezTZA/APC4oDYqiYiqcNOQ6pO6x8EPjx+/X5q4EOKuFB8FTNgDNqVXXeZc14cQeEHOupuOoLaTiGrbuHVsKx6H9I2pUDgXFQfzdqu0o7Ykzdm6iZk4FnzbfK5giOJMgia00mt35MjUYwuKvMG58IJloxb3B69cjTbf/dqbJw2btLL/0ShKazfvdc+TQu8GLa6qkGuOnCsiQpY5UyJr3FkPEjwCpRkzlDg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RLRQDns1jM5NOMCDnwN9vbIAa4uQeIzJe9au28S+1iogKa+MKUCtZQzLvuG2xPFE2An+YhgDimKredx5yyO10yx+XSDhMx4qYBqeGmQSwSfWZ48A5sWxuVpmJwymeT/qrkH3bST6bzuHZFD9dmPRJoIg9xt/kfRjMnVyxeMDqc5Jfq0nt2V8rFzrQmEBvJ0T0EQ+umlVBLCxK2Gr/pQN3rZ8wXtEny2H8CgTBTok5XsPve94QCbuvMUPbw1FnLjC4HAGR7OodrZZaxg1iagw3voZwA+hPUooBfmzTTxKPrjE0itQXGd6NtrV39PLTji7rBDfHiimoAMCIRKxM1g1fu2MUBFmeGa4XWIPTM8SMP8yC3B+jCpDipYeUkH304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9re6Uj+RDP8v1RxAzaJkkGFGwiEAfmA5HeP2cjSUAAoKWu8Z2O1H2iX/1/aEVThAQDZsfw/ZNYAlb4HDGy2ctSxN1osbAFEuD4rai//rtwTS5zfb9evuXT815uza+w5ndMq+48QzNiQgD4fJujkd8y7zrg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: efU9GH6eYvvN37shz0XffqawmYO6LJ1us2ZGGifxUOetXkLLVgCJeCTy24w4QJpGr6Xor46ibLH0DUHh7zhmcAEwcaES8xQqf4Q8KrUOSbW5koOFS7tQVe1M1fjCpsk/gXWBKwmAUT0c1BL8H/HlxpZpj0BMRvhEA9dLHVWpJTG96jAeMpmQHipQfP54jAoQqQLtYWZ9bWWCr18UuC4rCAIzJcs6NKq7gpmQxQVjsb8/mbpvJj4tviVSMn4H1RMkK4s3Q2MkmEjTAkVEo62cUCNJ0qiP1vSV6XFbw2+M2Z6pisow0pUxbrqIlPJf2OqYlUqM2M/pMsE4qWyLDo96+ds86QtBlqAt17MZ/lBO9o8inxZ27mfpYUzvG9O6T0k4CNEahdhEZBUL0SepUtMBocy+oPypTF36tGpgEsFLQPKwAnzHwcV9j3tRfOzeIIC3daWNLvmHPnSAzuE+yEppEvrZEWFi6po5YWyLemQx2dxr8UT1PPXapUBWvUZ1K7tgPSV74a5vJqVln4rM46U6BvhpkFWw8NBCTjIKrh677CsfwoAYaHn0y3ImVp+uNUwZAmbkbv9FPFze9x+TzGEAo4d0PqKNlLGJYyaB760H8TE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f099a0a0-3463-4a5f-50e0-08dd1ac2e0b2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2024 15:37:25.3343 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eOdtv286Klh0Hrje8tn9fionBJvrnpTrKkiZ/XqcKDsBqeWEC9lF8tVuyvXioTxIYkTIeDJ4JfOZh1gspcnSbdDg+VxuXBjWi6qHINmzRpI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5804 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-12_09,2024-12-12_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 spamscore=0 mlxlogscore=951 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2412120113 X-Proofpoint-GUID: UAEX7khZerWH3AYubgYG5VDGzfDvM-L9 X-Proofpoint-ORIG-GUID: UAEX7khZerWH3AYubgYG5VDGzfDvM-L9 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 1FEC51C000A X-Stat-Signature: 6u9xhyemzyenuatuf41rubjnkh8joif9 X-Rspam-User: X-HE-Tag: 1734020477-838254 X-HE-Meta: U2FsdGVkX192vg72TwK16z+la4LwNiF46PlT9oVqhEKj/8urH0CbJ1NJh7THOqgxOQAp67Ew34Xn1WbFrvqjThI0qNo7eaZKF665HU/dzKE18ETwYz1ogvBG6G16XBGipDxNEeSMY5SUAiKtpBYj4DG9mTrUQb1AAZ54qwXNEgxaR5RMATAyiTUzDon+l2dkYehvqsqA8b0HaOracuCYt5sT32diTZCTIgaRYcAj2jDhL3rghCPQ9qArK0uq8k0iwbIU986WqFHLQVAlCL7IsJfVel526yn6y0Bk8EznQ8kXCYupIzOb0WpWV8r1wJRZHqvL/whaTH2jf7VmVfL1jjG9j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m6cZrrovQOc9AhNMVl/wZRbleOWdT0PUuog28MVYBhv05mN0YgnxD0S72b0r7Ab8wvkO0dgtibIJN3iKORA1swhfsAcF5C1c7OeZ/AMryZrRRGA6EYX9im7t4c//4cuB9ALxsf11DVTzQg7Jm0Vpct+4c75wXL2tmBitL8z/wbMyZjoFbijRfvEtoGQGtlUztiqN5Vl2p37cL4iAPMGJRfOKWu1cFxxAvdqy383ThD1eyOkkIiNQ== 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: List-Subscribe: List-Unsubscribe: mmap_region() is an internal memory management implementation detail that is not intended to be used outside of the memory management subsystem. Map the delay slot emulation page using do_mmap() which makes use of the already-held mmap write lock and bypasses unneeded populate and userfaultfd logic. This should have the precise same behaviour as the existing logic. Signed-off-by: Lorenzo Stoakes --- arch/mips/kernel/vdso.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c index 4c8e3c0aa210..75c9d3618f58 100644 --- a/arch/mips/kernel/vdso.c +++ b/arch/mips/kernel/vdso.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -97,11 +98,12 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) return -EINTR; if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) { + unsigned long unused; + /* Map delay slot emulation page */ - base = mmap_region(NULL, STACK_TOP, PAGE_SIZE, - VM_READ | VM_EXEC | - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, - 0, NULL); + base = do_mmap(NULL, STACK_TOP, PAGE_SIZE, PROT_READ | PROT_EXEC, + MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, 0, 0, &unused, + NULL); if (IS_ERR_VALUE(base)) { ret = base; goto out; From patchwork Thu Dec 12 15:36:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13905392 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 E0C2EE77180 for ; Thu, 12 Dec 2024 15:38:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FF596B008C; Thu, 12 Dec 2024 10:38:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AEB36B0092; Thu, 12 Dec 2024 10:38:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5031B6B0093; Thu, 12 Dec 2024 10:38:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2BC216B008C for ; Thu, 12 Dec 2024 10:38:55 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9EFC014035C for ; Thu, 12 Dec 2024 15:37:50 +0000 (UTC) X-FDA: 82886711586.23.3CED2C1 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf16.hostedemail.com (Postfix) with ESMTP id 31E7B180010 for ; Thu, 12 Dec 2024 15:37:21 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=mtw6gbQw; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=gl8Y59Zw; spf=pass (imf16.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1734017844; a=rsa-sha256; cv=pass; b=GQ79cpoWN9WAHtioIgJURdlKttWqUUO0uLmJ19XnVf8+4Ahxd8RcoPcqvUdDmo9Q133ikf p07i4+9qhrSiwgz2mu+s/VU1jS6R16TCItVuhiE+G7Ro21JaELrJ+xpgyWNDfiznnnETyu cSNweCLrWGajpxK40HyC/J89ahaw6hA= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=mtw6gbQw; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=gl8Y59Zw; spf=pass (imf16.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734017844; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6HkV2lyfUu+yiBqw99Z+AS5m2F7z5xSUawErWoaPIcc=; b=aRFc4ErXJWsBHGS4Wlj8NmxiZ5E1IhWY8J/kSdc8/Bg9ct+X1JBD5/id29Z9n7J+3mtigc NzmZPtGHEJ/QZxTnLmiatLtC/0piTRK6EDbPaQOeRmwFiYtcGvtWwmIbd4yGvAx+50I4TW I7s4c1b34klrqKN4FueTw3G31d2rxJM= Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BCCOBQR005387; Thu, 12 Dec 2024 15:37:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=6HkV2lyfUu+yiBqw99Z+AS5m2F7z5xSUawErWoaPIcc=; b= mtw6gbQwGuy01rwXIduakFecrcKKfLEbR+SodFq7AkLJDKruD8V2t7tw7Z6kycP+ 2P/QYhAvnJnrnTm6xsbPYx5ULODZ4V4hO/cRbqcceU+KslubEBscw792CVn2vJRp mqRCq5yORwkyiGJCo/PuTcTHtVMQteEWoTW7g552tiWiapd6j0nlD3gB47ZAR7yG oFMKc6yIR+NiHIpQTwxopQaUTHkadaQ8sMrV9eKLixfPZm/3LMLNnQFOCIZUo9wx rNAvcHo7S5g5yPdMgcsNV25JSg5CvBHPi2SfMq8P8S6Je33kLeGWABk023Dw7M8S TpNbnL/Gx9nGLd+zS59zGA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43cewtbgwc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Dec 2024 15:37:35 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4BCEwPT2020564; Thu, 12 Dec 2024 15:37:34 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2172.outbound.protection.outlook.com [104.47.73.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 43cctbap6a-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Dec 2024 15:37:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ru+WvEhb7A2g1vkMRDzwasnYbANkN+xSmaWHejjUIwUvTpUg9/8/ppxoCwSWiZAAzOtXmVmSijTvCFGORaq7OLjUvNESvCpn8uNVbLcbSh6yGoQIlnrWfVIYGUpG9DX1c6elRI03eH2zqbYMG7p8OxtFenVK07wL0U3gkB4eSTqfKXwbPRByAE/WP94cg+x6eFtVMaSaTLAXDa5rDbKSZdZF/7jcDbbyZmo35E04ujC+PCgCLxmDlFXKDm5ed0IJOZCidYbHQ3uWSjm/s8WYoNauJbJpYdjj+uhOrFiT08qfnSMTMi7MDASQ3UmVdsu9ttvV1yLf/gqTTVcskoWwXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=6HkV2lyfUu+yiBqw99Z+AS5m2F7z5xSUawErWoaPIcc=; b=bWfFUAQi7t3g1gpsfJnAcMAJ3rdT6oBmeSUvXaailpvWJPoT4UENFY0KKmqcq5nxiit5CbTAdtJwmVVoiyC1pLeto5wUFUFC91VefQp5cBmCXwHMee6ATyMByUzjq/LXhWRP40BwFmDZpFY/qDdnoHaikPHpH00DC3qy57iZWopP3D9fv2JPwTa6PCh5qfvdcwzRqn6H3uRm1oH0Gth0whoCMmZQWqK8jQmFOE+3NVNtV4bRS7uMx6JohrnBeLXJdyit86ZZZkvDyI8BvWXXlXBJEk+xUdStOILHJ6ZiJG/1wQFvrYNRG/a2A+34KhVlp3OK+657qmiorcDWkz0HzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6HkV2lyfUu+yiBqw99Z+AS5m2F7z5xSUawErWoaPIcc=; b=gl8Y59ZwHUclUhgCNoYcVyPXa7dXtCOYIIxbqBN4On/wjyvZCabSmrxtqL0gM6ecihJiWfKtM0icfayk56LetOFGEtShvQL6uaoL/r+wou5t2VNl4DQB26W+cLMDR5qKVDhZ1P2gSWobL4EfpYMBjNklsE1Io5GDfhKv2ie6/Ac= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SJ0PR10MB5804.namprd10.prod.outlook.com (2603:10b6:a03:428::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Thu, 12 Dec 2024 15:37:28 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%7]) with mapi id 15.20.8251.008; Thu, 12 Dec 2024 15:37:28 +0000 From: Lorenzo Stoakes To: Andrew Morton , "Liam R . Howlett" Cc: Thomas Bogendoerfer , Vlastimil Babka , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Subject: [RFC PATCH 2/2] mm: make mmap_region() internal Date: Thu, 12 Dec 2024 15:36:47 +0000 Message-ID: <80b7c4ba4f0a2b3084117975bd1af62a403ac881.1734017293.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: X-ClientProxiedBy: LO4P265CA0292.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:38f::18) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SJ0PR10MB5804:EE_ X-MS-Office365-Filtering-Correlation-Id: fae87885-9a2a-48d2-3c2c-08dd1ac2e264 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: upU9iMNSBTfqlKEWrzv4jHRv+0tmK66YXciEZJSsmBxi6mDzMsS/L8ME/QCPWHHesINOlR/B/tJKmHn+9VomHrmI71SLaoe2gokyk6QNkUPteXJGrOPCeIvSClzUiZthxzRVqjNyYQheHwiidD2uOem1D+LmGbAp3Z/4ikwa7lCg7/12/ALyUrguU2nKfH2mWdudvud4Utly2RbVEAvRWWVk9D+lP/HWy7FoGJLfsZJmjBjJDU/y5xvVLHdYf/bzj1DreohhZ65W8P/8Op0o0t7PRKdj8qW3k4SQ0rHVVWF377FJgnSrK5Yu893nwHpV3g2zD5+/xIaqr/rEl/UO56wTlRP+PBSn5oQ1EZi2POKExBMHVQvlfi7kv+yZAkKvaMGcVC1n0eT/j+j1rbtPQwcimTTsqOtMv+iC7mUPVN7k2xGdoY9SPhNXwWpg1CnIdxybmgOWQIFp8wvG+ZBf7PyO9H5d5OC2n32H6G4PsGOps5+5QRBRqZyLsX0T9Mj2n2XgfoKZihC4YyhJBgiaaVPxZHKiPllqQa4CnXEJpH44yZ+nUF3X7wsHAMLGufMptn7zkf3x9+S5FM5ovvwyyLQGoQjGvDJL9nDmxR2G8uQjU5+omajpzUYOOTD44sY9AUAnZd3z0ao5WeB+mq7hmp5ENyg3LgP7VZtNYhZR13v+ShRtOupPPY31z+ooCroOoOqLh9SKzhK/2b0RnFSFswXaJdyKB5coWKHnmPZFbIgHpqyPWfkkvSyzU7yK6FRbLcmudFx0cQUmO4inFtrGsoC/JAZJ5QP/oZQko4KRxWEAZ8vhKdA5iOEB4tQvnwOA6pl8Xj1mNgBo4Bw7q+WO0RzXTdnMZ8duRBDxrKw8AGfUt11V7tfxdpSLFtceOZRFYfPY/cy1k2djDBJtbFeE8V92AHhBGUy/yfbCGgv24fh+qog8kCi4H8JuPfesyQvESQlPXlWJdUDKBjzozXwyD3YrIFZIMKe5RUU1fXz7JEJIWvTjdhHITcoKivOrd2QtFcJ4Wb55RAXUn3kC+ovwuq2bxM/Ft46yycNNsJ1oBhUr2ju3WK/MzGIayIu6BNgI1eLnwvUtB1ZvsYPzg6vq5RDI+zDl1evxBfVpPvuwevW39x6Umw8Fsgom7dQhTA/TAvVieNeV/bT8y5ZsY2SJZid4Xo/wflAb1awRgASCq6H4MCPnJNmJEosbKq6dl4Kjz370ewqch1tYEqWU580qaIhd8TIrYv4eTi6WdKo/OPSGWt5W7YcYwO68A+cUATL3uJA9GUm+OOgK0mgDut2hQv4rd1p1FV2LnWi1JRsjb+wCQipGeZx33L9QGvwgerUTonBM5AFuS+bafM2wzYh8Kw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m1ZYN32u0ggWtCEX610SbMhZ1vkk9NDhhuJm6tQT30RR9az9aIrgxdSDMQW6XJzv7cCo0TE1OeYNrV/4qBAxmR4W9IflGk2+7bMNDtlBseOOqxdFI9disUhphAT798psFEG2EvZUw10OBmFlcaACwrMM8IKS9uWNqWl8trk2fu1w7uwH8k7UDaMKy4cWgZpDnqYDImC1NKV8d+slERXaul5bEaPakUHrcglZE5tq+h8HycT6BQYqbJ0Ugs+RhgB/EFpr+ndeHNF6grVqHlad2TOZe+Nd7mPRS1MpNiiE4KlfTTjuJI9CLo+E5q402cnbi1HQratUQxTHV0NHRcodkg6zqVK5v+tC85oSimSz3YuT82txO6+yBEWg6ZwHW+CDpoB8lj8TZufN5ExIyYaVq/9yz5o12kkjQImashXD3/m2FEnWmsZa+C0pQ3y8Vv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loB6sWtBjzhNvnJ2OmiOd+qCYZ2qRw/DgG1bqXQ2ZKnN+Yz5rKbZFOSm+oIdHEqJ1s0s87YWp22CK+9AguBfhGaw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bYzaxpnnJOlIZ/gf3gEfyrvrDWNk/uNA8G3n0gtdMuem3voYxl+N1yk4l8CGe6zQNJCu2R8Qgku9K0IghH9nMazqVxZxVs+9UrW0fRMkHJy+Q4Slph4D2eMxYttPpUeSb5DdQ5UkuBFXcldVjGzkAtx9SlJA21qpI7JpgDCxVLHgHilMESwtNPf0VWi7vxH0FQSp8ofhWRrnEoRKGaa7v0fzDvVm0OpLnq5mdlFhIOsgW0v6JOlbGQZWhAQFskfwR5r5m7j7kT2nqwNXxFIP+8X2sTNUHqkOz/R6KTYM0hO7lSsUg0S6GWupO8KFwrXRfF9RJWkdPtHFzp39jwAzcz/xUqJwvEYb8v/OD8jD+18khQv3x4BFKI4G+ikArj6ZA7TCpTR/qauaNY0jF78YMDpIWaWv2leCwBO5zKQxilQZVkjfpSoJnk/ctqS09zTHfI2+2dmrPOX72I7mWIRDyzpZp2W/LblSKd8HjRV1ca7Ad1p1vUQWgLYyUimhk6Rk8sqDOWZIMVrbnL1N2Wx9zzF9j5/jEKea0q5+3Oqqymf6aRMmOgbSa5SJoGVOmcTGGrXohQFuxWU1NdMw4m2ncdtj2owFFyFIsq1ddb1uiMc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fae87885-9a2a-48d2-3c2c-08dd1ac2e264 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2024 15:37:28.2917 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EuiL4SAyk1bvAupcTCyyh7jyTAw/oYysoBb2lyachlE792shgHlsJ1JAI205AISwvuWnEtDrmZKBz1vKSpgal+Xg3AlJXMltVD540Nfnt7o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5804 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-12_09,2024-12-12_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2412120113 X-Proofpoint-ORIG-GUID: Std7YryAOEqZLVsKZWBmIZpozTHYyJu- X-Proofpoint-GUID: Std7YryAOEqZLVsKZWBmIZpozTHYyJu- X-Rspamd-Queue-Id: 31E7B180010 X-Stat-Signature: 1xekofoss4qscmkkt8kfmhxctopyzg68 X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1734017841-355971 X-HE-Meta: U2FsdGVkX19SP/gu6Dnywm8/eqs3mt5kFIaEYyJbgaGI9RI0rAnES2tXUH8ClwidV4NmZVbEmJDLK8mi1C4MoB8b3v4VoXelrxRxkzuI6+zWoxx4pXNp1+B64PRwBsGNIVblhVOXcXsVEHmHgeyTaGZT5tz2rDxIhvLbmBS0q+Zy8lNDH+yQXiztuSHtUdCK9LtamrYqxWGzLJuAHKutbRwqCGFY48pUz7hJakXQzz2MYvmqSBVCZCIV9gTx1j3O3Ts9WBkVdTI7PQpeZkx6+OB1BIdvUUvy7hi69ww4G5tRLd0Zk897SZxKpGpiluid0WEzFhe1wKQp3dHfTYC0vPTAgB0FUyJqnIgZIq8qHnEf1CiWHksltzISlWB5MNQUJS903w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nt7iwzWfusEqiy0HvVcsaboZI6Jnpn1A2Co1RZ9X5v/8Jvsdxo4YCaLTOW+rTDx85CNCfss2xzuT10vQB60pU3w71/3I6K5+vHxiJs81lAf8U+2fM505qpz/gYKnqWNqa6iA2n2YR/o0HKgzLR9rRBMA= 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: List-Subscribe: List-Unsubscribe: Now that we have removed the one user of mmap_region() outside of mm, make it internal and add it to vma.c so it can be userland tested. This ensures that all external memory mappings are performed using the appropriate interfaces and allows us to modify memory mapping logic as we see fit. Additionally expand test stubs to allow for the mmap_region() code to compile and be userland testable. Signed-off-by: Lorenzo Stoakes --- include/linux/mm.h | 3 -- mm/mmap.c | 34 ----------------- mm/vma.c | 36 +++++++++++++++++- mm/vma.h | 6 +-- tools/testing/vma/vma_internal.h | 65 ++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 41 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index a672339f2b8f..d145ddf1b2f0 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3436,9 +3436,6 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, return __get_unmapped_area(file, addr, len, pgoff, flags, 0); } -extern unsigned long mmap_region(struct file *file, unsigned long addr, - unsigned long len, vm_flags_t vm_flags, unsigned long pgoff, - struct list_head *uf); extern unsigned long do_mmap(struct file *file, unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, vm_flags_t vm_flags, unsigned long pgoff, unsigned long *populate, diff --git a/mm/mmap.c b/mm/mmap.c index df9154b15ef9..b771ae617629 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1016,40 +1016,6 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len, return do_vmi_munmap(&vmi, mm, start, len, uf, false); } -unsigned long mmap_region(struct file *file, unsigned long addr, - unsigned long len, vm_flags_t vm_flags, unsigned long pgoff, - struct list_head *uf) -{ - unsigned long ret; - bool writable_file_mapping = false; - - /* Check to see if MDWE is applicable. */ - if (map_deny_write_exec(vm_flags, vm_flags)) - return -EACCES; - - /* Allow architectures to sanity-check the vm_flags. */ - if (!arch_validate_flags(vm_flags)) - return -EINVAL; - - /* Map writable and ensure this isn't a sealed memfd. */ - if (file && is_shared_maywrite(vm_flags)) { - int error = mapping_map_writable(file->f_mapping); - - if (error) - return error; - writable_file_mapping = true; - } - - ret = __mmap_region(file, addr, len, vm_flags, pgoff, uf); - - /* Clear our write mapping regardless of error. */ - if (writable_file_mapping) - mapping_unmap_writable(file->f_mapping); - - validate_mm(current->mm); - return ret; -} - int vm_munmap(unsigned long start, size_t len) { return __vm_munmap(start, len, false); diff --git a/mm/vma.c b/mm/vma.c index 2fabfd6c8957..218d8f154e99 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -2432,7 +2432,7 @@ static void __mmap_complete(struct mmap_state *map, struct vm_area_struct *vma) vma_set_page_prot(vma); } -unsigned long __mmap_region(struct file *file, unsigned long addr, +static unsigned long __mmap_region(struct file *file, unsigned long addr, unsigned long len, vm_flags_t vm_flags, unsigned long pgoff, struct list_head *uf) { @@ -2484,6 +2484,40 @@ unsigned long __mmap_region(struct file *file, unsigned long addr, return error; } +unsigned long mmap_region(struct file *file, unsigned long addr, + unsigned long len, vm_flags_t vm_flags, unsigned long pgoff, + struct list_head *uf) +{ + unsigned long ret; + bool writable_file_mapping = false; + + /* Check to see if MDWE is applicable. */ + if (map_deny_write_exec(vm_flags, vm_flags)) + return -EACCES; + + /* Allow architectures to sanity-check the vm_flags. */ + if (!arch_validate_flags(vm_flags)) + return -EINVAL; + + /* Map writable and ensure this isn't a sealed memfd. */ + if (file && is_shared_maywrite(vm_flags)) { + int error = mapping_map_writable(file->f_mapping); + + if (error) + return error; + writable_file_mapping = true; + } + + ret = __mmap_region(file, addr, len, vm_flags, pgoff, uf); + + /* Clear our write mapping regardless of error. */ + if (writable_file_mapping) + mapping_unmap_writable(file->f_mapping); + + validate_mm(current->mm); + return ret; +} + /* * do_brk_flags() - Increase the brk vma if the flags match. * @vmi: The vma iterator diff --git a/mm/vma.h b/mm/vma.h index 24636a2b0acf..dd943a593312 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -242,9 +242,9 @@ bool vma_wants_writenotify(struct vm_area_struct *vma, pgprot_t vm_page_prot); int mm_take_all_locks(struct mm_struct *mm); void mm_drop_all_locks(struct mm_struct *mm); -unsigned long __mmap_region(struct file *file, unsigned long addr, - unsigned long len, vm_flags_t vm_flags, unsigned long pgoff, - struct list_head *uf); +unsigned long mmap_region(struct file *file, unsigned long addr, + unsigned long len, vm_flags_t vm_flags, unsigned long pgoff, + struct list_head *uf); int do_brk_flags(struct vma_iterator *vmi, struct vm_area_struct *brkvma, unsigned long addr, unsigned long request, unsigned long flags); diff --git a/tools/testing/vma/vma_internal.h b/tools/testing/vma/vma_internal.h index 3eeb1317cc69..9f6cf80c9682 100644 --- a/tools/testing/vma/vma_internal.h +++ b/tools/testing/vma/vma_internal.h @@ -41,6 +41,8 @@ extern unsigned long dac_mmap_min_addr; #define VM_BUG_ON(_expr) (BUG_ON(_expr)) #define VM_BUG_ON_VMA(_expr, _vma) (BUG_ON(_expr)) +#define MMF_HAS_MDWE 28 + #define VM_NONE 0x00000000 #define VM_READ 0x00000001 #define VM_WRITE 0x00000002 @@ -226,6 +228,8 @@ struct mm_struct { unsigned long stack_vm; /* VM_STACK */ unsigned long def_flags; + + unsigned long flags; /* Must use atomic bitops to access */ }; struct vma_lock { @@ -1174,4 +1178,65 @@ static inline void userfaultfd_unmap_complete(struct mm_struct *mm, { } +/* + * Denies creating a writable executable mapping or gaining executable permissions. + * + * This denies the following: + * + * a) mmap(PROT_WRITE | PROT_EXEC) + * + * b) mmap(PROT_WRITE) + * mprotect(PROT_EXEC) + * + * c) mmap(PROT_WRITE) + * mprotect(PROT_READ) + * mprotect(PROT_EXEC) + * + * But allows the following: + * + * d) mmap(PROT_READ | PROT_EXEC) + * mmap(PROT_READ | PROT_EXEC | PROT_BTI) + * + * This is only applicable if the user has set the Memory-Deny-Write-Execute + * (MDWE) protection mask for the current process. + * + * @old specifies the VMA flags the VMA originally possessed, and @new the ones + * we propose to set. + * + * Return: false if proposed change is OK, true if not ok and should be denied. + */ +static inline bool map_deny_write_exec(unsigned long old, unsigned long new) +{ + /* If MDWE is disabled, we have nothing to deny. */ + if (!test_bit(MMF_HAS_MDWE, ¤t->mm->flags)) + return false; + + /* If the new VMA is not executable, we have nothing to deny. */ + if (!(new & VM_EXEC)) + return false; + + /* Under MDWE we do not accept newly writably executable VMAs... */ + if (new & VM_WRITE) + return true; + + /* ...nor previously non-executable VMAs becoming executable. */ + if (!(old & VM_EXEC)) + return true; + + return false; +} + +static inline int mapping_map_writable(struct address_space *mapping) +{ + int c = atomic_read(&mapping->i_mmap_writable); + + /* Derived from the raw_atomic_inc_unless_negative() implementation. */ + do { + if (c < 0) + return -EPERM; + } while (!__sync_bool_compare_and_swap(&mapping->i_mmap_writable, c, c+1)); + + return 0; +} + #endif /* __MM_VMA_INTERNAL_H */