Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3248105pxb; Thu, 10 Feb 2022 16:21:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxlssvJarSGbEA4HS7wExc1tQ+VfOueYKlsciOUdUPT9q4EKc9Jjqu6ovh8xR7w+m0JD/+/ X-Received: by 2002:a17:906:728a:: with SMTP id b10mr506238ejl.288.1644538883905; Thu, 10 Feb 2022 16:21:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644538883; cv=none; d=google.com; s=arc-20160816; b=JkPEOzDLVIqA8rtvw0vGgaylxzO9BGgrFm5VOPxjeDiH7Rg6YftYS9gRA0QROv990a 1eniQFDyYczIZ06TrMj1aPsUOduwNOqquDrC8u/lSuWos4LozvmKmdp5jWzWoLVAX964 kCAPxx6vuctqjSMD2ilR1l8AB9wK/7R8tRyNKeKJh8aMrkTqa/rhaQalD7IF5Z9UbnQY 8kIZu9xUwUmYl43fycNdwjQiMdE8iE6FrnY6srvinmK4zaB0hXY+YS2oy73gxXtgnUi+ BRrkX4ULnAvdrsmekkdTwwphuae9h9CrAplRcTo9P3nAT2HNTi/POgeG6K7XJPm2Z9Zo JlNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=PNqxI1dLELp9HjB9DzvINopfTZFsPHonGeCs96iuWWw=; b=MXJ+0vwgQph0vatE17p0cLanHYCz74k28hGwfQKxqQ6r4I0bSNQNIIh4hNst5WFXpM AHYQoannA9dSNEM6BqlCiGL/tVqh9Ka29tv+1qWHdG0l/xS18hZKB0P2nH6Rzbi9bq47 vXp3kwiLwtAjUFUzLUjXJbxTo4denaYL/PrYrd1Wavwp9MagAicyo2YD7GpGK2nX+DNm ql7gMJeKYUUbmZHyCJ+9vFqGKICrjoXd+/AL3vZPK64Jg8fajYBxfLp3iQdlRS2ZazWQ 04f5sLwKwUAW+l2y5UwKSbsfgAHuZdlZPQnUjPfXYMzMH6k8KuyETZ/Z+wnC0UWfCqFW hznw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pLe8bXcq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y19si7447258edw.559.2022.02.10.16.20.59; Thu, 10 Feb 2022 16:21:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pLe8bXcq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345434AbiBJXH0 (ORCPT + 99 others); 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-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" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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