Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1220341pxp; Sat, 12 Mar 2022 05:04:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwnwYKQY0uW1IwDr52+FcFMnA5TdYJ8DRa96B7bV6dBhix1PgkIGdrPoU1x+8nqlt5bG5YC X-Received: by 2002:a63:ba45:0:b0:381:11:8da7 with SMTP id l5-20020a63ba45000000b0038100118da7mr8331246pgu.309.1647090261739; Sat, 12 Mar 2022 05:04:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647090261; cv=none; d=google.com; s=arc-20160816; b=HPCek7kLUsfmC7wgmt+PwTWksVwYcbj+QK4nBKgMlpYIPdxD5M27/ZlzqFOM4cwUOX SmMygjsutOA9fjPrC3dg9DRuSBpcupDdKJHvnlACgyjtkulbfnLmrhn53W7oIsDG3U3p RgZ8qljGp2gJDI/zNlfpsHNuyb0cvfPg+cV1L6yBQTdklX28EobOdoa4HpjY7lvY9mws 3zKdaTc2rA8D8CL9HbqzB7Zb3YOUTfNuZjMlBikBWIJyMUO5NwEG6nhNoq+Xqu6rkibu 1MVILNPhNKzzBgdbH/o5iAIyLaH0Y/v1se0pcGFN7V6I82QuwQvhCX1q14D/h4mnus09 H4ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=I4LbsDeMsT9PAzJ2X50ulKRjmZGAas7W4QaYBWmBc+c=; b=Poolzq68t0B4R1ELfRldIP3BNHHecoCH70iO0ZS7X0MBHAuPYikw3GPaPW9MM3c69e jy1nXBi6fIe6/UlN1QCiNIFGRsAZPFePpqPb3GDRv8JuOlCyc09GwRJM8uDuruE+yTiW nTOTOtuGICP8+9UAzfVq9viIj2qbJyLp3Uos2n8EsqOc1H07+WgSzDJtn4oW6s2km0+C DfIYljkTgzJcUZG3DAw6RFYAZQbOmu0KX52b5vJmLbeCqhywIeTZxhEuH55SgzhSOm0/ 6Gn2LwtMng4JSyHMdB15x6rAKaQ+IPM4cgE+5gvu3vu5iB8ykf+X7p9vE96N1ansqTnW i3Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Vh1QuQPv; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020a632149000000b0038077f647a2si3727524pgm.493.2022.03.12.05.04.08; Sat, 12 Mar 2022 05:04:21 -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=@infradead.org header.s=desiato.20200630 header.b=Vh1QuQPv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbiCLMVM (ORCPT + 99 others); Sat, 12 Mar 2022 07:21:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbiCLMVL (ORCPT ); Sat, 12 Mar 2022 07:21:11 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3DD917A96 for ; Sat, 12 Mar 2022 04:20:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=I4LbsDeMsT9PAzJ2X50ulKRjmZGAas7W4QaYBWmBc+c=; b=Vh1QuQPvLdKK7Q1gALKLp5ebnY VReCh60MtZR8uf4Wbqto6ILSSDF3OcCYeHUJ0OsDU9b/S2DKgycXIhWsKP0hNw7sAj/mcHT5FYnWJ 8AykbnXvWaLSMIxI3H9vsidoGHmrA/Lh40OmEHcHolID/vHfnyZk0DBiht9GVpYq6+xpUIm1hdCfo Dme8w5aWqhrOZEA1YAsQVj6aQtuxs6HMt4ybKge1pkOBi0hYfbHpd17HXaoN+/qYCHMmGj/1hoxBi l3DGbg04Mlnil6LX9rceP/bQh/sXPaX6gas9YkXoJAwQf0VQeFrffdgaSU1g33rMhT5e9Z4t3j2OX A2xKo5sg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nT0j2-000AEP-Je; Sat, 12 Mar 2022 12:20:00 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 39C4B98791D; Sat, 12 Mar 2022 13:20:00 +0100 (CET) Date: Sat, 12 Mar 2022 13:20:00 +0100 From: Peter Zijlstra To: Nathan Chancellor Cc: x86@kernel.org, Nick Desaulniers , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] x86/ibt: Fix CC_HAS_IBT check for clang Message-ID: <20220312122000.GB28057@worktop.programming.kicks-ass.net> References: <20220311195642.2033108-1-nathan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220311195642.2033108-1-nathan@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Fri, Mar 11, 2022 at 12:56:42PM -0700, Nathan Chancellor wrote: > Commit 41c5ef31ad71 ("x86/ibt: Base IBT bits") added a check for a crash > in clang. However, this check does not work for two reasons. > > The first reason is that '-pg' is missing from the check, which is > required for '-mfentry' to do anything. > > The second reason is that cc-option only uses /dev/null as the input > file, which does not show a problem: > > $ clang --version | head -1 > Ubuntu clang version 12.0.1-8build1 > > $ clang -fcf-protection=branch -mfentry -pg -c -x c /dev/null -o /dev/null > > $ echo $? > 0 > > $ echo "void a(void) {}" | clang -fcf-protection=branch -mfentry -pg -c -x c - -o /dev/null > ... > > $ echo $? > 139 > > Use this test instead so that the check works for older versions of > clang. > > Fixes: 41c5ef31ad71 ("x86/ibt: Base IBT bits") > Signed-off-by: Nathan Chancellor Urgh... not pretty, but that's what we gotta live with I suppose. Thanks!