Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5598033img; Wed, 27 Mar 2019 11:24:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXplIgpt3W1sYJRHJZWhi9iCa0enmDjybNO8A2WosPksMiNVskGA6ZXTuyx6uTJVBXZnt4 X-Received: by 2002:a63:4616:: with SMTP id t22mr34855783pga.217.1553711064848; Wed, 27 Mar 2019 11:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553711064; cv=none; d=google.com; s=arc-20160816; b=ZNESoPtP57rXm5z5GvKQv7X/K4tvNCdttWX3wBi2XRtmc4w2s/skhjnEPNgptem3C1 UAHMZkkBvYYpyGEiU0O6EQmW5QwwBcAQ1EAHfqf7y+8mX08fmQAlSkUcWJ8mKYD9pi8I Nh2QkXaDCCTVckIIPstCvIpuWLoUYszBBRR+E7p+L5VVRVQAZyzTobU1HZt72mOCe1U0 zIKzZsLnYja/5j2qrUjRZ11Zy8FOAf5KGSNc2dlNINEHWB28cklexv6q4GQdii1s93yX 36tZG8xMBpCGz8g61IsIKHnz4ZMw8JF5ZqQORFmcdvGF0Hw/icVA+3wPIzPfqcXvtQYm 6CDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5DYQ3yAQr9Nf89RP1spA8bSx4nwCtxplslEcjJDMUlA=; b=ZREeU4Ors5q4ccuECTY9ErcVGHe6J+qGRUjfDiyql+emY/xcuoReNZXX/aGyhD3c3Y b2XFhnjEO7t7vUnfAiq3R8nQa4uZm/5R7UGjC5+0OlRIJ0qX/NRv8YMV4ocsXVXm3hE5 oM/IS8TZO5CArAJzJDnY0COKt9Ky5h0GlEOXxV6ju9kYvhhRCo20rR7QztUbakg0DiGf VXZ7RG7q01EGjXVkzMzS/yKg27nLdKQzGacJbh98rvmiktJUx2E5ogBg7bG+K6QRZu1z YqqGGNlitbO9AQKo0GM4CpwGUolbcA5HCYRkvFhissMSAT1saM7z+4pbIuT/1WoL3099 9ozw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uPrkFjTK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si18167595pfd.228.2019.03.27.11.24.09; Wed, 27 Mar 2019 11:24:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uPrkFjTK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2391484AbfC0SXZ (ORCPT + 99 others); Wed, 27 Mar 2019 14:23:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:41764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390998AbfC0SXU (ORCPT ); Wed, 27 Mar 2019 14:23:20 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8A56020643; Wed, 27 Mar 2019 18:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710999; bh=YLDaf5QYjSyieJpwIPUtgd4FJ0JjKsrv5e3tsYIbWXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uPrkFjTKItlcWhmaMIepF6yfbAp1ciQcJ94ywymzqWjxPorxhYcCdV+Nno/0YD2oe q5JGCP0FrcbfUUpdBCWcfRzVJMjSc2+EoWAn/V8H6R9bPUgzrSX4zbzxmWkjkgNT2u dDK6Sf2Y7tVCjyjKaQ0RbAVNZdR2w2haaVh/edIA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= , Nick Desaulniers , Borislav Petkov , "H. Peter Anvin" , Andy Lutomirski , Brijesh Singh , Cao Jin , Ingo Molnar , Joerg Roedel , Masahiro Yamada , Masami Hiramatsu , Thomas Gleixner , Tri Vo , dima@golovin.in, morbo@google.com, x86-ml , Sasha Levin Subject: [PATCH AUTOSEL 4.9 84/87] x86/build: Mark per-CPU symbols as absolute explicitly for LLD Date: Wed, 27 Mar 2019 14:20:37 -0400 Message-Id: <20190327182040.17444-84-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327182040.17444-1-sashal@kernel.org> References: <20190327182040.17444-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael Ávila de Espíndola [ Upstream commit d071ae09a4a1414c1433d5ae9908959a7325b0ad ] Accessing per-CPU variables is done by finding the offset of the variable in the per-CPU block and adding it to the address of the respective CPU's block. Section 3.10.8 of ld.bfd's documentation states: For expressions involving numbers, relative addresses and absolute addresses, ld follows these rules to evaluate terms: Other binary operations, that is, between two relative addresses not in the same section, or between a relative address and an absolute address, first convert any non-absolute term to an absolute address before applying the operator." Note that LLVM's linker does not adhere to the GNU ld's implementation and as such requires implicitly-absolute terms to be explicitly marked as absolute in the linker script. If not, it fails currently with: ld.lld: error: ./arch/x86/kernel/vmlinux.lds:153: at least one side of the expression must be absolute ld.lld: error: ./arch/x86/kernel/vmlinux.lds:154: at least one side of the expression must be absolute Makefile:1040: recipe for target 'vmlinux' failed This is not a functional change for ld.bfd which converts the term to an absolute symbol anyways as specified above. Based on a previous submission by Tri Vo . Reported-by: Dmitry Golovin Signed-off-by: Rafael Ávila de Espíndola [ Update commit message per Boris' and Michael's suggestions. ] Signed-off-by: Nick Desaulniers [ Massage commit message more, fix typos. ] Signed-off-by: Borislav Petkov Tested-by: Dmitry Golovin Cc: "H. Peter Anvin" Cc: Andy Lutomirski Cc: Brijesh Singh Cc: Cao Jin Cc: Ingo Molnar Cc: Joerg Roedel Cc: Masahiro Yamada Cc: Masami Hiramatsu Cc: Thomas Gleixner Cc: Tri Vo Cc: dima@golovin.in Cc: morbo@google.com Cc: x86-ml Link: https://lkml.kernel.org/r/20181219190145.252035-1-ndesaulniers@google.com Signed-off-by: Sasha Levin --- arch/x86/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index e783a5daaab2..55f04875293f 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -367,7 +367,7 @@ SECTIONS * Per-cpu symbols which need to be offset from __per_cpu_load * for the boot processor. */ -#define INIT_PER_CPU(x) init_per_cpu__##x = x + __per_cpu_load +#define INIT_PER_CPU(x) init_per_cpu__##x = ABSOLUTE(x) + __per_cpu_load INIT_PER_CPU(gdt_page); INIT_PER_CPU(irq_stack_union); -- 2.19.1