Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2251267iof; Wed, 8 Jun 2022 00:31:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIcOB++Fu3fA5/SRazn5Gofsdg0kYBFy8a8H2TLJgOI/YTaqGrUp1R12qaASpyBZjxRSfW X-Received: by 2002:a63:6306:0:b0:3fc:7529:7688 with SMTP id x6-20020a636306000000b003fc75297688mr29285498pgb.252.1654673464821; Wed, 08 Jun 2022 00:31:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654673464; cv=none; d=google.com; s=arc-20160816; b=dJ21FGToHaBRZjZkkqikNvur3nTWpmV2mxhyXAesPb6Ys8cT6gzUktpg9MXrMa6Osw 34djSXtg+eUuR9/y3KyBC5dF/m+VxDCPmB5P0T+xYd1YlyeqlQATDDsqPAzxR3AZFg63 e6Faw1Gi557hpZPlY8H0OQAOYaqdjT90xsA9SkPscAuJvNDU6sVfMzPciFPk5/9Dh66R xEAtPdoY9UDjLdrsyq7OYoin78U9iTXoJVWN7YdcQLV8TCFMyOBsqZd+xQI4/1tqucrX P/DI4pXW3IgnAIjcxIbfwrFrEGcHzMlwLuAIzttR2RuP4ZBzpQQHS/+nHBfoqQvfExE/ bq2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Psr5ThbQulJjR21SChD95k/MwewlW0qsVX1D+rwkMx0=; b=eByvwwE6u+UjqoHjes9zHjJLfgpNRHKur7uD58MMugmU8iozR/xEa+k9b/R1Hvy/uu qKM6knADT732P8uF6l/AcmYqrfBpTeouiLwBWaI/j0Ge8sK3nk//yepkQpypmu5/wHVs WXXwopAuxZ8Ggar1KgEI90ERpKrcg3zP6pUegPeGcMSdY762m5a3KvgaodAYPaW0C4pO HPyjvpxZYgZQh1kZQaSLfjXwnsZEWdpl0Zdd2/bNMt3LP+M3VtvbztlpcT+WZ50/CUGr m7pM3IJX0UrG29xnzuFNV67OMkyqj2D/6OihmxllaCIpFv54DUC2ZVZScc1S80VSevIX DITQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ELFOi8U2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v3-20020a17090a4ec300b001e345e5d5a3si25828051pjl.21.2022.06.08.00.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 00:31:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ELFOi8U2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 920A71BD7E9; Wed, 8 Jun 2022 00:03:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355193AbiFGTMz (ORCPT + 99 others); Tue, 7 Jun 2022 15:12:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351588AbiFGSYp (ORCPT ); Tue, 7 Jun 2022 14:24:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12F88E3DD3; Tue, 7 Jun 2022 10:54:28 -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 CA2BC6182B; Tue, 7 Jun 2022 17:54:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5DD1C3411F; Tue, 7 Jun 2022 17:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654624468; bh=HIQk/uw7vS5y7k9V6eMIFVegpbu+WXgZ8oYpaSKok5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ELFOi8U2ewrijln4fIYNSwhW5Y0dXLtkBkEW1HzM6fxj4coiodh8wQ8N/cYcKpSmt y1+YIeqQr987FVjiWg5y5xoUzv8jouiqhmRRtifssx4tf9Jfi89kRri1Kwf6/ukbuN w4jdW5sJrVfi4WeWyBDshuMOjYPa7e8/IXvEhR1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andre Przywara , Mark Brown , Catalin Marinas , Sasha Levin Subject: [PATCH 5.15 337/667] kselftest/arm64: bti: force static linking Date: Tue, 7 Jun 2022 19:00:02 +0200 Message-Id: <20220607164944.873123015@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164934.766888869@linuxfoundation.org> References: <20220607164934.766888869@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Andre Przywara [ Upstream commit d7a49291d786b4400996afe3afcc3ef5eeb6f0ef ] 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 Reviewed-by: Mark Brown Fixes: 314bcbf09f14 ("kselftest: arm64: Add BTI tests") Link: https://lore.kernel.org/r/20220511172129.2078337-1-andre.przywara@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- tools/testing/selftests/arm64/bti/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/arm64/bti/Makefile b/tools/testing/selftests/arm64/bti/Makefile index 73e013c082a6..dafa1c2aa5c4 100644 --- a/tools/testing/selftests/arm64/bti/Makefile +++ b/tools/testing/selftests/arm64/bti/Makefile @@ -39,7 +39,7 @@ BTI_OBJS = \ teststubs-bti.o \ trampoline-bti.o gen/btitest: $(BTI_OBJS) - $(CC) $(CFLAGS_BTI) $(CFLAGS_COMMON) -nostdlib -o $@ $^ + $(CC) $(CFLAGS_BTI) $(CFLAGS_COMMON) -nostdlib -static -o $@ $^ NOBTI_OBJS = \ test-nobti.o \ @@ -50,7 +50,7 @@ NOBTI_OBJS = \ teststubs-nobti.o \ trampoline-nobti.o gen/nobtitest: $(NOBTI_OBJS) - $(CC) $(CFLAGS_BTI) $(CFLAGS_COMMON) -nostdlib -o $@ $^ + $(CC) $(CFLAGS_BTI) $(CFLAGS_COMMON) -nostdlib -static -o $@ $^ # Including KSFT lib.mk here will also mangle the TEST_GEN_PROGS list # to account for any OUTPUT target-dirs optionally provided by -- 2.35.1