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 9D4ABC4167B for ; Wed, 21 Dec 2022 10:42:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233384AbiLUKmG (ORCPT ); Wed, 21 Dec 2022 05:42:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232647AbiLUKmE (ORCPT ); Wed, 21 Dec 2022 05:42:04 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB070B19; Wed, 21 Dec 2022 02:42:03 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 6336C1EC02DD; Wed, 21 Dec 2022 11:42:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1671619322; 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:in-reply-to:in-reply-to: references:references; bh=7CkPGRhXt3C7bFJAAfAquxjwR0jOGrK7nYvDtt66hu0=; b=GRapVaWDu6lZKfhjZkiYhoCHcSPH+kXJtn6xjHiQKh9E52C2tgrmD9oM27Qi8Fx3F0TQnp Tx+E5Ly5kbjJqyLrEbKUFVUEN4r5ZwOENt65wDkoyUzNgSL74aL+jBj194kl+VeDrmtZV6 s0lwbodldKDf8V+pdOweza6DxQ4DwwY= Date: Wed, 21 Dec 2022 11:41:58 +0100 From: Borislav Petkov To: "Edgecombe, Rick P" Cc: "akpm@linux-foundation.org" , "tglx@linutronix.de" , "linux-arch@vger.kernel.org" , "kcc@google.com" , "Lutomirski, Andy" , "nadav.amit@gmail.com" , "kirill.shutemov@linux.intel.com" , "Schimpe, Christina" , "peterz@infradead.org" , "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "jannh@google.com" , "dethoma@microsoft.com" , "x86@kernel.org" , "pavel@ucw.cz" , "rdunlap@infradead.org" , "linux-api@vger.kernel.org" , "john.allen@amd.com" , "arnd@arndb.de" , "jamorris@linux.microsoft.com" , "rppt@kernel.org" , "bsingharora@gmail.com" , "mike.kravetz@oracle.com" , "oleg@redhat.com" , "fweimer@redhat.com" , "keescook@chromium.org" , "gorcunov@gmail.com" , "Yu, Yu-cheng" , "andrew.cooper3@citrix.com" , "hpa@zytor.com" , "mingo@redhat.com" , "mtk.manpages@gmail.com" , "hjl.tools@gmail.com" , "linux-mm@kvack.org" , "Syromiatnikov, Eugene" , "Yang, Weijiang" , "linux-doc@vger.kernel.org" , "dave.hansen@linux.intel.com" , "Eranian, Stephane" Subject: Re: [PATCH v4 07/39] x86: Add user control-protection fault handler Message-ID: References: <20221203003606.6838-1-rick.p.edgecombe@intel.com> <20221203003606.6838-8-rick.p.edgecombe@intel.com> <3aaf1b0d67492415acb9b3d06bb97e916cb7b77a.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3aaf1b0d67492415acb9b3d06bb97e916cb7b77a.camel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Wed, Dec 21, 2022 at 12:37:51AM +0000, Edgecombe, Rick P wrote: > You mean having separate paths for kernel IBT and user shadow stack > that compile out? I guess it could just all be in place if > CONFIG_X86_CET is in place. > > I don't know, I thought it was relatively clean, but I can remove it. Yeah, I'm wondering if we really need the ifdeffery. I always question ifdeffery because it is a) ugly, b) a mess to deal with and having it is not really worth it. Yeah, we save a couple of KBs, big deal. What would practically happen is, shadow stack will be default-enabled on the majority of kernels out there - distro ones - so it will be enabled practically everywhere. And it'll be off only in some self-built kernels which are the very small minority. And how much are the space savings with the whole set applied, with and without the Kconfig item enabled? Probably only a couple of KBs. And if so, I'm thinking we could at least make the traps.c stuff unconditional - it'll be there but won't run. Unless we get some weird #CP but it'll be caught by do_unexpected_cp(). And you have feature tests everywhere so it's not like it'll get "misused". And when you do that, you'll have everything a lot simpler, a lot less Kconfig items to build-test and all good. Right? Or am I completely way off into the weeds here and am missing an important aspect...? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette