Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1192798ybl; Fri, 10 Jan 2020 13:51:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyzIq9jeUTb40s2/1ULytdJ1N3dEdpjLvDBn0SHaN48bLjj2BurLETKzfGdjyJCxLs/Tixf X-Received: by 2002:a9d:32c7:: with SMTP id u65mr4484078otb.224.1578693076799; Fri, 10 Jan 2020 13:51:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578693076; cv=none; d=google.com; s=arc-20160816; b=M7oDNWjKyiT47Zzn9mQ8luJhNLwpfVIuZyce00y+qCS1rCXuxeL8U/ISQv6B9yipOh rBePSLEdo3dUDs/HtnEV/UxLaMlIglLx+1uIFU2E9P486SaNGyt3+5gQ/dVoXf+LDfm0 VVKFkTvlMTn0OZDE+w4Yp4n1B8Ne05HmlafWVlIOPfT4OUvK83vhjCcHHh1a/HuOqyCY ai99yIs7NKoeRMDq1sJwWW81gzGTHJtVaQnskCEbPYRQl920LeUf07WswNKvD57iSboG 6M5FF+fEtOjOHY0VatraAwlIyhhh26beHl7EmBRZs1ZWhS08nDw/bdfwAJSCTaFEnsGk WQ9w== 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; bh=yd/lLsT7icDuGqQpjwyX63E0NMrcZyQjQZJbpo+AeNc=; b=wBNP7MVLQexHyCNZSplfE+r/VzMTRUxFu5Oxcr+QHYAbSrmKQxVLeDshy+YSrLKij4 OHgcACRPr0wCIaGBpYV5i6bU+2OjII2ML+qrm3kWp3WYtsAkTguECB/EC53TAktgNy3T dJdPcdozcgdN+AqFegDVSGI0ddBDy9+0Eh9zvn///qYebVQVLR31wga+Bz/1d25rN5sJ X5eir+8ZpatvuH0uCxm8uiY16PtB9VyQ2fmfl7tfF0UOnG1rHwtWUTrP19AL5P7sZGqa RpqnZC4cEqykBmEk+NREGrAqA4BNhVTkGKjPWbVWPQCD6Ze1N1H14orIs8N1E++Uyjsb pB4Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p20si2922725otr.319.2020.01.10.13.51.05; Fri, 10 Jan 2020 13:51:16 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727183AbgAJVuI (ORCPT + 99 others); Fri, 10 Jan 2020 16:50:08 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:33820 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726952AbgAJVuI (ORCPT ); Fri, 10 Jan 2020 16:50:08 -0500 Received: by mail-qk1-f196.google.com with SMTP id j9so3404098qkk.1 for ; Fri, 10 Jan 2020 13:50:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yd/lLsT7icDuGqQpjwyX63E0NMrcZyQjQZJbpo+AeNc=; b=gSZS01dohqmOuBuAVW/pk3gdiw4mUYaA8ioLliu6bn4g/FGYXgIzKwiOflCJ1jf/rb hYXy3XX9smSbJ3c7ZSWLV5WPW6YPJjKawiqfWukeGV8e0Q8sLcISYXG99AaT3gbozOjb nEvYivyQmI+t434RedMinW9NVvlvSxFDxvfLKkNzlwf69P1J/azVQoonlzYYzygJMfuk Mv/EDxPtXHbE4HAuydcYAxAPZV0KSUsyGyzeVJB8PaeOuOofxrvQsv3u6iywDTXGtSj6 /sTQTce5kMCLCQ+hjCciiFPPvjQ5XgSrqeqQZ2xIlSOPtKaM7HIp40AtlQe/EoHcScYO bG1g== X-Gm-Message-State: APjAAAWeZZXo58yNITl5nbewKRbfo1SSNHdY8E+5vvdxWxtJJZy20El4 dVVI9xQL9DQzZ8+VWu+Ct0I= X-Received: by 2002:ae9:e306:: with SMTP id v6mr5372345qkf.162.1578693007471; Fri, 10 Jan 2020 13:50:07 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id s20sm1452428qkg.131.2020.01.10.13.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 13:50:06 -0800 (PST) From: Arvind Sankar To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Kees Cook , Thomas Lendacky Subject: [PATCH v2] x86/tools/relocs: Add _etext and __end_of_kernel_reserve to S_REL Date: Fri, 10 Jan 2020 16:50:05 -0500 Message-Id: <20200110215005.2164353-1-nivedita@alum.mit.edu> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200110205028.GA2012059@rani.riverdale.lan> References: <20200110205028.GA2012059@rani.riverdale.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Prior to binutiles-2.23, ld treats the location counter as absolute if used outside an output section definition. From version 2.23 onwards, the location counter is treated as relative to an adjacent output section (usually the previous one, unless there isn't one or the location counter has been assigned to previously, in which case the next one). The result is that a symbol definition in the linker script, such as _etext = .; that appears outside an output section definition makes _etext an absolute symbol prior to binutils-2.23 and a relative symbol from version 2.23 onwards. So when using a 2.21 or 2.22 vintage linker, the build fails with Invalid absolute R_X86_64_32S relocation: _etext for x86-64, and a similar message with R_386_32 for x86-32. Fix this by adding these symbols to S_REL to tell the relocs tool that these should always be treated as relative symbols needing relocation. Fixes: b907693883fd ("x86/vmlinux: Actually use _etext for the end of the text segment") Fixes: c603a309cc75 ("x86/mm: Identify the end of the kernel area to be reserved") Signed-off-by: Arvind Sankar --- v2: Added a more detailed commit message arch/x86/tools/relocs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c index ce7188cbdae5..0a6146d6414f 100644 --- a/arch/x86/tools/relocs.c +++ b/arch/x86/tools/relocs.c @@ -78,6 +78,8 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = { "__end_rodata_hpage_align|" #endif "__vvar_page|" + "_etext|" + "__end_of_kernel_reserve|" "_end)$" }; -- 2.24.1