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 A43A1C433EF for ; Sun, 15 May 2022 10:05:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236209AbiEOKFb (ORCPT ); Sun, 15 May 2022 06:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236193AbiEOKFa (ORCPT ); Sun, 15 May 2022 06:05:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 961553D1E4; Sun, 15 May 2022 03:05:29 -0700 (PDT) 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 2E99160EF6; Sun, 15 May 2022 10:05:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39026C385B8; Sun, 15 May 2022 10:05:27 +0000 (UTC) Date: Sun, 15 May 2022 11:05:23 +0100 From: Catalin Marinas To: Andre Przywara Cc: Will Deacon , Shuah Khan , linux-arm-kernel@lists.infradead.org, Mark Brown , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kselftest/arm64: bti: force static linking Message-ID: References: <20220511172129.2078337-1-andre.przywara@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220511172129.2078337-1-andre.przywara@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On Wed, May 11, 2022 at 06:21:29PM +0100, Andre Przywara wrote: > The "bti" selftests are built with -nostdlib, which apparently > automatically creates a statically linked binary, which is what we want > and need for BTI (to avoid interactions with the dynamic linker). > > However this is not true when building a PIE binary, which some > toolchains (Ubuntu) configure as the default. > When compiling btitest with such a toolchain, it will create a > dynamically linked binary, which will probably fail some tests, as the > dynamic linker might not support BTI: > =================== > TAP version 13 > 1..18 > not ok 1 nohint_func/call_using_br_x0 > not ok 2 nohint_func/call_using_br_x16 > not ok 3 nohint_func/call_using_blr > .... > =================== > > To make sure we create static binaries, add an explicit -static on the > linker command line. This forces static linking even if the toolchain > defaults to PIE builds, and fixes btitest runs on BTI enabled machines. > > Signed-off-by: Andre Przywara Does this need to go in as a fix (cc stable, fixes tag)? -- Catalin 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F7F8C433EF for ; Sun, 15 May 2022 10:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J+raxpWfzIb62/xQqP8t07TeTrDiOF5BbzCEo9v7Bmk=; b=Z5z1HBYzkkkh6m QPxDoGv1iANJOLLFRcEwEJRQeM1xzI5EDSmGXZ6tKvLq2dg6TgHxm8DGOgERycN73Y/B7ei3aSIgz uYD6Ug99eE2HFCJICEGYQOA1Pb588V3gv4HBlmN7wtThy31PHJ/GlQiM/VtvbXxBgiR4m7FbeVTDO xcHzU3/c9qaUaVhB77Qf0SBygKG1uuJ8WIieqHqQbi/Wj+nxqcElZzWOyY2Wxpx/EwkZSHqUIwiJE VTc/P/TguB8AxXPXHHJKVkIzvfBCv3XIW5++W1IiV5kWveOm3oQoSZS6C8Z+fW1Kh/FsObBwnHXas 6+Hx7fzr7rBIw3IJAWFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqB83-003hSA-By; Sun, 15 May 2022 10:05:35 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqB80-003hRC-D0 for linux-arm-kernel@lists.infradead.org; Sun, 15 May 2022 10:05:33 +0000 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 ams.source.kernel.org (Postfix) with ESMTPS id D2926B80AF2; Sun, 15 May 2022 10:05:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39026C385B8; Sun, 15 May 2022 10:05:27 +0000 (UTC) Date: Sun, 15 May 2022 11:05:23 +0100 From: Catalin Marinas To: Andre Przywara Cc: Will Deacon , Shuah Khan , linux-arm-kernel@lists.infradead.org, Mark Brown , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kselftest/arm64: bti: force static linking Message-ID: References: <20220511172129.2078337-1-andre.przywara@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220511172129.2078337-1-andre.przywara@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220515_030532_607300_46C16F05 X-CRM114-Status: GOOD ( 16.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, May 11, 2022 at 06:21:29PM +0100, Andre Przywara wrote: > The "bti" selftests are built with -nostdlib, which apparently > automatically creates a statically linked binary, which is what we want > and need for BTI (to avoid interactions with the dynamic linker). > > However this is not true when building a PIE binary, which some > toolchains (Ubuntu) configure as the default. > When compiling btitest with such a toolchain, it will create a > dynamically linked binary, which will probably fail some tests, as the > dynamic linker might not support BTI: > =================== > TAP version 13 > 1..18 > not ok 1 nohint_func/call_using_br_x0 > not ok 2 nohint_func/call_using_br_x16 > not ok 3 nohint_func/call_using_blr > .... > =================== > > To make sure we create static binaries, add an explicit -static on the > linker command line. This forces static linking even if the toolchain > defaults to PIE builds, and fixes btitest runs on BTI enabled machines. > > Signed-off-by: Andre Przywara Does this need to go in as a fix (cc stable, fixes tag)? -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel