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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F3DBC4332F for ; Mon, 10 Oct 2022 12:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230516AbiJJMfJ (ORCPT ); Mon, 10 Oct 2022 08:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231177AbiJJMfG (ORCPT ); Mon, 10 Oct 2022 08:35:06 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1355F1583A for ; Mon, 10 Oct 2022 05:35:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665405301; 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=QA6f2HlVW1NJBZ3C2GoKq9SiJ7l5EStNIWPvZ+GnIV8=; b=PIon4rHaOshMl+hWKo7mYNaSr8EU69hlP9f/kNJmuh+cjSt0BhvvACNiOHZ5sNcBnankDS +gVaPBywPVGfmJ1dSlweFsow7cyydKR0NuRMMs5qi9AX7iUsNRQgyZfr2YqxEVPCjohUG3 5odEjiZ2FKW7txD01+Tv6M1gx8059oY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-2-wRjZH-_IOo-OjcM7dr5rog-1; Mon, 10 Oct 2022 08:33:41 -0400 X-MC-Unique: wRjZH-_IOo-OjcM7dr5rog-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F1E57185A792; Mon, 10 Oct 2022 12:33:39 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.124]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B496C2C8D6; Mon, 10 Oct 2022 12:33:32 +0000 (UTC) From: Florian Weimer To: Andrew Cooper Cc: Kees Cook , Rick Edgecombe , "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 , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , "H . J . Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V . Shankar" , Weijiang Yang , "Kirill A . Shutemov" , "joao.moreira@intel.com" , John Allen , "kcc@google.com" , "eranian@google.com" , "rppt@kernel.org" , "jamorris@linux.microsoft.com" , "dethoma@microsoft.com" , Yu-cheng Yu Subject: Re: [PATCH v2 18/39] mm: Add guard pages around a shadow stack. References: <20220929222936.14584-1-rick.p.edgecombe@intel.com> <20220929222936.14584-19-rick.p.edgecombe@intel.com> <202210031127.C6CF796@keescook> <37ef8d93-8bd2-ae5e-4508-9be090231d06@citrix.com> Date: Mon, 10 Oct 2022 14:33:30 +0200 In-Reply-To: <37ef8d93-8bd2-ae5e-4508-9be090231d06@citrix.com> (Andrew Cooper's message of "Wed, 5 Oct 2022 02:30:56 +0000") Message-ID: <87bkqj26zp.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org * Andrew Cooper: > You don't actually need a hole to create a guard.=C2=A0 Any mapping of ty= pe > !=3D shstk will do. > > If you've got a load of threads, you can tightly pack stack / shstk / > stack / shstk with no holes, and they each act as each other guard pages. Can userspace read the shadow stack directly? Writing is obviously blocked, but reading? GCC's stack-clash probing uses OR instructions, so it would be fine with a readable mapping. POSIX does not appear to require PROT_NONE mappings for the stack guard region, either. However, the pthread_attr_setguardsize manual page pretty clearly says that it's got to be unreadable and unwriteable. Hence my question. Thanks, Florian