Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2201140iof; Tue, 7 Jun 2022 23:02:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqEcbyndAtT2l2x1+ZxXV4VwP6IWBRX5j2Cz+kjc54VpYVCga3QKh66uX4l4nmknAVfCj4 X-Received: by 2002:a63:b13:0:b0:3fd:f319:f6aa with SMTP id 19-20020a630b13000000b003fdf319f6aamr7271702pgl.483.1654668172851; Tue, 07 Jun 2022 23:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668172; cv=none; d=google.com; s=arc-20160816; b=UBUwhMiOI2gbko1abiAzoKFCUMpu0xzc4xIXlnRVKTwbG6LX8KnzzmzaLCPbf77Obr 3Eyy/Vkn/Qfjg4gKbpGXcha+wtdf2ULN8S57HEIc4Vv88N/7LAxNQpEjOaJ/QMBGAAzi s1bP34zsjtnOlXcdFGIRPMi0eTkdACT7BRbMf/I6sF22GhAePqMMPM3AoPIdwrImVvvh 0QMA4NVRMxQxeiRxG0SjGfvhfGYPSCs47q4K20aUyb9t4SEZwt3F0KhMVxQJg4BRhdnU /cs+F3uPkVBwI+RfUBYzUhEJ2JzTlKqcrqrOx5fdJZ6DbmmF0fso/DtQoXlYfXA9c0W2 4zBw== 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=MvZChiFb4oQINKab75yZtKtL/7OcdcSDDCCCCLu6Lwiwk61Op6UkhVfIUcsvO1eDXk wbJYxu3oDJkMAhr3N4/jW5KyGDMVQvy2zWk8lgc2HSVwhDbvLH7OjNsS3cWyNvHpuq4e HstuJREtakQOu2Mh1jrEJWNgQZ3m+jIvk7vM1G+7UofMezDaiXqso4XyCspp0Ff/PTMx XDRVTHjqQOipTrcXk9FkKc7t8ruIY0jyhRryBXQ+WQ8EcWki3MHzRc6RvtDbNUljwv/Q nI8+DmhaQV9o1DR4SWPKBs1uNppPHQip0/fytFBUjyZ+yjskRuL5ZGHr0KXvPDVt9xML JxEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X1pPBkLi; 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 i193-20020a6287ca000000b005189da52427si25702801pfe.345.2022.06.07.23.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:02:52 -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=X1pPBkLi; 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 790DC3A7827; Tue, 7 Jun 2022 22:27:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348878AbiFHBYV (ORCPT + 99 others); Tue, 7 Jun 2022 21:24:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381245AbiFGVmo (ORCPT ); Tue, 7 Jun 2022 17:42:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82B5F50043; Tue, 7 Jun 2022 12:07:10 -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 ams.source.kernel.org (Postfix) with ESMTPS id D7AEAB81F6D; Tue, 7 Jun 2022 19:07:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EB4EC34115; Tue, 7 Jun 2022 19:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628827; bh=HIQk/uw7vS5y7k9V6eMIFVegpbu+WXgZ8oYpaSKok5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1pPBkLijY12NnTsDfQeEULz1hhL//S5Dd3ruO6M0OdgsN/OkmuVST3pig7ymT+Fl 0lHU0fkJr3h95lCpi7TE5BKsf3WpkUtw1nZR1gDFAN/5crNRSa3X7+LXlS7gdfhbBB Q+/02/uQfg8/kE0d0v58UWnHPdSTBzc4j31nklBw= 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.18 471/879] kselftest/arm64: bti: force static linking Date: Tue, 7 Jun 2022 18:59:49 +0200 Message-Id: <20220607165016.550577017@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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