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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9ACEFC4338F for ; Tue, 17 Aug 2021 20:24:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83AAF604D7 for ; Tue, 17 Aug 2021 20:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234594AbhHQUZJ (ORCPT ); Tue, 17 Aug 2021 16:25:09 -0400 Received: from mail.skyhub.de ([5.9.137.197]:36438 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237174AbhHQUYu (ORCPT ); Tue, 17 Aug 2021 16:24:50 -0400 Received: from zn.tnic (p200300ec2f117500b0ae8110978caeec.dip0.t-ipconnect.de [IPv6:2003:ec:2f11:7500:b0ae:8110:978c:aeec]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id AE11B1EC0556; Tue, 17 Aug 2021 22:24:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1629231843; h=from:from: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; bh=+yrW1YvDcJlPpXHuTQ1+89i5Y+U+96ERda2RQcSaGuw=; b=C1Bn0CPqvgGS5KpuudK22E1dJgTY5NTPkSI/Q5w0bDTkKQS0cynnWoc28EOwfoGfko1TrU us4DsxErEjkL3Gc0hHVcKYod7BmJDBUm0iGq5XjnZIed5vtQez3c/44kaZGK73NiO4Libs IYHHUABPOb4wMwNtsp9Lfvg7eUfxZtA= Date: Tue, 17 Aug 2021 22:24:47 +0200 From: Borislav Petkov To: Andy Lutomirski Cc: "Yu, Yu-cheng" , x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Dave Martin , Weijiang Yang , Pengfei Xu , Haitao Huang , Rick P Edgecombe , "Kirill A . Shutemov" Subject: Re: [PATCH v28 09/32] x86/mm: Introduce _PAGE_COW Message-ID: References: <1A27F5DF-477B-45B7-AD33-CC68D9B7CB89@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1A27F5DF-477B-45B7-AD33-CC68D9B7CB89@amacapital.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 17, 2021 at 01:13:09PM -0700, Andy Lutomirski wrote: > > If special kernel code using shadow stack management insns needs > > to modify a shadow stack, then it can check whether a page is > > pte/pmd_shstk() but that code is special anyway. > > > > Hell, a shadow stack page is (Write=0, Dirty=1) so calling it writable > > ^^^^^^^ > > is simply wrong. > > But it *is* writable using WRUSS, and it’s also writable by CALL, Well, if we have to be precise, CALL doesn't write it directly - it causes for shadow stack to be written as part of CALL's execution. Yeah yeah, potato potato. > WRSS, etc. Thus the "special kernel code" thing above. I've left it in instead of snipping it. > Now if the mm code tries to write protect it and expects sensible > semantics, the results could be interesting. At the very least, > someone would need to validate that RET reading a read only shadow > stack page does the right thing. Huh? A shadow stack page is RO (W=0). -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette