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 D586BC369B8 for ; Mon, 14 Apr 2025 22:44:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 033122800E9; Mon, 14 Apr 2025 18:44:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F22EB2800A7; Mon, 14 Apr 2025 18:44:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DEAB22800E9; Mon, 14 Apr 2025 18:44:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C074B2800A7 for ; Mon, 14 Apr 2025 18:44:26 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C8E9916076A for ; Mon, 14 Apr 2025 22:44:27 +0000 (UTC) X-FDA: 83334129774.01.F604E86 Received: from mx0b-00823401.pphosted.com (mx0b-00823401.pphosted.com [148.163.152.46]) by imf25.hostedemail.com (Postfix) with ESMTP id C664AA0005 for ; Mon, 14 Apr 2025 22:44:25 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=37MtPe2+; dmarc=pass (policy=none) header.from=motorola.com; spf=pass (imf25.hostedemail.com: domain of mbland@motorola.com designates 148.163.152.46 as permitted sender) smtp.mailfrom=mbland@motorola.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744670665; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=D/cPLBpNaY7IG7s+uxYBLEgAEukvVZ/Jx8w1LcX6TNY=; b=8VhqQA4QzZNTydgdPsIJcbq+rDnzXJOY3A6o8KU/d745HQcnao5zG79JZgRtnZFn3DmX9W d3hz4N2q2rOgmO80a1i8MI0/VZG5wnXKETmDNbQ5W5IBNXl3/gdpfA6pL1tWcEALesQRTZ HY28K3IkUIeQuEtbTzItNbyGiLxXXOU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=37MtPe2+; dmarc=pass (policy=none) header.from=motorola.com; spf=pass (imf25.hostedemail.com: domain of mbland@motorola.com designates 148.163.152.46 as permitted sender) smtp.mailfrom=mbland@motorola.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744670666; a=rsa-sha256; cv=none; b=Irt3PKcxnSnTATjOA8WIKooSd83859/99xA7JkQYywn+U8wuLKc6U86Vfshc6Mb5Eq3OMl 8WwOwd5Re8o5/+EqF62gBng7RGslbSpNYG86/iSos94ENAf1TzPh9o2pWM3hc224Qwf0bD KUPfMquNJyU18OgtQcWGqDg05puI0Fc= Received: from pps.filterd (m0355090.ppops.net [127.0.0.1]) by m0355090.ppops.net (8.18.1.2/8.18.1.2) with ESMTP id 53EFjn3t019360; Mon, 14 Apr 2025 22:43:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=DKIM202306; bh=D/cPLBpNaY7IG7s+uxYBLEg AEukvVZ/Jx8w1LcX6TNY=; b=37MtPe2+ewGYz44vyX13gc57Ay5RFeM2siTG2Oz F2Hvw0Gfjeq8J3ufftdGtpkdI0rRVDHcDtej8L25TtUqxX0WGd+1h+soQqpzWk7E 4Uf8CJ7+3TLVYtdJM5JThfDxEj79+CDg7KYxkYfOVuomYq4LcKP8FZL736i7xfua AuyK2Zflm9vXippfTyTxJewid7eqwg2GT87POBS0S10Hyu+SSxacsTdNs2A16uBP IBvA4m3FP+3a3J/65oTwVN4OedwlI2CmPJhxGGNwRBe7TIZME4i1XDNFylbvZuiD cLivrO9O1RoPm7cP0k6XPx/sD20tu2TxTCldCy4wMcqbj0Q== Received: from iadlppfpol2.lenovo.com ([104.232.228.81]) by m0355090.ppops.net (PPS) with ESMTPS id 4603gukden-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Apr 2025 22:43:24 +0000 (GMT) Received: from ilclmmrp02.lenovo.com (unknown [100.65.83.26]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by iadlppfpol2.lenovo.com (Postfix) with ESMTPS id 4Zc2Pb3CLkzYkjct; Mon, 14 Apr 2025 22:43:15 +0000 (UTC) Received: from ilclasset02 (ilclasset02.mot.com [100.64.11.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mbland) by ilclmmrp02.lenovo.com (Postfix) with ESMTPSA id 4Zc2Pm0bBkz3p6l2; Mon, 14 Apr 2025 22:43:24 +0000 (UTC) Date: Mon, 14 Apr 2025 17:43:20 -0500 From: Maxwell Bland To: Kevin Brodsky Cc: linux-kernel@vger.kernel.org, Andrew Morton , Mark Brown , Catalin Marinas , Dave Hansen , Jann Horn , Jeff Xu , Joey Gouly , Kees Cook , Linus Walleij , Andy Lutomirski , Marc Zyngier , Peter Zijlstra , Pierre Langlois , Quentin Perret , "Mike Rapoport (IBM)" , Ryan Roberts , Thomas Gleixner , Will Deacon , Matthew Wilcox , Qi Zheng , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, x86@kernel.org Subject: Re: [RFC PATCH v3 00/15] pkeys-based page table hardening Message-ID: References: <20250203101839.1223008-1-kevin.brodsky@arm.com> <802963a0-32bd-49e8-82b1-34443acdd5ae@arm.com> <107650bf-a8c1-4a71-a302-2e80abd5d062@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <107650bf-a8c1-4a71-a302-2e80abd5d062@arm.com> X-Proofpoint-ORIG-GUID: u5D-UadS7v89dy-zw2UEWuH7V_j9ffAh X-Proofpoint-GUID: u5D-UadS7v89dy-zw2UEWuH7V_j9ffAh X-Authority-Analysis: v=2.4 cv=EvPSrTcA c=1 sm=1 tr=0 ts=67fd8f8c cx=c_pps a=Bzw+04pMMuzJwu0RtP1G/Q==:117 a=Bzw+04pMMuzJwu0RtP1G/Q==:17 a=kj9zAlcOel0A:10 a=XR8D0OoHHMoA:10 a=Pj3cbH4x630mQXpL76YA:9 a=CjuIK1q_8ugA:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-14_08,2025-04-10_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 spamscore=0 phishscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504140163 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: C664AA0005 X-Stat-Signature: icw5pcer38c8gc9xfsdt9d4wyys5uta8 X-Rspam-User: X-HE-Tag: 1744670665-101429 X-HE-Meta: U2FsdGVkX1+tMeI+eDbd6rKT8xPwEHE9nVuWhu4Oe11RfiVYYQtDCWRj4cZPnOr0ur75cdvSVKGQVRCuLsVjzoC+WvWWDGf13vMA+V8ATzy2ajpGgQzjGlF754j5RY3UjR17wFntk9pn+HO3siDq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gdyCX1J61pyYIescl44wsU6uZ0ER1gIsP 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 Fri, Apr 04, 2025 at 09:57:02AM +0200, Kevin Brodsky wrote: > On 28/03/2025 17:15, Maxwell Bland wrote: > Overall this seems worth investigating. I wonder, have you considered > how accessors would find the shadow memory? It could of course be linked > directly from task_struct, but then nothing prevents that pointer from > being corrupted. I can't think of another cheap way to link $p$ though. > This is not a full-blown shadow memory approach, so I'm not sure we can > reserve a whole chunk of the address space for that purpose. Hi, apologies for the delay again, I had much fire to put out last week. I saw you posted a V4 for this, so I'll close out this chain. W.r.t. the above, it may be possible to segment the RB tree in vmalloc.c and designate an allocation region for this purpose. I did something similar to enforce PXNTable-across-vmalloc a year or so ago which ended up successful on a production device. I plan to experiment a bit with different approaches and will probably send the code to the mailing list once/if I get something together (also if it isn't pre-empted by someone smarter and faster doing something better). (-: > Indeed. For experimenting a Coccinelle script to convert direct access > to certain members to a function call is probably easier :) This does keep it in-kernel, which is nice, and I will keep this in mind as I write. Thank you for the discussion and patch, as well as the newest one! - Maxwell Bland