Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1082204ybh; Wed, 11 Mar 2020 17:14:01 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuOdzjeEY8Rvcnk6klXzWcF78EZ3Ir0M7SrIyyPWjYHex3pTYcFxe2/qYPdEZM1SDmaYP1i X-Received: by 2002:a05:6830:1d95:: with SMTP id y21mr4139588oti.90.1583972040988; Wed, 11 Mar 2020 17:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583972040; cv=none; d=google.com; s=arc-20160816; b=WeXX8Erh8XxadPsVjkLvK3IlEVPFt7B+oWXKIX6Hswuh0rnLzwAbgjDAeu9t6D1DSB wN5HbuS/UbVtOx9mcqMMuB7iU17meNkRAQjT1XOQqwvFGA2qUudFpzu2Ia8AK7w19HnR VSMJbC62AbXW/du3zYTdq+H20vZ3t+SkbNtgt292e/HnRX+Cdrtay9Zkm0sahAZ+kyzg p8ZmA/EgVVwkWtNguJuDiqootUiIXSyAdOmrcbkPhGrA4lOac7RUP6DH9f73qfWXJGFA 8OWUjpdhoLa1JmdIgfSkXuQGqIB+T/4i4cmf0MrcRgYHkmKcWGaQjyBJ632VJajgE8HF 7/OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=Qc/yKi3r5phF37+WiquQaUgtp6vC7iVWg5HXpKVNHvY=; b=LstGY+nVghmOS7QAlqdDFaXWnNkIdSKgUXdnyPqVfYhUtxnH2LkkdWiwnlNnfcUWdq +X7YwfJ7w1/qluoWs/WbgqYsPm5PMgtmNiH/fsTzjDUZ2EDf0KcsnvVxjkiVRlg8kx0g 2WJ/VnDMJZn52AH708dmifL4GK7hkqHedM5RKNwr8uhVHnii5xQDDa5iK79KjYyWkPCN CCC8GCycNz1q+Z+GLLs+vab8FZEmerDKYTrsbkwZyhINvMuaTQFs9lUQ7bWj3ATIRcSf LFBfgE4zIxwoNuTInZgGVDBUdZE5MIrrvgz8H64xKk5rYnD4WZLfb9AITPB5a59SBFsQ 9VpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=UleuOCyz; 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 t26si771893ooq.37.2020.03.11.17.13.45; Wed, 11 Mar 2020 17:14:00 -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=fail header.i=@gmail.com header.s=20161025 header.b=UleuOCyz; 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 S1731554AbgCLAKM (ORCPT + 99 others); Wed, 11 Mar 2020 20:10:12 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:42985 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731418AbgCLAKL (ORCPT ); Wed, 11 Mar 2020 20:10:11 -0400 Received: by mail-qt1-f194.google.com with SMTP id g16so3019239qtp.9 for ; Wed, 11 Mar 2020 17:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Qc/yKi3r5phF37+WiquQaUgtp6vC7iVWg5HXpKVNHvY=; b=UleuOCyzScWPzaYnbq5Vl4d9u/jYen5HaFT4NjASEaVmKSLebHkxpuzDgqGWwJEPU+ RcBSWcy7xhAmGMJBjx485y/rbmdoBOgZiBDljVp074P/by3anY3lGdAUXV12OPEKofSP ZK49zx85MNrptMRKu4UI3e+q7O+VVLG2Qz+587tu9kKpZRUbGvu/TVoSi+mRX0Aty8Yc U4xu3UvMxHqHpHgDQs90A+2cFmwYM3alc6hccB75Fddps+HgN6Kj1OHO90xl4nX1jDaP RcLk/N5RXF0hEp2nzrSrpMQKj0vXsVfKjWx+4nbv9R7Ts5YpkNEAGDqamLGcFvb0bZTG vNaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Qc/yKi3r5phF37+WiquQaUgtp6vC7iVWg5HXpKVNHvY=; b=V7y2cqiQmPl16w41oGXMhQ4TTAnhoY9pTFN4F7YDhuaATyI/bI/uNCw7xLS7XDxrNm orJ3A1jPbv2T3o8oZ8CFsEUtpJ3DOXivYi6uKYKaoeVgmkLXz5XeggXrgXvvJcZwqqIn 2r3me/DQ8SjeB2/N+lJtn+uzveQBSvdk0lWHrdl1wSzMrfUNb2wvFs+VrOqA4R73wiO9 sRVJDRuWvN8BHAdWeDp4yoj6CoTA+w+Mddfija9kTXF3A6p5WKcu8TAH2tyxdD5zAkrb wWPVFJghkYOhSJn2+wFSonmWJDae8ieqI2yCOB5Ot9GypU4Lchus17oaWGlQEYmXOeCa JViw== X-Gm-Message-State: ANhLgQ0MZqGhqYfa2pPjYCk3epWg/OAcdxcA0rBve5/dYFYBuniIDE9g UdmJswAKj0DLV8YU2duzgqw= X-Received: by 2002:ac8:4659:: with SMTP id f25mr5002889qto.273.1583971810279; Wed, 11 Mar 2020 17:10:10 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id m1sm4683932qtm.22.2020.03.11.17.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 17:10:10 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Wed, 11 Mar 2020 20:10:08 -0400 To: Hans de Goede Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/2] x86/purgatory: Make sure we fail the build if purgatory.ro has missing symbols Message-ID: <20200312001006.GA170175@rani.riverdale.lan> References: <20200311214601.18141-1-hdegoede@redhat.com> <20200311214601.18141-3-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200311214601.18141-3-hdegoede@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 11, 2020 at 10:46:01PM +0100, Hans de Goede wrote: > Since we link purgatory.ro with -r aka we enable "incremental linking" > no checks for unresolved symbols is done while linking purgatory.ro. > Do we actually need to link purgatory with -r? We could use --emit-relocs to get the relocation sections generated the way the main x86 kernel does, no? Eg like the below? This would avoid the double-link creating purgatory.chk. diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index fb4ee5444379..5332f95ca1d3 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -14,8 +14,8 @@ $(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE CFLAGS_sha256.o := -D__DISABLE_EXPORTS -LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib -targets += purgatory.ro +LDFLAGS_purgatory := -e purgatory_start --emit-relocs -nostdlib -z nodefaultlib +targets += purgatory KASAN_SANITIZE := n KCOV_INSTRUMENT := n @@ -55,7 +55,7 @@ CFLAGS_sha256.o += $(PURGATORY_CFLAGS) CFLAGS_REMOVE_string.o += $(PURGATORY_CFLAGS_REMOVE) CFLAGS_string.o += $(PURGATORY_CFLAGS) -$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE +$(obj)/purgatory: $(PURGATORY_OBJS) FORCE $(call if_changed,ld) targets += kexec-purgatory.c @@ -63,7 +63,7 @@ targets += kexec-purgatory.c quiet_cmd_bin2c = BIN2C $@ cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@ -$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE +$(obj)/kexec-purgatory.c: $(obj)/purgatory FORCE $(call if_changed,bin2c) obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o