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 C0CC2C433FE for ; Tue, 15 Nov 2022 21:08:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3960F6B0081; Tue, 15 Nov 2022 16:08:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3451A6B0082; Tue, 15 Nov 2022 16:08:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20D8F8E0002; Tue, 15 Nov 2022 16:08:23 -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 121386B0081 for ; Tue, 15 Nov 2022 16:08:23 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A79F91C5D19 for ; Tue, 15 Nov 2022 21:08:22 +0000 (UTC) X-FDA: 80136914844.26.261F1BF Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf17.hostedemail.com (Postfix) with ESMTP id 5F43B40002 for ; Tue, 15 Nov 2022 21:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6xS2jzo+Wah9lxr2NfS/UZ9644G1gA/sqmdSnvREVHs=; b=EiNB1tnkdXXLjgnA4O8/EMHqKc 9FCIhHO3JxuJspTSZrpN1+LzvlyOODa+K933+ciiSUA4mJC1+5eYBU2xCXXes8hAOkFyfDz6CRYhp TClH0deL8UGOrL+njUyaiNfk3BlssJl6eBGe1h51BxVX8wfh/Tv+pXZxTEO9RgTEXOA9uarn6RjTW zLWEXyu+kMlx1Vm/QVoKE+pTMV6EkElmvUv66cSQKdnEXe+PgYc9FS9tNKJYh998x4OsLFeVQ5BR6 9FGjI0hI8JaKo486HpH9TFSI008U7pxXNIJwJWZ+Vz5qTAitgmZWdGNbp7SktYl0ZtQlnZXLPpM/D 9bJffGTg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ov39w-0016bM-2x; Tue, 15 Nov 2022 21:07:57 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id C26653001FD; Tue, 15 Nov 2022 22:07:54 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A7F06201646D4; Tue, 15 Nov 2022 22:07:54 +0100 (CET) Date: Tue, 15 Nov 2022 22:07:54 +0100 From: Peter Zijlstra To: "Edgecombe, Rick P" Cc: "bsingharora@gmail.com" , "hpa@zytor.com" , "Syromiatnikov, Eugene" , "rdunlap@infradead.org" , "keescook@chromium.org" , "Yu, Yu-cheng" , "dave.hansen@linux.intel.com" , "kirill.shutemov@linux.intel.com" , "Eranian, Stephane" , "linux-mm@kvack.org" , "fweimer@redhat.com" , "nadav.amit@gmail.com" , "jannh@google.com" , "dethoma@microsoft.com" , "kcc@google.com" , "linux-arch@vger.kernel.org" , "bp@alien8.de" , "oleg@redhat.com" , "hjl.tools@gmail.com" , "Yang, Weijiang" , "Lutomirski, Andy" , "pavel@ucw.cz" , "arnd@arndb.de" , "tglx@linutronix.de" , "mike.kravetz@oracle.com" , "x86@kernel.org" , "linux-doc@vger.kernel.org" , "jamorris@linux.microsoft.com" , "john.allen@amd.com" , "rppt@kernel.org" , "mingo@redhat.com" , "Shankar, Ravi V" , "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "gorcunov@gmail.com" , "akpm@linux-foundation.org" Subject: Re: [PATCH v3 15/37] x86/mm: Check Shadow Stack page fault errors Message-ID: References: <20221104223604.29615-1-rick.p.edgecombe@intel.com> <20221104223604.29615-16-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668546502; a=rsa-sha256; cv=none; b=6SKJ+OfrOUMw8L4s+d6XdT1GSrKsLBWf+7mSs8hXDpnBsk5LqmkBFgn0304DCQE39VjSPS 0v1+f2L9iXRZC5HsSitASA0Af1yyNRyPw44M5KsheHe/khFCijhp7WzzS/Qt4Hx/mPKWQr vyxDaoxlhvULY4PkQZdeZEjW6ehWh3Y= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=EiNB1tnk; spf=none (imf17.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668546502; 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=6xS2jzo+Wah9lxr2NfS/UZ9644G1gA/sqmdSnvREVHs=; b=UdwKdwp4sfeO3TccC7rWtZwIluCQoWeQxC7DxS/jO1zcvY1ond5fvoD5qXlKjZE5JFC+qG ONV67hmdlzU6i+fIIeszenKX77cNyJLIRgI27IQMM56A2QsG4wIaLvmmPE3mdlYc8/WwnD t1VNDo+JFJV6bmIz/rYCwwpNnGMf5lo= X-Rspam-User: X-Stat-Signature: 3k6b53q58gs46a9k8rxyq6m169nidk91 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5F43B40002 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=EiNB1tnk; spf=none (imf17.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none X-HE-Tag: 1668546501-246816 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: On Tue, Nov 15, 2022 at 08:03:06PM +0000, Edgecombe, Rick P wrote: > That's right. I think the assumption that needs to be broken in the > readers head is that you can satisfy a read fault with read-only PTE. > This is kind of baked in all over the place with the zero-pfn, COW, > etc. Maybe I should try to start with that. Maybe something like: CoW -- pte_wrprotect() -- changes a SS page 'Write=0,Dirty=1' to 'Write=0,Dirty=0,CoW=1' which is a 'regular' RO page. A SS read from RET will #PF because it expects a SS page. Make sure to break the CoW so it can be restored to an SS page, as such force the write path and tickle pte_mkwrite().