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 98BE2C05027 for ; Mon, 20 Feb 2023 03:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbjBTDmW (ORCPT ); Sun, 19 Feb 2023 22:42:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbjBTDmU (ORCPT ); Sun, 19 Feb 2023 22:42:20 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D74769F for ; Sun, 19 Feb 2023 19:42:19 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id f18so919270pfc.0 for ; Sun, 19 Feb 2023 19:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=Re/3/CIaa6TLc9AUoK8DtIbP6WDJvTLErHxyMeEWQ0Q=; b=bUicfI6Ma3EQ14U6HkyUCUkMgBXWz0Jtu9LXzZBQq+jhzNVmyjEsHDEU99D5pJhVX6 AOAaLuuBywKXLhjasaxR0PqhIiT3u/+umR9b3X8I7uqhjnllwC8TTipygr1UqBjF+6lu iypv9f/7GRPjFX61d/SP2lUFvQEUPpfhMjRlU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Re/3/CIaa6TLc9AUoK8DtIbP6WDJvTLErHxyMeEWQ0Q=; b=jIoNq5tqMqpi9iZ+uz4tjcXgsvQkdGxaMe7rLkwfQx5adcOiumXg7sYMxx2zGuk+EB abfQMoR4LZUnMlHwOnYe5G0uKwO8IUc3BuBmvGDoJdibVXzBAhUFyYjU0geF1hJnIVUC qmOjNml8RIXcAKDW5tRQUQv2CFxK8Qyu5r/NgqyLTA6GadJYjM1FWH89pdP+VlcocCjC VEcb3ij0IbVSWOKW90KbsTeKp4jnEB63XPFfxmshLL5FMfjodhjim1hNWQ04tiWivnv0 vkhc6qtej4fEXUG9456S/+8kY21B45A1nZXCtbFhQ0OxOJeyU+e7WPY0CPB94FQ0mqnV r28Q== X-Gm-Message-State: AO0yUKXjSEzx3fIGwXr6Nu/gAPxmJTcBliVnAdixX4BgiDgOUOKm0ysA kNHDZgUw1kEdYlZ9j3utpUxSbQ== X-Google-Smtp-Source: AK7set9ubhHzd0Qkpgz++VanVE9nN2ctikK/vAUG79ejzwTZpF5yu/FjqRddJiWdmGAc+LTQM3AO0A== X-Received: by 2002:aa7:8f0e:0:b0:5a8:c2bb:f0c4 with SMTP id x14-20020aa78f0e000000b005a8c2bbf0c4mr1702839pfr.13.1676864539219; Sun, 19 Feb 2023 19:42:19 -0800 (PST) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id e22-20020aa78256000000b00575d1ba0ecfsm6571669pfn.133.2023.02.19.19.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 19:42:18 -0800 (PST) Message-ID: <63f2ec1a.a70a0220.bb3e0.bb19@mx.google.com> X-Google-Original-Message-ID: <202302191938.@keescook> Date: Sun, 19 Feb 2023 19:42:17 -0800 From: Kees Cook To: Rick Edgecombe Cc: 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 , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , Weijiang Yang , "Kirill A . Shutemov" , John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, akpm@linux-foundation.org, Andrew.Cooper3@citrix.com, christina.schimpe@intel.com, david@redhat.com, debug@rivosinc.com Subject: Re: [PATCH v6 00/41] Shadow stacks for userspace References: <20230218211433.26859-1-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230218211433.26859-1-rick.p.edgecombe@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 18, 2023 at 01:13:52PM -0800, Rick Edgecombe wrote: > This series implements Shadow Stacks for userspace using x86's Control-flow > Enforcement Technology (CET). CET consists of two related security features: > shadow stacks and indirect branch tracking. This series implements just the > shadow stack part of this feature, and just for userspace. Okay, I've done some bare metal testing, and it all looks happy. The selftest passes, and I can can see the stack address mismatch get detected if I explicitly rewrite the saved function pointer on the stack: [INFO] Want normal flow [INFO] Found 0x401890 @ 0x7fff47cf2ef8 [INFO] Normal execution flow [INFO] Want to redirect [INFO] Found 0x401890 @ 0x7fff47cf2ef8 [INFO] Hijacked execution flow [INFO] Enabling shadow stack [INFO] Want to redirect [INFO] Found 0x401890 @ 0x7fff47cf2ef8 Segmentation fault (core dumped) Tested-by: Kees Cook -- Kees Cook