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 8CC3DC433FE for ; Mon, 10 Oct 2022 12:33:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 081CF6B0071; Mon, 10 Oct 2022 08:33:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0301C6B0073; Mon, 10 Oct 2022 08:33:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DEDF96B0074; Mon, 10 Oct 2022 08:33:49 -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 CA5816B0071 for ; Mon, 10 Oct 2022 08:33:49 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 91203140C36 for ; Mon, 10 Oct 2022 12:33:49 +0000 (UTC) X-FDA: 80004981378.15.96133B8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.145.221.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 382BD160028 for ; Mon, 10 Oct 2022 12:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665405227; 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=BxcbtPiChPQLMSlDZt6Ry+vlm7r/VYuvucgnT04f1HsG4RzoTJzhnM34Tppnh7YpiMJcTm /bDWvwLsevPmpkpogUSrq/+7/nGpoMQDtmjVIKYZY5/PzmyNM/NZ8e8lVU6qHM27xLqf4j 3ZD5IEGVqyu2UF01D9GPpKaGya/Z7zE= 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665405228; a=rsa-sha256; cv=none; b=IG003Z+vtMHfQ5iFU3n2o88m9q0ioFFqsraT9WK4aPxaMhD9T6BOUgc6ttqEAbiqboIax+ vd+rIKQTGp1sFaISZ/Pz+L3Oo7ihCdNIBEToCi/9MDAfnhevB8Q6ofE/qHAoMb7TAqGYWH vC5jhLR7a/7oQiI3j4trK5+dKrPTP5k= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BxcbtPiC; spf=fail (imf08.hostedemail.com: domain of fweimer@redhat.com does not designate 216.145.221.124 as permitted sender) smtp.mailfrom=fweimer@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665405228; 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=QA6f2HlVW1NJBZ3C2GoKq9SiJ7l5EStNIWPvZ+GnIV8=; b=PNZ2+hgQSvEcgeB6wQ91xOIsa5Rj80x3nxi5eXRHVJc5PwxYqz479OaAR8/Xg5JER4XHsJ qL6lsgPxN+xTVrIt1IdrzRfQ/J40mp93si3o1RnQbGSXQR0oPIWqo/k7lwc00ABl+T7/5Q 5pyppkj/5ULfUhuX9F6d/reCFc5lGW4= Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BxcbtPiC; spf=fail (imf08.hostedemail.com: domain of fweimer@redhat.com does not designate 216.145.221.124 as permitted sender) smtp.mailfrom=fweimer@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: rngj5pg1bcg8ryesjhucaqu811z655z3 X-Rspamd-Queue-Id: 382BD160028 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1665405228-86973 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: * 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