From patchwork Fri Dec 13 16:24:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13907425 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 1D5B7E7717F for ; Fri, 13 Dec 2024 16:24:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9FB986B00A1; Fri, 13 Dec 2024 11:24:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9AC006B00A2; Fri, 13 Dec 2024 11:24:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 825706B00A3; Fri, 13 Dec 2024 11:24:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 631336B00A1 for ; Fri, 13 Dec 2024 11:24:28 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id ECE5680DFF for ; Fri, 13 Dec 2024 16:24:27 +0000 (UTC) X-FDA: 82890457524.27.D436A29 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf16.hostedemail.com (Postfix) with ESMTP id 42971180019 for ; Fri, 13 Dec 2024 16:23:58 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=kWuFKUdD; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MrIXOjo9; dmarc=pass (policy=reject) header.from=oracle.com; 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; 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=1734107053; 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: references:dkim-signature; bh=Z2ZRFZVh/i1Aw6uKSeYeDBODWK5z5B1ZTiT+ApsJ0DY=; b=rnG5CjmXyWZqyGZHx5KQl6qdrcZir0xyRvNtuX06bBV1Nhjq/+8UC7AfoEEL+djngeNcL2 nqoWT8rw8CdK+qw3TCs5/B9WzRzWPhPIQiIGMi1+uPYonQTcbZRAKCGfHZ7ssyOPPNtqPa QthaBaXMSVBQonlan9XeDme8pPiXC6g= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1734107053; a=rsa-sha256; cv=pass; b=W7OI3eoYW0yJVlTYM2gD+hz00a6k4xdLpRHoK+KuVUDU1RbTOlQRbITT4SsUrPlRkJLpXI NNapOirScXHw4YO1IHAzKOK6Zopu3L6HJcA8Zr8gFNlyz+hD1HApg7Ayyh6LFNDeyTswqu yZIIeMC7w/S96hNrLP/GRA++JrpW488= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=kWuFKUdD; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MrIXOjo9; dmarc=pass (policy=reject) header.from=oracle.com; 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; arc=pass ("microsoft.com:s=arcselector10001:i=1") 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 4BDDjnnn027989; Fri, 13 Dec 2024 16:24:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=corp-2023-11-20; bh=Z2ZRFZVh/i1Aw6uK SeYeDBODWK5z5B1ZTiT+ApsJ0DY=; b=kWuFKUdD2aYtp9b5UXOTzYdYU7CLnSeN pzbx9vb2safL2eSWLKPbOza4cHFt7pyR3AwqKDStDSZZXav+0N89U4dksocqVLed r1xY3ILPqEeFIxCXUh8vIOked42qBSSeDAiCrCQex0TPlRiRmqWG/3Oxe5DZ079V OpL6/3CtoTNLD7x45h3xkI3dNuloUeaTSL0NiCE9dKGu6V/HdmQdk/FyGpzZRKnl BKPUFGpNF8wOhTm4G1hSn3OSN9OIfe93NEr54kXjskbUcUycM3suhagnstATL3TS zYeLYbY+tYDoa0FERX1g8E9PTI13netCpWFvC5wvgs1k3dM1ln7fww== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43cewtdwb9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Dec 2024 16:24:21 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4BDGKmhm035561; Fri, 13 Dec 2024 16:24:20 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2044.outbound.protection.outlook.com [104.47.73.44]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 43cctcwufp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Dec 2024 16:24:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Y84ylFqqRzJddlsVrtKidbBqXXI/hMQxX0YpUkELpDsFKk041Ab7oZAeybHVnRrb8hczPgPwmw9F2gi29FjEqBuxt4eQsSp0dq9Z5gyQPTuj1JhoCxI7UO34VvftGyfTjQAsFQNvhV/UEIwDGWl07s/3nMubOjEo0aSkZ4YWlX8mvpj1BqHp7VYr/PR0ngwOU7haj3ZuKO96+U0D9GMuXk9MIemHXX+AaJxNvPdbHeh8lN4Vr4AF3OX/EpzDeotTV6VWE8DqSEyOprpJIJHxXhfMqqYX2koT5JRfDK3LX0KHyYEGGB+vp1MZOaSm+irbWmIHVRpz5IhWIViC1qBW+Q== 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=Z2ZRFZVh/i1Aw6uKSeYeDBODWK5z5B1ZTiT+ApsJ0DY=; b=XQ1Dej9OaXkT8hFk/UFlm4FBXe26v+zqisB3UmpIitHwis0mUd4VYNX+Pzzvm1sR/JOsPy3Hfw5ODppVznsMbe21z3dJxAPxhLjK1gDcPXccbPIoHs/VyAoUqKA21M7bzsXFGRkd657o2SZnPJM9xfB/GG0ekCArC8SBGMtiY2DWx5sUtyvVhMmwKlOttdVHKUenD/k7mCc/er0Mb6hKhfEAzY2zXsknolgfjiX2Fw8bydMm1fU7XfGyu388VUhxu3Jhimp8k4scTZfk4+BKpaifkMU73lgcjPRq1M0nK1d1ei/TNiYqPGyCUWdGCYmqxB04oFqsPzq/HYH6L8E9pQ== 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=Z2ZRFZVh/i1Aw6uKSeYeDBODWK5z5B1ZTiT+ApsJ0DY=; b=MrIXOjo9i3IjYeL112pmmoskPbQzZAW+FrHoGijQsqTdIrJWPVQDJRo/v48hLhgqq2uFBtdYDeuzeFEmv36tO9AcXq24s0VRwqQEInvbN5u0qBCYH08sdBP4/xpJ/qCRkFTFyN1tSMNH/usLIvMg84lydKQTXtM4XDAQ03tzwZ0= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SN7PR10MB6980.namprd10.prod.outlook.com (2603:10b6:806:34e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Fri, 13 Dec 2024 16:24:18 +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.015; Fri, 13 Dec 2024 16:24:18 +0000 From: Lorenzo Stoakes To: Andrew Morton , "Liam R . Howlett" Cc: Vlastimil Babka , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] tools: testing: add simple __mmap_region() userland test Date: Fri, 13 Dec 2024 16:24:09 +0000 Message-ID: <20241213162409.41498-1-lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.1 X-ClientProxiedBy: LO2P265CA0302.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::26) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SN7PR10MB6980:EE_ X-MS-Office365-Filtering-Correlation-Id: 931fd1a6-b992-4b3b-deaa-08dd1b9297d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: zwlFvfwZpAL8aQsI4IWSAaWjYg4jSoxf5Iko3WOc3/JGKBlmA5k+uWyzhp/1f18R+ocKKzPr/iOChfuUJKB6goqcxkYhZUCtCNV/v6IOvRfC1BKuyeq1Ia/CUOouimQwfm+6jobOqneRtOq/A0zXwqkXpBnGVC8l3elLB3Wrqv8Z1RD2EYdjaU0iSGMsAhC6D2QxK6cuVFE6cfkvPymRYur7Re/6qRKCLmff5wz54sPW5nCMY2HkXQuywfEPPR4c+JOwGAuO6Y32A3klrjZQXCypYJpp0xVyEiSJ7w+XQ08V11/HlnFF0JXFnltRibUgKJzkkjAF/i5UI8ddWXEroJXmsObptABwvxJgf0V1RcCHMf+NLo0y7qN4oAb7YbhfpeSJ9yOstfdYkCxEKrNu3V5ZfAwgFGnIP9T/r94i5ItSOb9hg5/ehZsnJVolpQNsM2Kl/N+dynlYXeSg9YpYPD8X2aDIirENzmS1wcIFwtUIiOOyFnATUgVkPN3Z6/QI+J7UhAPRl5c2oixsUB7jtY2ZW6U8zPeq6EFchf545I7EvjB4+LY+h8xIcfV+Hy6jFu5m2Qci1Wd14yZKAO7QkAXZeFiq6xWhgYpIzcc81VmApE/A3oyU23zOsZQtnZxbUSp4Gv1nqIdntUf1YKs1fwH/sY9w/DxipDc0eLLdhvhx7Q3MZp61sIf5uw9zwR7WqUL7vDDcWyBzWT31s4YVwYiLvHKerm6Yl9AFmMBHddFZ55UO5xP9e1LS/fDf4nTCuK/9J7VY03/XznvYnYsepAiME4DIfIvp3K0JNCa9rqCY/4IPtM25nPle+DN+liPM2TbVdVR6AhnNSCPfNUjohhWKpMXAFL608xPRhmn4/9zTdqJJBIEthlIec6abqrE97xc1qGDqe2VWqLK+c26qwjfdC0m7gIIt1R7Gfe4b2cf5COqFkAfM1KdCH5Cz4fWU+nCh+n28uyGmTrCA03t5jXUlgW1osDNMyNp5HnRuKtmiUZqrLry+Xpcy7pMmlekX9HMXGwu27AA/cK8v7O6gk7mfefdEn7CaqAeeakkg8uIZrX3t8LYG04/wpzd0UcQ0eiNhfivv1f3nlsFb6F3tYeLlIRtJEMskMoav7xzxhgI6N7ZzXD+B/SuKYfWoYSG3ZRUkQHu/Vja0muXEmCDus3EOjpP1HWx0dJWoZoh8LFEM7skGv73+Ia+A2Bb+pnexvbeonC1vSuEfYSJuzKnlVP/llBczlltH8sbpLH4tHLBpYpOdGrIfuRWEMfEF44MVztmtYhAzpmQuIx46FmCDHIC46HT07naHdzkeQz4yV+ybtRnTjBLRB7fSlhRTNmapXoUjvW2+Qf7O7tgbvjQymw== 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)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hyk755nrZsF7ydnFO+TbfGphVyV81IKBHDJJkiIpaot8iUaU/Rz7yud6n74fB7t04blrXn0NeNDl7PC10llEUhjyBRSKD6XRFhtdBgBvCUnV+tW8m0kCDhZDmeRZPVUMgYgjMFompSASLkHVmNJ+6nVVaQK5TeRbGj/rl3pmuPweEIdNViC+8RkL2QTcCdBqa8wKR/kpLvs4l3bMuMREoGs2gXHDTlPTbyjWxF5sw/7MA3yTlLBMNjQNBCAacLterfglkh3gs5vnrzUqUX9vdCKlFQujESbOM0fGRbMd6FmAdSqnNQZFYUpotBp3xV+No5OuB7nh5t5AQG67YdwVmgE/NisbxBbuHf9/p3DmDUow+xtm7FkMnxe9Dsj7pr1fiQGzfhjVn/GIDdMdKRxQYa0HdTFz5IUXzm/p0HvGEBfJDsAwHN81WRTDyDeV+QF5dHEEv0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tImnqxFbvbIZCthyXIvI9msFmF9/gEOk0FLnINQrFmztTKSqUJYwjVw4p+gkScK9xaR3vfcchpGn0RubiyIKpjJVngi0b7dpYIg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: OQdEPzxJVTwzNDY9hbkbJ2qCK9sgMFlN22FCioqMji1LB4KKEU1JwSVgZFZbTFfrujWCJmHi4nMR8EV5NCrFnZoqqeWRSqsLFs7wlv7SFdtIxWW1382nGtV9oEspZUmvlPkRmQP6yTJONnte04b7A1H1zXt2iJlsy4vB6+2G3XPc5MnTBfIFUmrxozH3Y4sYV+h7uzvqktrbSpmpUMcpz+GXgKdntqGyKldFPw4rbjvZ0WPsmASqaR1bWMCHUanbAE6jrpAQp5vklS22qSdojyfaPeYkUwl/ySFmloF0DCvQWl4q3oRaCnHFdwJqnjd2/qg3Ts9xSyr3ZZZLOOxMM0N30p4zGGzdbvDLSSLEG9OQq7RhMUy6WPPuoxPUVC6NNx/mZyxprTPYjKbJLacG2zu2geB+6QHVtJi0ek3FrXFTlf+ObmGavxdqNnsax5hNng2V7dbXbYGyvqtVBnS8TqvbhKq10KGXLMK1jza6SUkHSalRqM3e6MxKFzZ9sqW6luMOBFx0OUYi7dV9AVUepEIODZm1hw9Dhc66BOsZy6iPyw6kCU+yRAagY4edjBKbRfP2dbRQZREuFp37jTLFQZnSc11ZrQfEMgW2I+tyHZo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 931fd1a6-b992-4b3b-deaa-08dd1b9297d7 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2024 16:24:18.6006 (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: OBu3rm9u6mD0Dp4kof9nOeSUuZCqB+LGf2DSo4SzPkIP79bsvj35qO5O9tQ0gfEIwMw+uSauPLMYwxYq2HgRTchkT3gia791DOegXcw/6bw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6980 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-13_06,2024-12-12_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 spamscore=0 mlxlogscore=949 malwarescore=0 adultscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2412130115 X-Proofpoint-ORIG-GUID: _PJRN8THy-Vu2iEJiPmsLRhfgAIiwRnW X-Proofpoint-GUID: _PJRN8THy-Vu2iEJiPmsLRhfgAIiwRnW X-Stat-Signature: 7grhzjr4wfbmgzzsm8zzdyka1jybzuzk X-Rspamd-Queue-Id: 42971180019 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1734107038-970178 X-HE-Meta: U2FsdGVkX1+xU9yjtAHwYjSKhGvTBAVrBq/n3SW9a+RR4ryBGHaWPr6kjuYF6TnZFBCDypinZC4gLzlaMZn9XYoEZYNk8l3dtfMaNFEeiS0N/EWvRTRnlqPuPk1h0hIlbjQ56TmBUK2h/OLA9tBcOQ46uFs/vVmRpuJ7NoEH/ErUR42M6XecXF4EZBStMFIKVbRZIadDLYbXrp5ikoXGNr0MyNFNVWtdXW5/qpm6B7KFCHM3EkA02LwBHTwCq2MGXgn0JQ74dH7BcWwznHgvJ1NNHkLiOaoXyJsjS7VSIE3MerPwzotIfcd4e904qscThfO2CHHbqzLlDDr9evLihJlwEwUtK1+FktgjCpIRd2YixsqHYQidoYCphnIKfoCEkZ1jH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KLNYvMYIMYTdl9DN6f0PERQEOKHd+9wh5/tWSW0C+ZrEPfy0pZf+yv7MTWnSCJh3z1DW4J9nK/YRs6n1CEYkPhxhmtsLfcwvYiaTvwGTcoI0uUAE/aKR2/ 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: Introduce demonstrative, basic, __mmap_region() test upon which we can base further work upon moving forwards. This simply asserts that mappings can be made and merges occur as expected. As part of this change, fix the security_vm_enough_memory_mm() stub which was previously incorrectly implemented. Signed-off-by: Lorenzo Stoakes --- tools/testing/vma/vma.c | 53 ++++++++++++++++++++++++++++++++ tools/testing/vma/vma_internal.h | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/vma.c index 920fba58884e..04ab45e27fb8 100644 --- a/tools/testing/vma/vma.c +++ b/tools/testing/vma/vma.c @@ -1574,6 +1574,57 @@ static bool test_expand_only_mode(void) return true; } +static bool test_mmap_region_basic(void) +{ + struct mm_struct mm = {}; + unsigned long addr; + struct vm_area_struct *vma; + VMA_ITERATOR(vmi, &mm, 0); + + current->mm = &mm; + + /* Map at 0x300000, length 0x3000. */ + addr = __mmap_region(NULL, 0x300000, 0x3000, + VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, + 0x300, NULL); + ASSERT_EQ(addr, 0x300000); + + /* Map at 0x250000, length 0x3000. */ + addr = __mmap_region(NULL, 0x250000, 0x3000, + VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, + 0x250, NULL); + ASSERT_EQ(addr, 0x250000); + + /* Map at 0x303000, merging to 0x300000 of length 0x6000. */ + addr = __mmap_region(NULL, 0x303000, 0x3000, + VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, + 0x303, NULL); + ASSERT_EQ(addr, 0x303000); + + /* Map at 0x24d000, merging to 0x250000 of length 0x6000. */ + addr = __mmap_region(NULL, 0x24d000, 0x3000, + VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE, + 0x24d, NULL); + ASSERT_EQ(addr, 0x24d000); + + ASSERT_EQ(mm.map_count, 2); + + for_each_vma(vmi, vma) { + if (vma->vm_start == 0x300000) { + ASSERT_EQ(vma->vm_end, 0x306000); + ASSERT_EQ(vma->vm_pgoff, 0x300); + } else if (vma->vm_start == 0x24d000) { + ASSERT_EQ(vma->vm_end, 0x253000); + ASSERT_EQ(vma->vm_pgoff, 0x24d); + } else { + ASSERT_FALSE(true); + } + } + + cleanup_mm(&mm, &vmi); + return true; +} + int main(void) { int num_tests = 0, num_fail = 0; @@ -1607,6 +1658,8 @@ int main(void) TEST(copy_vma); TEST(expand_only_mode); + TEST(mmap_region_basic); + #undef TEST printf("%d tests run, %d passed, %d failed.\n", diff --git a/tools/testing/vma/vma_internal.h b/tools/testing/vma/vma_internal.h index 3eeb1317cc69..86f958608645 100644 --- a/tools/testing/vma/vma_internal.h +++ b/tools/testing/vma/vma_internal.h @@ -985,7 +985,7 @@ static inline bool is_file_hugepages(struct file *) static inline int security_vm_enough_memory_mm(struct mm_struct *, long) { - return true; + return 0; } static inline bool may_expand_vm(struct mm_struct *, vm_flags_t, unsigned long)