From patchwork Mon Nov 14 11:43:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098411wru; Mon, 14 Nov 2022 03:49:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf5e3ZNjiIIfy2o0ea3dqqaXWGb9w/BFQSSfGse8jDERCFatXlC+aIO2x6ZeziKb5OISCkA2 X-Received: by 2002:a17:907:900d:b0:78d:a7f0:e232 with SMTP id ay13-20020a170907900d00b0078da7f0e232mr10088730ejc.9.1668426596605; Mon, 14 Nov 2022 03:49:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426596; cv=none; d=google.com; s=arc-20160816; b=1BMUgOEnX8a/zMBJLW1/hLVLyUFITiRJhB4yyQqr6Wfwm3qAUXDjtDjFSzanItxP8r pnDhKs9NAyuJ1/pOl9sxzCEiNxu5yKN9PyjEmqoOvvRi7VA7yBKlbTWIeRYTTb8Cnxlc nQBHtnGHcbzcu1t4s6X2RuGKZfiR7z/hENnQSMBaTKY+xlJbcHbrBwRTXYnjWxgY4YwO VyUWZsCfHKaHL0Sox98s6orR5Hl9sDpLKlL20dPU+yoCHr7n/wYckzLICF6omEpPNpqO UNTTM+ICnwvcp3ShnN7BkrE/pnETMzfVbJra9CPbB451Q+eifw4PkmnOlTBtXvYjwsqp h3Hg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1wZifb8HxAVafLtlY4aUAD3Z2z2ALxhYZ2XGoWj4bMg=; b=J07ImrFmNq/Zi+I53hhrYy45Hb2GtXajDgLqCIhxsNWHW7NWvLbWEqpytFsBmgPzWg CSWB7+0JFCchgsvzXKh0rs6BNu2cwA/yBw1i0BTEia65NkbcxNicLbB4pberVzEHjDAr ToCQJLVbPFbPHakKD8u2qv1gF6Dgx/tx24kUa2PDOptpl2H85GWpb4HoOYNjCr86NlHU l/7feMsyBZESN0HeTtgxL+CE06ZNntoog9z0t3mjLxWcSM5K0XiGKhc0g9h0HsI/MMvJ fJV2PjRHZzkwv+KJbN0pdTUhnGn065ZvUEEvdROj3GrAO834k65Mm9bRqHCtUGtoboK4 qQ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W4TWAOiO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a05640226c500b00461c252c3f8si9010365edd.382.2022.11.14.03.49.32; Mon, 14 Nov 2022 03:49:56 -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=@kernel.org header.s=k20201202 header.b=W4TWAOiO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236881AbiKNLsp (ORCPT + 99 others); Mon, 14 Nov 2022 06:48:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236762AbiKNLsC (ORCPT ); Mon, 14 Nov 2022 06:48:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82785264A1 for ; Mon, 14 Nov 2022 03:45:34 -0800 (PST) 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 0E906B80E73 for ; Mon, 14 Nov 2022 11:45:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E621C433D7; Mon, 14 Nov 2022 11:45:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426331; bh=Sb5J4tc+210hDjMm1S+r84/cDdsYNhaQnAubcresp6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W4TWAOiOCRKCQ583UsRVJqRZL9TXgqtsh/kO2P2iM6H8yG5Vh3zIcUtnXgB+CtT9k J4XFfzRxV3rxNMJhERy4YISkzY63w1sJyGO8MmNJwcUGpHNICYvpOcWBW1bIVhpMqX I0XtivbOaI3ZGnEjeKPoBGT9ms+3RpXtDlYVCDCUUiNpVY0Um3Jm3BFJxQOED54X6u a5eQXUFEsjQneKC2G/orT8iFJCgVDFhpouGKGHs7MkvEX8FcluGPe5edNdTidV6wE7 25em7LPdg8CaXJKaN5/BjOqWfRDXnS3llMOvj0NWlr8sZNXaIh7lvcsE0r0qvFJbFF 3GgUWrZWjWF9w== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 39/46] x86, lto: Disable relative init pointers with gcc LTO Date: Mon, 14 Nov 2022 12:43:37 +0100 Message-Id: <20221114114344.18650-40-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472087038069776?= X-GMAIL-MSGID: =?utf-8?q?1749472087038069776?= From: Andi Kleen Relative init pointers are implemented using custom top-level assembler that references the init function. With LTO, the top-level assembler statement can end up in other assembler files than the init function, which then causes linker errors if the init function was static. This could be fixed by making all the init functions global, but that would be a very intrusive change all over the tree. Instead, disable relative init pointers for gcc LTO. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 67745ceab0db..6455d843d559 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -176,7 +176,9 @@ config X86 select HAVE_ARCH_MMAP_RND_BITS if MMU select HAVE_ARCH_MMAP_RND_COMPAT_BITS if MMU && COMPAT select HAVE_ARCH_COMPAT_MMAP_BASES if MMU && COMPAT - select HAVE_ARCH_PREL32_RELOCATIONS + # LTO can move assembler to different files, so all + # the init functions would need to be global for this to work + select HAVE_ARCH_PREL32_RELOCATIONS if !LTO_GCC select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_THREAD_STRUCT_WHITELIST select HAVE_ARCH_STACKLEAK