From mboxrd@z Thu Jan 1 00:00:00 1970 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 62181C02183 for ; Wed, 15 Jan 2025 12:10:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E594A280005; Wed, 15 Jan 2025 07:10:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E0A83280002; Wed, 15 Jan 2025 07:10:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C34FC280005; Wed, 15 Jan 2025 07:10:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9FBC7280002 for ; Wed, 15 Jan 2025 07:10:56 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1C78B1610FF for ; Wed, 15 Jan 2025 12:10:56 +0000 (UTC) X-FDA: 83009570112.13.C4217C6 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf19.hostedemail.com (Postfix) with ESMTP id 79CB81A0006 for ; Wed, 15 Jan 2025 12:10:52 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=nDClQqGU; dkim=fail ("body hash did not verify") header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=0UQ3gKwD; spf=pass (imf19.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736943052; 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=wVwS8vz/qH+zfcYctNnHay02VBXmGcC/xNOeQs8PooM=; b=W9AtAbC5UmGugdQZBC1qt8VcqgilKglZtqKQothkCaUB7f/lC5TOWBWurPOzxkdJ8CqFyC bV1Rm8+PYTHc2gdcQ3tfXLqJ2DRKqncXmFoglue+BDyoNK0EWnf7OrcQOtjmby5TZ0vvJw iLVsyRiYGvpuDVgf5YueEcUURJPq3cM= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=nDClQqGU; dkim=fail ("body hash did not verify") header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=0UQ3gKwD; spf=pass (imf19.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1736943052; a=rsa-sha256; cv=fail; b=S173niVT6axBJaqJc4n+8UffBAKjxb8G6X/HaFofh8M/8RBdwDMvh8ohKajp0wJ11Rf0UG 4s3TbU21Ezgp6CJW/60ENReeeU5PGZphr9fXujDodeUVTEsO5eQX8Nh0qI5vkL5J9vEsSz im/LdeX3CHHGleLg+S7oSh1AYfMnB1Y= Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50F8tpuJ030206; Wed, 15 Jan 2025 12:10:38 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=wVwS8vz/qH+zfcYctNnHay02VBXmGcC/xNOeQs8PooM=; b= nDClQqGUU1OspHoHKkAz8pJ4pSyT2w0VATUcxVZRiYmzKkMkcQ11/imEzS8XiCHK VLUBatee2RuDGkinnE5lL8nsJ4yU/4oMN+BWJawHOhkkqlcHf6Cs/qvYn8q0Hy9G vgAkiBC45hXeeJ+xw2isUgYXn8Clm9qlABTWQlSnvyy3Ja+mkr8/7UXITkRwIE02 7Bl37ZWRwU9eHw32QM/87ciQEDpvC4mSrpqemVskB4n/Zclg1+pRrXGTVF7I576R fqr7xmy8HDSaQ6y8zySbW4CCvtoxrX94A/S9/zMcmpNPATL20dy93A8FkO2xpsKy qyvZ67JpnI+wYHZa2gsmaw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 443gpcr2st-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Jan 2025 12:10:37 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 50FC1GaC040345; Wed, 15 Jan 2025 12:10:36 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2042.outbound.protection.outlook.com [104.47.55.42]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 443f39ck2e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Jan 2025 12:10:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BOu9eafRlLwdNG78hFalMht1kKAyiETqUywExP+iOauxC+GUkQjpQoLA5GwB8unUFkcsl83N8AQIbqTuSTPNt8aeunhXPWdIa+q0mixCSaO8gkURW0zZ46zh1h7pnZTl4xpwYCzgPNrrNzZFe/xlOVCQUNlAnIMQCeR5C8GLiduf+zFfDHBxpWWQWvShAAKXGz5KxmWtKbcYZMRdfxycI+q+dFHcENIxXlw6GbMaAdVFLUOPN8dOrClnL3IocD+41vHTm7JAP4jUv13UMbFJbLpn7avdxSD66Gk6PH1hJnuHOKFo4G85KQVP5dKlSokMFkw1K1YNlWMIodhubY9ScA== 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=YLmb1SEHeCofKw8GNf/5c7i+3Rde8mV1lcFoMSKvQpM=; b=gdEsDB0dXRamGryhSvwYYsMQUeb0OH1jov//z9PFMnPMFaR/KqYRJr9GP/AKvkp58bJo34E4JB5l2GRwfS9Ps5U0JyxJo1tX/r1p4/FdjCLRewocr0FFhvU+IZ6DUC7wGNFCiX4/pjL3yL70uq7v+8xoR4bU8vVMoAAiYyL5VdW8YTnuZQwOMDqgydbnWCOunvb0TKJSONt1yKaDp48ZKEr8FkqoRpSeooHrTKsBjy6Fgnt1MywPEBARKN8i+yPPuFAnX0PHRGPYRolXZweyD12IqqGpj2d4W7BG53K4bpQtoTkehssihol672EGWbJArmJRSNkHKqQ6Dy8sCkaKuw== 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=YLmb1SEHeCofKw8GNf/5c7i+3Rde8mV1lcFoMSKvQpM=; b=0UQ3gKwD0Pd5S5E/PqSa3lbnSOvG/y2l1ruwKrrcwA6wig7nr6NBMBSF/aNQG0W0kJ5u+b8nPz3gixYSW8H8IcRAy82NrvrzHffdjpEoXBRko2lcqnb0RActaoSnBDTHN23+WMGY65MEDUwSFR4s2zR9C10maC1t+8GDXtGVhTA= Received: from MN2PR10MB3374.namprd10.prod.outlook.com (2603:10b6:208:12b::29) by DS0PR10MB6245.namprd10.prod.outlook.com (2603:10b6:8:d3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.13; Wed, 15 Jan 2025 12:10:34 +0000 Received: from MN2PR10MB3374.namprd10.prod.outlook.com ([fe80::eab5:3c8c:1b35:4348]) by MN2PR10MB3374.namprd10.prod.outlook.com ([fe80::eab5:3c8c:1b35:4348%3]) with mapi id 15.20.8335.017; Wed, 15 Jan 2025 12:10:34 +0000 Date: Wed, 15 Jan 2025 12:10:30 +0000 From: Lorenzo Stoakes To: Yang Shi Cc: arnd@arndb.de, gregkh@linuxfoundation.org, Liam.Howlett@oracle.com, vbabka@suse.cz, jannh@google.com, willy@infradead.org, liushixin2@huawei.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] /dev/zero: make private mapping full anonymous mapping Message-ID: References: <20250113223033.4054534-1-yang@os.amperecomputing.com> <2dda50aa-e4a1-4664-b8fa-56ba975db329@lucifer.local> <65691afc-615a-4716-8a2e-1f43bc65111c@os.amperecomputing.com> <3fdcd6a5-27fe-411b-923c-b7410e4cbda9@lucifer.local> <389c72c2-f102-4d32-886b-99d7c212a295@os.amperecomputing.com> <23f50178-59d1-462b-8463-48cc707d6b3f@os.amperecomputing.com> Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <23f50178-59d1-462b-8463-48cc707d6b3f@os.amperecomputing.com> X-ClientProxiedBy: LO4P123CA0460.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1aa::15) To MN2PR10MB3374.namprd10.prod.outlook.com (2603:10b6:208:12b::29) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR10MB3374:EE_|DS0PR10MB6245:EE_ X-MS-Office365-Filtering-Correlation-Id: 48dfeeb7-35ef-42ba-750d-08dd355d9d44 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?iso-8859-1?Q?DcPNK83V4fRuYuDAyfjLu1Q1hZ0IefhJsNjPAwlIHZDv4CjTPnoFbAiDgP?= =?iso-8859-1?Q?q39HeCOxiMsZ5Gy0r7UnxEmcszjEzgcM3l+fv61HIqqILULVXOi/Kk29oQ?= =?iso-8859-1?Q?Kb2L8dGtJCmRq8qKj5TwvMzVHqEXr6FHVDs2GBZtTdhIZZtn2TvhlJNuxQ?= =?iso-8859-1?Q?d0PRkRG1HFsWKULzc0N7qbU2Drlc2sMIv/d4ZNvOsiPo5v93m1X5gnRK0w?= =?iso-8859-1?Q?DzLl2rNGI6b0HfXZ2jUNa3j7t52TgTc4/HMaqiGCpOCVxAwofwGs4i6XJV?= =?iso-8859-1?Q?ph+RhjcT9EceltmPpOTrhV8Exf9C+m/+xVVaw49xeul2y2UxxqrUt2Jg7Y?= =?iso-8859-1?Q?LbFAUvwy3yP2WXnTAiFuS80I4cu7PAtW4Mw4L9/3uWKW4QVDEwFfIJA4jm?= =?iso-8859-1?Q?Gcp44+1CIxe0tE9g+qYdfw7FQGeHHgXUHPhwd+VShSDrL8xU5uuqw02/kl?= =?iso-8859-1?Q?hICG0KF7fMJzJFcAijUECJDF7vTDn0OiC1ndBqiVm9WeLrsD50IVlY1qfX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nEhyz3bcwnwxm+VPi6G7c5TUhEs/NMbCn?= =?iso-8859-1?Q?LKUbtYQLvXNdXwZj?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB3374.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?mLnthRazgUZiktpjF2VnwE6txqXi9s4tJo5SPSq+q2cRJK0/7dNO+rvXEW?= =?iso-8859-1?Q?iCi6+xuyInNGZRtTkWUzB6BmsCF5OGL2kgSlfc5XC6p4YQeM6dQgoY0lbm?= =?iso-8859-1?Q?zo/GCB4EFVCXcPtOFIxNJbrE7Wf62W03iqFprd3lPcA5BSP/2Jij7CGxrA?= =?iso-8859-1?Q?u4TnXibJI+efYdIhAQ0B0lAIVWmobBsH3Scn2RyjzdHIRGdUnVF9nukTES?= =?iso-8859-1?Q?qlJou6O5n9sWMSrs69AZjD5EyYYiBjI15agODZ5b9ko5hcO8RXeddzdd5X?= =?iso-8859-1?Q?iPFCPA3JrBAEFOjHZEwssazJCEOqoWanySwtsFZwK4plNmLuYsWJATGkj9?= =?iso-8859-1?Q?5SHAQ45kNBUNhKbm1wGSIljUAOCCJAH6dBbQn8ALicSd9Ls1xXg/PuOljV?= =?iso-8859-1?Q?3U3wROsPlblsIWHGUppIrOfrG3siiiUZUfFv+uSRFS98px2ZQ9ZsQlnh0L?= =?iso-8859-1?Q?XQeUB3H7yz5VA+E90QI31MiujHeMbpXICC5mBq/YPMqe/LkCnb4ZObVUZ0?= =?iso-8859-1?Q?8cQYx+aeIPorH9ThL8JHarKVhMaKWD0EZizi1cALfUzypOKUCAxGMdBSST?= =?iso-8859-1?Q?mgMIfK0xlmTDY5Iry0FmuyMpvHJPVd2A3Y4r3vqPrSYc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a4yQ/9Ivg9sjkPIsnr9udi8FxsSSUfrz/Fq6?= =?iso-8859-1?Q?EX/djQoNtzXaaWYfOMM3FCuC5wdTFWLLVrKG120yvOU9k+RklFLWVPjH1d?= =?iso-8859-1?Q?LoNm9s/nw/gmsoKR+QD/JEniS2c3rRRHIp+LhfX1BMhsAlZF+xipSKNw?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: LUglzfB+WkWDj3q9LffqgcNcBC9iEOMiuHc3Ygka9ie9jQ6IBaSPZGKttr97xNdUKw4mU5fbLYLRtSA9q0F5lzAmywG9JR1mLF+n9LXxFiaJB60PXwn2WHO4akC5ldNFOJPtQKRdhNLl00gsbkKT/q/LzCH8wnqRumRoiWZkdnWZA9wQh8kyb1nM7r3Q5LasROTdlTdsYFNdFyvbCSShUYTPGxjZPzO2ZYi0AADbwboVxVYmi63QofZuiSB0W3AiVIEw5rpnBTHIf0AZ3/ODONbZONBohlpvt+MarybukUThmb2PVOTzbHpEstp42gF7n6frLGcovABl8lMhoKcy7vUlGMsHMEa6bBFyn/SZ+dQKxYW/T/lmRFrDeq6JhGov+2996zkwPzRAeWAH2Uhrd/dyPATe4fp0LpKHqsQ6KdXFKON6/0xzX0TTh+XjD8LZAyelP6PkqIuNWkHuxXQstglEm9czrJiuvft8L2NWhL6W2Aep64LK9eMiIzO0wi5gyVvDkRtb/YTe1xEKvRr5ewIk/BT+um15BRhx6M0niggisTbYc+9+mzd71gRQt+E92evqLdCOsID3j6dPktLgzC40z4UT268aS7KvSckDdRE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48dfeeb7-35ef-42ba-750d-08dd355d9d44 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3374.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2025 12:10:34.5040 (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: ffJXbKu5RMm2Gmwx9M1HE5WQou8lC5uxnKAWSIvKyVb8Rywp5oGlSoaurn/q6abAk9C4Ki9I4HbSrldRDJkmEsv9edxiW8wXPgC/qRorBwE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6245 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=2025-01-15_04,2025-01-15_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501150092 X-Proofpoint-GUID: 2A27jzQaovDO1CS6UegTgJNuFeOUcCrm X-Proofpoint-ORIG-GUID: 2A27jzQaovDO1CS6UegTgJNuFeOUcCrm X-Rspamd-Server: rspam05 X-Stat-Signature: efuxhff94bkbnfzgxu998p41z69zgfwd X-Rspamd-Queue-Id: 79CB81A0006 X-Rspam-User: X-HE-Tag: 1736943052-993267 X-HE-Meta: U2FsdGVkX18BBKIcrCcC/MXyVLe+QR1ldlmurUm46XMTNo8IaCyUC5xxPUgKpW9yjwLop5jcR9pmIFjAHn6/OI4xoGBZZZxWCnqG1KfwuBdAaC/ai1oWoei3bEfv+1eWZWNq6An7xDpDVqTomShX/dky0rUhm8sPeOebKuXxdRnCoBAwnpNVditJ9lnvGTA05MU/xmxoqIKzlYOPYv3gvCXmG4O4FxEdnny0pY0SGa8IZOzHXnSW3TnKzSDqnEA/aNZVNg0VeSp8dxm/D1I1hVXQmOIcg92ANKrQptN933EJ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gRWOfq92JT5a8K68tsYATx9MKax4QXmYFjdiROLNIFTSACwWQ9Lk4DkvrdxuPo49rV7LWYraiVQg1MU5Fu0tzX7Haa1wwTUmaKYCslBtOHMkVgDSrUuu/WkY5axYF8A0gWWHus9KlrbOpQVxzc5TUlV/SC2Y4d/8mfV+esoPfDMO62RRNs9oYHYpBK7qlkO+2lyNJFUZ/UpgbbJVSthxN2R3B648LC/FEwhKobNasD7UVtrhsjKXH1rYX40mxEuhozxNJgDQdhdHG0HmrF9A2kNsWGt6qT5HcbIRH2f4vWdcp0uML4udr9YAq1gi9G2rkfp2OLwZiVn5qeDNJlOstdIBnNz5ioJ0aEZ25aHYbPX4gh0KWx1vqPYBkY9q0ZVp2JGcgm0OvalP5n0bSTLjATPcCCD+jsZuglv1s7VJw6YCZfQM9NZ/E8u8 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: On Tue, Jan 14, 2025 at 01:24:25PM -0800, Yang Shi wrote: > > > > On 1/14/25 11:13 AM, Lorenzo Stoakes wrote: > > On Tue, Jan 14, 2025 at 11:03:48AM -0800, Yang Shi wrote: > > > > > > > > > On 1/14/25 10:14 AM, Lorenzo Stoakes wrote: > > > > This is getting into realms of discussion so to risk sounding rude - to be > > > > clear - NACK. > > > > > > > > The user-visible change to /proc/$pid/[s]maps kills this patch dead. This > > > > is regardless of any other discussed issue. > > > I admit this is a concern, but I don't think this is really that bad to kill > > > this patch. May this change result in userspace regression? Maybe, likely > > > happens to some debugging and monitoring scripts, typically we don't worry > > > them that much. Of course, I can't completely guarantee no regression for > > > real life applications, it should just be unlikely IMHO. > > Yeah, I don't think we can accept this unfortunately. > > > > This patch is SUPER important though even if rejected, because you've made > > me realise we really need to audit all of these mmap handlers... so it's > > all super appreciated regardless :) > > :-) > > > > > > > But more importantly, I hadn't realise mmap_zero() was on the .mmap() > > > > callback (sorry my mistake) - you're simply not permitted to change > > > > vm_pgoff and vm_file fields here, the mapping logic doesn't expect it, and > > > > it's broken. > > > > > > > > To me the alternative would be to have a custom fault handler that hands > > > > back the zero page, but I"m not sure that's workable, you'd have to install > > > > a special mapping etc. and huge pages are weird and... > > > TBH, I don't think we need to make fault handler more complicated, it is > > > just handled as anonymous fault handler. > > > > > > I understand your concern about changing those vma filed outside core mm. An > > > alternative is to move such change to vma.c. For example: > > > > > > diff --git a/mm/vma.c b/mm/vma.c > > > index bb2119e5a0d0..2a7ea9901f57 100644 > > > --- a/mm/vma.c > > > +++ b/mm/vma.c > > > @@ -2358,6 +2358,12 @@ static int __mmap_new_vma(struct mmap_state *map, > > > struct vm_area_struct **vmap) > > >         else > > >                 vma_set_anonymous(vma); > > > > > > +       if (vma_is_anonymous(vma) && vma->vm_file) { > > > +               fput(vma->vm_file); > > > +               vma->vm_file = NULL; > > > +               vma->vm_pgoff = vma->vm_start >> PAGE_SHIFT; > > > +       } > > > + > > OK that's more interesting. Though the user-facing thing remains... > > > > It's possiible we could detect that the underlying thing is a zero page and > > manually print out /dev/zero, but can somebody create a zero page file > > elsewhere? In which case they might find this confusing. > > I'm not sure about file mapping. However reading an anonymous mapping will > instantiate zero page. It should not be marked as /dev/zero mapping. > > > > > It's actually a nice idea to have this _explicitly_ covered off as we could > > then also add a comment explaining 'hey there's this weird type of VMA' and > > have it in a place where it's actually obvious to mm folk anyway. > > > > But this maps thing is just a killer. Somebody somewhere will be > > confused. And it is not for us to judge whether that's silly or not... > > I just thought of named anonymous VMA may help. We can give the private > /dev/zero mapping a name, for example, just "/dev/zero". However, > "[anon:/dev/zero]" will show up in smaps/maps. We can't keep the device > numbers and inode number either, but it seems it can tell the user this > mapping comes from /dev/zero, and it also explicitly tells us it is > specially treated by kernel. Hopefully setting anon_name is permitted. But then that'd require CONFIG_ANON_VMA_NAME unfortunately :( I think this maps thing is the killer here really. It'd be nice to -specifically- have a means of expressing this kind of VMA, we have a means of setting a VMA anon, so maybe we can 'set a VMA to /dev/zero' and somehow explicitly know that we've done this and identify this special case. I'm not sure that the .mmap callback is the right place to do this and I"m not sure how exactly this would work but this could be workable. I agree the actual offset into the zero page is of no relevance and no _sane_ user will care, but this way we could put /dev/zero in [s]maps, treat this VMA as anon, but also add semantic information about the existence of this weird corner case. > > > > > >         if (error) > > >                 goto free_iter_vma; > > > > > > > > > > I do appreciate you raising this especially as I was blissfully unaware, > > > > but I don't see how this patch can possibly work, sorry :( > > > > > > > > On Tue, Jan 14, 2025 at 08:53:01AM -0800, Yang Shi wrote: > > > > > > > > > > On 1/14/25 4:05 AM, Lorenzo Stoakes wrote: > > > > > > + Willy for the fs/weirdness elements of this. > > > > > > > > > > > > On Mon, Jan 13, 2025 at 02:30:33PM -0800, Yang Shi wrote: > > > > > > > When creating private mapping for /dev/zero, the driver makes it an > > > > > > > anonymous mapping by calling set_vma_anonymous(). But it just sets > > > > > > > vm_ops to NULL, vm_file is still valid and vm_pgoff is also file offset. > > > > > > Hm yikes. > > > > > > > > > > > > > This is a special case and the VMA doesn't look like either anonymous VMA > > > > > > > or file VMA. It confused other kernel subsystem, for example, khugepaged [1]. > > > > > > > > > > > > > > It seems pointless to keep such special case. Making private /dev/zero > > > > > > > mapping a full anonymous mapping doesn't change the semantic of > > > > > > > /dev/zero either. > > > > > > My concern is that ostensibly there _is_ a file right? Are we certain that by > > > > > > not setting this we are not breaking something somewhere else? > > > > > > > > > > > > Are we not creating a sort of other type of 'non-such-beast' here? > > > > > But the file is /dev/zero. I don't see this could break the semantic of > > > > > /dev/zero. The shared mapping of /dev/zero is not affected by this change, > > > > > kernel already treated private mapping of /dev/zero as anonymous mapping, > > > > > but with some weird settings in VMA. When reading the mapping, it returns 0 > > > > > with zero page, when writing the mapping, a new anonymous folio is > > > > > allocated. > > > > You're creating a new concept of an anon but not anon but also now with > > > > anon vm_pgoff and missing vm_file even though it does reference a file > > > > and... yeah. > > > > > > > > This is not usual :) > > > It does reference a file, but the file is /dev/zero... And if kernel already > > > treated it as anonymous mapping, it sounds like the file may not matter that > > > much, so why not make it as a real anonymous mapping?  Then we end up having > > > anonymous VMA and file VMA only instead of anonymous VMA, file VMA and > > > hybrid special VMA. So we have less thing to worry about. If VMA is > > > anonymous VMA, it is guaranteed vm_file is NULL, vm_ops is NULL and vm_pgoff > > > is linear pgoff. But it is not true now. > > It's about user confusion for me really. > > > > > > > > I mean already setting it anon and setting vm_file non-NULL is really strange. > > > > > > > > > > > > > The user visible effect is the mapping entry shown in /proc//smaps > > > > > > > and /proc//maps. > > > > > > > > > > > > > > Before the change: > > > > > > > ffffb7190000-ffffb7590000 rw-p 00001000 00:06 8 /dev/zero > > > > > > > > > > > > > > After the change: > > > > > > > ffffb6130000-ffffb6530000 rw-p 00000000 00:00 0 > > > > > > > > > > > > > Yeah this seems like it might break somebody to be honest, it's really > > > > > > really really strange to map a file then for it not to be mapped. > > > > > Yes, it is possible if someone really care whether the anonymous-like > > > > > mapping is mapped by /dev/zero or just created by malloc(). But I don't know > > > > > who really do... > > > > > > > > > > > But it's possibly EVEN WEIRDER to map a file and for it to seem mapped as a > > > > > > file but for it to be marked anonymous. > > > > > > > > > > > > God what a mess. > > > > > > > > > > > > > [1]: https://lore.kernel.org/linux-mm/20250111034511.2223353-1-liushixin2@huawei.com/ > > > > > > I kind of hate that we have to mitigate like this for a case that should > > > > > > never ever happen so I'm inclined towards your solution but a lot more > > > > > > inclined towards us totally rethinking this. > > > > > > > > > > > > Do we _have_ to make this anonymous?? Why can't we just reference the zero > > > > > > page as if it were in the page cache (Willy - feel free to correct naive > > > > > > misapprehension here). > > > > > TBH, I don't see why page cache has to be involved. When reading, 0 is > > > > > returned by zero page. When writing a CoW is triggered if page cache is > > > > > involved, but the content of the page cache should be just 0, so we copy 0 > > > > > to the new folio then write to it. It doesn't make too much sense. I think > > > > > this is why private /dev/zero mapping is treated as anonymous mapping in the > > > > > first place. > > > > I'm obviously not suggesting allocating a bunch of extra folios, I was > > > > thinking there would be some means of handing back the actual zero > > > > page. But I am not sure this is workable. > > > As I mentioned above, even handing back zero page should be not needed. > > Ack. > > > > > > > > > Signed-off-by: Yang Shi > > > > > > > --- > > > > > > > drivers/char/mem.c | 4 ++++ > > > > > > > 1 file changed, 4 insertions(+) > > > > > > > > > > > > > > diff --git a/drivers/char/mem.c b/drivers/char/mem.c > > > > > > > index 169eed162a7f..dae113f7fc1b 100644 > > > > > > > --- a/drivers/char/mem.c > > > > > > > +++ b/drivers/char/mem.c > > > > > > > @@ -527,6 +527,10 @@ static int mmap_zero(struct file *file, struct vm_area_struct *vma) > > > > > > > if (vma->vm_flags & VM_SHARED) > > > > > > > return shmem_zero_setup(vma); > > > > > > > vma_set_anonymous(vma); > > > > > > > + fput(vma->vm_file); > > > > > > > + vma->vm_file = NULL; > > > > > > > + vma->vm_pgoff = vma->vm_start >> PAGE_SHIFT; > > > > This is just not permitted. We maintain mmap state which contains the file > > > > and pgoff state which gets threaded through the mapping operation, and > > > > simply do not expect you to change these fields. > > > > > > > > In future we will assert on this or preferably, restrict users to only > > > > changing VMA flags, the private field and vm_ops. > > > Sure, hardening the VMA initialization code and making less surprising > > > corner case is definitely helpful. > > Yes and I've opened a can of worms and the worms have jumped out and on to > > my face and were not worms but in fact an alien facehugger :P > > > > In other words, I am going to be looking into this very seriously and > > auditing this whole thing... yay for making work for myself... :>) > > Thank you for taking the action to kill the alien facehugger :-) Haha thanks I'll do my best :)) > > > > > > > > > Hmm, this might have been mremap()'d _potentially_ though? And then now > > > > > > this will be wrong? But then we'd have no way of tracking it correctly... > > > > > I'm not quite familiar with the subtle details and corner cases of > > > > > meremap(). But mmap_zero() should be called by mmap(), so the VMA has not > > > > > been visible to user yet at this point IIUC. How come mremap() could move > > > > > it? > > > > Ah OK, in that case fine on that front. > > > > > > > > But you are not permitted to touch this field (we need to enforce this...) > > > > > > > > > > I've not checked the function but do we mark this as a special mapping of > > > > > > some kind? > > > > > > > > > > > > > + > > > > > > > return 0; > > > > > > > } > > > > > > > > > > > > > > -- > > > > > > > 2.47.0 > > > > > > > >