Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2274448rwb; Mon, 7 Nov 2022 11:14:18 -0800 (PST) X-Google-Smtp-Source: AMsMyM53iTZ9MnrtFETKmjEOvit9LE90vnBs5zGwR7sPFMtuYCgBv4afbIxAP5BfD9wrysF2cJ/I X-Received: by 2002:a17:902:be18:b0:178:b9c9:97b8 with SMTP id r24-20020a170902be1800b00178b9c997b8mr50594587pls.38.1667848458298; Mon, 07 Nov 2022 11:14:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667848458; cv=none; d=google.com; s=arc-20160816; b=F7csjjlPz3k870AnqjVQMhcQWTc2qWDoqAslobI6hON/yRAJLzSHVoOYmpXh7qwF4U SyT5ZMdl2kaNkGJ7CsLnd8b5PvLWHPvOlTaOrUTzZp5QBnblv475jtu4GPoFN+u3LKUG wpoJKtD0bvEdUdS7ZlVT6xxTFGocb+ZtxQcZWPW0YqE793+/aFV/z6YA9nDP+sj19fmb aJMPWa8MTU8nCmNZ5PuwXb48ryV8PbrjpMMpEDls1zT8VP63YcCDIjCbcM8UV+qQo3Xl 5Eu+0PN6OmeV+46mKVUCSgcK+7DPOSVSFmisSFKs/QfxqdpYToAeZ/LLlGE3jzIvmyHR 5PKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=CnSdXKK8m/TJrSRjpKbt+NCWqdZs41kIo7jBijs/TeU=; b=F8pQIzLW8ArGR50rA5eF7B1DMuT7LBdL9uGSkW+sG3yBR37WyybwRbmz4naqXVXsLp kFRZdHUmaWleD3OoItK5TFxTZDTiu0q6s/JBM8a0p+1wfw2/WCv+QgK9MINZCM6PZlJ3 jEOdCpHXtcOTExZ1Davbs7ELAxql8qyKO6SrPXesvbqNxCxjNUAXG1gkjqdDyL88R6EA EIZz6GZFNV+v277FE03fcm8Q7sznRDV/4WvgZD0upgZeOhF5cC9vWXBUvQ3zNxgH65fu sbyW+tMhyR+0xivsinfIUzLh6EPITpA3N8o+QriryUjKENsDcbJfIbXVB31TFdtP0tQ/ N6nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dFI57mVe; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i27-20020a63585b000000b0046ee85f42e5si11772026pgm.64.2022.11.07.11.14.05; Mon, 07 Nov 2022 11:14:18 -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=@gmail.com header.s=20210112 header.b=dFI57mVe; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232408AbiKGTLP (ORCPT + 92 others); Mon, 7 Nov 2022 14:11:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232674AbiKGTKy (ORCPT ); Mon, 7 Nov 2022 14:10:54 -0500 Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54AD426AE5; Mon, 7 Nov 2022 11:10:53 -0800 (PST) Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-13c569e5ff5so13789609fac.6; Mon, 07 Nov 2022 11:10:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CnSdXKK8m/TJrSRjpKbt+NCWqdZs41kIo7jBijs/TeU=; b=dFI57mVeLdLCTF/+XJv4MLgt8AJf00hHj1SZ1TvShHINC1AeiIpsTbJYQD0PpD8f2P qyPIVPZbddFysDwm2/vv5n2pw/HvJ/hzgwF/9jBnbTb33IjvkaisUl4ESgfaaVhM2h32 Xc4sfsZB/Gnhnv2c+FbMk09/2hIVbVRtc357MkZuqAXJ8pPaN5GUAtBSZZe73KZHZ7l0 k3S9AYKJCFC2jrHqhX1BosNVb2BaF3M89cW7lxDFkyLs9vwkfhKruqHcqNPN9bqteOPQ P1IjYbSEGQSwSCkxZD0LwMdigGUJLKm4pSk6NTb/hGht89+/Dv7sBZmtG+w3oN18FErQ EoiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CnSdXKK8m/TJrSRjpKbt+NCWqdZs41kIo7jBijs/TeU=; b=4ZJvyvcsHmnWyDXERTQz8C12JJjf8VY1wXSBQHhOZ+3wkqsTYML/YfmSy5MGW378iW i0W9A47IJgvCc8e8/wFaQp6t3PPrfmTWGhXCjiwPZDlCovrIuwHeFreZo8g8Jqp9aX2T Nll6yqU/VvIfA78s8PQH1lQVCqkReAA2TJGmO86HQrTwIQRfMPMwZMn0l01KAmvIneGH RuMBjfrPc+FNqw2iMKikcU6Pv9f51m2AUOIOjYz2gph3ExmZA6+qH5WuDpKYFIqZdINN 5LaDX3BGkEWoV+je+8yrT5eDTB9LWKU9juphAsu5hE3HcAOjay7tIitdng6483Gz4iIM 1qXA== X-Gm-Message-State: ACrzQf1AsG1BuyZZCa2DlOTx0P1dX6YauAqn80r1JRJPP+NNzLttbnNy FYkPE99uX5T0YmSLjRwh7ytaGHj1TunG+W9QZLM= X-Received: by 2002:a05:6870:f5a4:b0:136:3e0d:acdd with SMTP id eh36-20020a056870f5a400b001363e0dacddmr32579634oab.298.1667848251194; Mon, 07 Nov 2022 11:10:51 -0800 (PST) MIME-Version: 1.0 References: <20221104223604.29615-1-rick.p.edgecombe@intel.com> <20221104223604.29615-38-rick.p.edgecombe@intel.com> <87iljs4ecp.fsf@oldenburg.str.redhat.com> <87h6zaiu05.fsf@oldenburg.str.redhat.com> In-Reply-To: From: "H.J. Lu" Date: Mon, 7 Nov 2022 11:10:14 -0800 Message-ID: Subject: Re: [RFC 37/37] fs/binfmt_elf: Block old shstk elf bit To: "Edgecombe, Rick P" Cc: "fweimer@redhat.com" , "bsingharora@gmail.com" , "hpa@zytor.com" , "Syromiatnikov, Eugene" , "peterz@infradead.org" , "rdunlap@infradead.org" , "keescook@chromium.org" , "Yu, Yu-cheng" , "Eranian, Stephane" , "kirill.shutemov@linux.intel.com" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "nadav.amit@gmail.com" , "jannh@google.com" , "dethoma@microsoft.com" , "kcc@google.com" , "linux-arch@vger.kernel.org" , "bp@alien8.de" , "oleg@redhat.com" , "Yang, Weijiang" , "Lutomirski, Andy" , "jamorris@linux.microsoft.com" , "arnd@arndb.de" , "linux-doc@vger.kernel.org" , "pavel@ucw.cz" , "mike.kravetz@oracle.com" , "x86@kernel.org" , "akpm@linux-foundation.org" , "tglx@linutronix.de" , "rppt@kernel.org" , "john.allen@amd.com" , "mingo@redhat.com" , "Shankar, Ravi V" , "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "gorcunov@gmail.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Mon, Nov 7, 2022 at 9:47 AM Edgecombe, Rick P wrote: > > On Mon, 2022-11-07 at 17:55 +0100, Florian Weimer wrote: > > * Rick P. Edgecombe: > > > > > On Sun, 2022-11-06 at 10:33 +0100, Florian Weimer wrote: > > > > * H. J. Lu: > > > > > > > > > This change doesn't make a binary CET compatible. It just > > > > > requires > > > > > that the toolchain must be updated and all binaries have to be > > > > > recompiled with the new toolchain to enable CET. It doesn't > > > > > solve > > > > > any > > > > > issue which can't be solved by not updating glibc. > > > > > > > > Right, and it doesn't even address the library case (the kernel > > > > would > > > > have to hook into mmap for that). The kernel shouldn't do this. > > > > > > Shadow stack shouldn't enable as a result of loading a library, if > > > that's what you mean. > > > > It's the opposite=E2=80=94loading incompatible libraries needs to disab= le > > shadow > > stack (or ideally, not enable it in the first place). > > The glibc changes I have been using would not have enabled shadow stack > in the first place unless the execing binary has the elf bit. So the > binary would run as if shadow stack was not enabled in the kernel and > there should be nothing to disable when an incompatible binary is > loaded. Glibc will have to detect this and act accordingly because not > all kernels will have shadow stack configured. > > > Technically, I > > think most incompatible code resides in libraries, so this kernel > > change > > achieves nothing besides punishing early implementations of the > > published-as-finalized x86-64 ABI. > > It's under the assumption that not breaking things is more important > than having shadow stack enabled. So it is not intended as a punishment > for users at all, rather the opposite. > > I'm not sure how much the spec mandates things by the letter of it, but > in any case things have gone wrong in the real world. I am very open to > discussion here. I only went this way as a last resort because I didn't > hear back on the last thread. Some applications and libraries are compiled with -fcf-protection, but they manipulate the stack in such a way that they aren't compatible with the shadow stack. However, if the build/test setup doesn't support shadow stack, it is impossible to validate. --=20 H.J.