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 34147C43219 for ; Thu, 10 Feb 2022 23:07:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345429AbiBJXH0 (ORCPT ); Thu, 10 Feb 2022 18:07:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345425AbiBJXHX (ORCPT ); Thu, 10 Feb 2022 18:07:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D5CF5F45 for ; Thu, 10 Feb 2022 15:07:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD59061D5F for ; Thu, 10 Feb 2022 23:07:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 316EFC340F8 for ; Thu, 10 Feb 2022 23:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644534443; bh=MpjbTs2AoYPM1cEieyRbZViurjwRjHJe1IjmNAem4ZQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=pLe8bXcq19et61m9ujLHJQ85Z8TpSMP5fXsivO2GIQcSObRnPxPgKGUq8CI8z+2+U jE51eBZVxdfAhwEOyuIJttUpgjZ8ckXrKMB4DV6Y+4hNQYIo5iBKtDPDqVcXOzyvUM pska714X551rWzbsXzRZeqvI3eRlexMlpeoZmF/Pf0OsUmJW5kvhUt1KUoUsyDzKPC 8yTkdwLAcjtLUvNcbYzK+rkmVNyNkoAh7a+q6x/Qwu61KDT4ph8Xo3dtKS2kQllVMy NEmd5zwaTC1aKVDVszaAyx1JOe3rVimQsEBBY/EodvKt87oHMveHSisYmhN1QX4Y6U sNdeKgHC18sZA== Received: by mail-ed1-f51.google.com with SMTP id f17so13654953edd.2 for ; Thu, 10 Feb 2022 15:07:23 -0800 (PST) X-Gm-Message-State: AOAM532KtkJuRHWG2zHJqG93JY1u+nZWyZk2RHQfbhESLqGMKzralJa4 ogn5mG9ddaU1wngZunXzy6RRw+2CM/pwHUl3RiqQ8A== X-Google-Smtp-Source: ABdhPJxS8HJLUSGJfYOhID6yYZrHkqyIQTwmdEqPryBMs8qpUzLEn5ETtQ6MUdtPgqQJ5O+pj34qGLRGx/VYU3EGO5g= X-Received: by 2002:a05:6402:90b:: with SMTP id g11mr7368740edz.73.1644534441171; Thu, 10 Feb 2022 15:07:21 -0800 (PST) MIME-Version: 1.0 References: <20220130211838.8382-1-rick.p.edgecombe@intel.com> <20220130211838.8382-19-rick.p.edgecombe@intel.com> <4c216532-2b68-dd95-93f1-542df4786d7a@intel.com> In-Reply-To: <4c216532-2b68-dd95-93f1-542df4786d7a@intel.com> From: Andy Lutomirski Date: Thu, 10 Feb 2022 15:07:09 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 18/35] mm: Add guard pages around a shadow stack. To: Dave Hansen Cc: 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 , 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 , "Kirill A . Shutemov" , joao.moreira@intel.com, John Allen , kcc@google.com, eranian@google.com, Yu-cheng Yu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 10, 2022 at 2:44 PM Dave Hansen wrote: > > On 1/30/22 13:18, Rick Edgecombe wrote: > > INCSSP(Q/D) increments shadow stack pointer and 'pops and discards' the > > first and the last elements in the range, effectively touches those memory > > areas. > > > > The maximum moving distance by INCSSPQ is 255 * 8 = 2040 bytes and > > 255 * 4 = 1020 bytes by INCSSPD. Both ranges are far from PAGE_SIZE. > > Thus, putting a gap page on both ends of a shadow stack prevents INCSSP, > > CALL, and RET from going beyond. > > What is the downside of not applying this patch? The shadow stack gap > is 1MB instead of 4k? > > That, frankly, doesn't seem too bad. How badly do we *need* this patch? 1MB of oer-thread guard address space in a 32-bit program may be a show stopper. Do we intend to support any of this for 32-bit? --Andy