From patchwork Wed Jul 8 12:13:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39973 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A338E38618D4; Wed, 8 Jul 2020 12:13:17 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150042.outbound.protection.outlook.com [40.107.15.42]) by sourceware.org (Postfix) with ESMTPS id 476EC386186A for ; Wed, 8 Jul 2020 12:13:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 476EC386186A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Szabolcs.Nagy@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5ze93BfbLbcuEm+Zn+c2UTV3oidTGH6Hh8zmKEVxkyw=; b=SnIoW9DmzhmqNFy2b0QTla9PUeTTFcMMf8iVyAiKfOVMf9ejmqAKIdlqsSZbli9+xtY0OBVhjinc6jHmMAxODN28ICYQHMR1q6awrV/SzBgoCeHehBc+jy6G7ngG4Ak0m5Ggi2aHVq4fL490rhnyshuH/Yq0+n8UC+mzjPZbptU= Received: from DB6PR0202CA0040.eurprd02.prod.outlook.com (2603:10a6:4:a5::26) by AM6PR08MB3077.eurprd08.prod.outlook.com (2603:10a6:209:48::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Wed, 8 Jul 2020 12:13:14 +0000 Received: from DB5EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:a5:cafe::7a) by DB6PR0202CA0040.outlook.office365.com (2603:10a6:4:a5::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21 via Frontend Transport; Wed, 8 Jul 2020 12:13:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT034.mail.protection.outlook.com (10.152.20.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.24 via Frontend Transport; Wed, 8 Jul 2020 12:13:14 +0000 Received: ("Tessian outbound 114f46c34313:v62"); Wed, 08 Jul 2020 12:13:14 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 63913eee4b3d760e X-CR-MTA-TID: 64aa7808 Received: from aec26546d3fc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1ACA8C33-BBDE-4582-8DD4-0189447899CE.1; Wed, 08 Jul 2020 12:13:08 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id aec26546d3fc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 08 Jul 2020 12:13:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AOX8rvSHIrzZs4NeN2FjBESg5mOpJ/8Iahl4ioe9QxGpdjGDnJWDe0/ik8RClBs1ksj2dxFwBlWIJknMrYycjQvVGvORufxUN0Qvts9snb4SVm+jC8fxLexE5g5O36XHI2EX1cI2BoHxOEtbp8WYDJ2cwzN6IHO3bIRvl0Y3kr/RJgROGkyfxf9lujyb147epvY734BUh9zkatSPvre/zMWN+z7W6SHFkYLdRAQ85V8XuOIfJr1eLlKa1e0PGdloH84Pxwwjn57Vg17hcUmfp09NprheUJ2TzEbDTG/2DT6qhBzLfoDLRwLlq1vIyWVHuhx7olH/142ep4z0JA5sKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5ze93BfbLbcuEm+Zn+c2UTV3oidTGH6Hh8zmKEVxkyw=; b=PAkd1IE+lipM9FVuQHkV12v9VuYY/9w2qIXA3UaudsKqJpRI7DsT0QPsxafEIpzfmrUJICg2pPSnD/TZbusFwYekZEzTAJjMfBrAzPNAFQ9tZ9E1dVEzFhco1Hv+zXSsuukQJx0X7++D0jiS9uevX4BF+Jub4efNEZ/dQrdv67OC19x0k/pf2YVbkm5lrN5xmbM6DesOlC5f4OJ+hrRa6fwNTNIMf+bcv80nnpl40KA66WgWjNa56zlb6IPQhjbjmfq/McuqsMcrsAemKhCbUSnIp8WVXddlEnKEf/HQkYEXMdQWyLH4cBtclfpYE7NuiiYjn3YGfSNnDa82D3SbVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5ze93BfbLbcuEm+Zn+c2UTV3oidTGH6Hh8zmKEVxkyw=; b=SnIoW9DmzhmqNFy2b0QTla9PUeTTFcMMf8iVyAiKfOVMf9ejmqAKIdlqsSZbli9+xtY0OBVhjinc6jHmMAxODN28ICYQHMR1q6awrV/SzBgoCeHehBc+jy6G7ngG4Ak0m5Ggi2aHVq4fL490rhnyshuH/Yq0+n8UC+mzjPZbptU= Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) by AM7PR08MB5527.eurprd08.prod.outlook.com (2603:10a6:20b:de::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.28; Wed, 8 Jul 2020 12:13:07 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3153.031; Wed, 8 Jul 2020 12:13:07 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v7 09/14] aarch64: ensure objects are BTI compatible Date: Wed, 8 Jul 2020 13:13:01 +0100 Message-Id: <171c576f3a8d9de36996721b8bab2884499c648b.1594209990.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0064.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::28) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.53) by LO2P265CA0064.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.23 via Frontend Transport; Wed, 8 Jul 2020 12:13:07 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b295f6d2-3851-4de5-2e30-08d823384a0c X-MS-TrafficTypeDiagnostic: AM7PR08MB5527:|AM6PR08MB3077: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-Forefront-PRVS: 04583CED1A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: AjQCLC9sVRauf+YErwBULoE22PBTCk5ThrkiXafxoZr3EjXzSO0dcQCj/AWHrDm449fFo9pAbC8gu/vKMHHGU6BRCV5evMEz0uPD1ojpkZo8czJp1B7H2EYhhwiG2Pwt4nEv2qhOSyNLMSACCvEkuViauSocIUREqywGrqTvnnVCPVcAps9QLT3D29HJLX/S4hpaq5jDR7V5EEhIrNGuKj5EVjwkWI2GFWJOtFwzHSZGEqTeYtOjQYyzg56fY6XepbCZ0l0hyvEMTBsPIHybZdI+nOwdgGoeC/BG4w5mGIKSNvu9NypJWP3EBu4Z8ArQpOcnR/JgC0W7WDcncDM6DifjYG8M5ggsheTj7m4vd8hLRNx95we+04kYogjO9VPPC7C0j/DPw5Mu699p9lVXIBroqyIijwoanXoiqtijY0Y= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(39860400002)(396003)(376002)(346002)(366004)(8676002)(478600001)(6506007)(2616005)(956004)(8936002)(44832011)(16526019)(2906002)(186003)(26005)(36756003)(66476007)(66556008)(6916009)(316002)(66946007)(6666004)(5660300002)(83380400001)(86362001)(69590400007)(6512007)(6486002)(52116002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 3PsV4DKEOQB+kEGbTc34l7sMxwSFVbv8Ll5XnQ989v3s4JFLycS/7XFoyhOwlGgnGSucXaciMe7VCeri5tg4BR3UglpioNHLAyXl80Zxky3hN4/9X5Q26j6UWnaALZX9T0/zJajW0QMS1tfuKbMvpC+X9EI04RHKMdtOLP+9NWWu/Po5BnSVRLzFRnJzK+YQaSs7V7kO7c3X8Cfn/WxoSrvdPoNg7cfYOrvFD6pt6X1Wm008d8kzcoLaYuyd5ZUN1gdWYECQ3bTy6LEimV2bjpOy7hNGo7F3XUSNclN9oE2dFTnVe8qlowjpH/bkDqAAkbxDNxrnDTJkKxbpKWAX8KNMMOHJhqeJSq2bQqNLWCA+Q81YvSJDBR9PnKvAfgSnyUVxLTnmNTogG4+hpzgFf452Fusc9VIIijEF71ty4+qLHaqlMbdcvqVAAHywE//d0w35WFROM8TW89v4dUUevBZRVSL4ucWmfsl1gHo2Dg0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5527 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT034.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(136003)(346002)(376002)(396003)(46966005)(82740400003)(26005)(6506007)(6916009)(6666004)(36756003)(83380400001)(69590400007)(47076004)(70206006)(70586007)(2616005)(6486002)(6512007)(316002)(8936002)(81166007)(86362001)(5660300002)(956004)(16526019)(186003)(356005)(44832011)(82310400002)(478600001)(2906002)(336012)(8676002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 9c3dc99f-8fe8-4599-a7e7-08d823384616 X-Forefront-PRVS: 04583CED1A X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yspg4J2JACb4mBObjPozegKWziyI5sGD+VYCgYPr56yChAre1PAQ+d5upFZ52B618qnXZcKdOlGgWuuiO46c10eYTLicrWAypr2GvxZwmo0bikFUtpuXYBlTqFvSqY7o2bs3iyt4xiwX0YoFY48kiRVLrVA/LIdNqdUuEaKK8Kg+04J0AoYlioLrGHJE+jlaSMUZD1aZ1zTIUYGcHM5X30Tg334wqQQBxfYbTXgXZkEWB4jz/ZMR9hyMEc5QJW/0Kpo+DVWRX33j0FhG5iBSn6U805/PWaoxAf92cT8QsqaLnqD8bpbBgAXSsFCsqoVZSmxOSxJydg94NGLDKRMojJhl6smEpg2O7NUjNYe0NQ6xYTiLYRamPsFQM/oVMLddNbUulnDv0kwzsuZDtvjMgw3hOpck0ZUkVe/su+ygGiZrAtIKydyVq5p4tL+2SiVOEDPN114nfwpJF6jFHpD+Qw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2020 12:13:14.0318 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b295f6d2-3851-4de5-2e30-08d823384a0c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3077 X-Spam-Status: No, score=-16.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" When glibc is built with branch protection (i.e. with a gcc configured with --enable-standard-branch-protection), all glibc binaries should be BTI compatible and marked as such. It is easy to link BTI incompatible objects by accident and this is silent currently which is usually not the expectation, so this is changed into a link error. (There is no linker flag for failing on BTI incompatible inputs so all warnings are turned into fatal errors outside the test system when building glibc with branch protection.) Unfortunately, outlined atomic functions are not BTI compatible in libgcc (PR libgcc/96001), so to build glibc with current gcc use 'CC=gcc -mno-outline-atomics', this should be fixed in libgcc soon and then glibc can be built and tested without such workarounds. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/Makefile | 8 ++++++++ sysdeps/aarch64/configure | 2 ++ sysdeps/aarch64/configure.ac | 1 + 3 files changed, 11 insertions(+) diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 5ae8b082b0..7f82fc055e 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -1,5 +1,13 @@ long-double-fcts = yes +ifeq (yes,$(aarch64-bti)) +# Mark linker output BTI compatible, it warns on non-BTI inputs. +sysdep-LDFLAGS += -Wl,-z,force-bti +# Make warnings fatal outside the test system. +LDFLAGS-lib.so += -Wl,--fatal-warnings +LDFLAGS-rtld += -Wl,-z,force-bti,--fatal-warnings +endif + ifeq ($(subdir),elf) sysdep-dl-routines += dl-bti endif diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure index 70477a7fa5..c637540436 100644 --- a/sysdeps/aarch64/configure +++ b/sysdeps/aarch64/configure @@ -210,6 +210,8 @@ EOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_bti" >&5 $as_echo "$libc_cv_aarch64_bti" >&6; } +config_vars="$config_vars +aarch64-bti = $libc_cv_aarch64_bti" if test $libc_cv_aarch64_bti = yes; then $as_echo "#define HAVE_AARCH64_BTI 1" >>confdefs.h diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac index 798f494740..2c2817514d 100644 --- a/sysdeps/aarch64/configure.ac +++ b/sysdeps/aarch64/configure.ac @@ -36,6 +36,7 @@ EOF libc_cv_aarch64_bti=yes fi rm -rf conftest.*]) +LIBC_CONFIG_VAR([aarch64-bti], [$libc_cv_aarch64_bti]) if test $libc_cv_aarch64_bti = yes; then AC_DEFINE(HAVE_AARCH64_BTI) fi