Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3828906ybf; Tue, 3 Mar 2020 13:41:47 -0800 (PST) X-Google-Smtp-Source: ADFU+vuZUT1OSFEF/I5Sm2lVvzfElNq3PJDdnKGDjZfbnmqOGTJKrAFRep4rnYQ8j/Fv76jMyT8L X-Received: by 2002:aca:c341:: with SMTP id t62mr405317oif.41.1583271707676; Tue, 03 Mar 2020 13:41:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583271707; cv=none; d=google.com; s=arc-20160816; b=UZ0egXWiK8I6DvpFMAcAJSnibq/1WreEdtou/aZpcbdX5x5unBk4UoS+GhFaiXDI6S DwWje1bXhce/HqrtvYFb5Zk3lviJH4YWc0NLzmTu69pDYR9OAOP7KqIA+8lYXc8qo+MU E4CO+ZlfwmzLFiJJ+vDyB97yAJORGQrv0mkMbJjrWAmbJa9/Rl8E64qatrEy8vJdFCFl emlu35Ci6fy98qHDEP/CW/gmXaXY9ZqOONJxvq7rKEnyrygBnNeKwuF4PO9v+cPddMZI Iv/0mx+JYNjOYxDptyuRMAf07ANmmFIiXOx9qzOSwXmdTw6C1+2IvT2OcKtlnN+nT3DU KZHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=h1X4JasQEiBlzDGPF+0ZjoVn2OuxmstuK3zKMi+Eff4=; b=IvB3y0/rQ9LOQz/qXgQOoOruMuXvh9882JF9KoKmjLhtPFiZzotwnnFpLw7EQCbkFa xAEnZPsywBvRk5jZUlbu3cbcwYsAkShxBtnoN9x4qLdIArJ0k9fL+2zWbBIpo3ubKHps ET15Pf7XjcE6BwgT5WwrIFcJeqsFE8l7uIRcCN5XUiLOCVf7KSkezVV2OUX6Tbi5KsW2 LcqESpt7bEt7yBqn0LVYB5l7PdHNrmffVpKTHcwDP6aa4oQ1MHNqhifnHk9SAZ5jEsAy 4K/qteuBIPITd4lZ7uNF4HB0EglI5GZ96ntgtFOzFe40uOwM3IHLbRtJ7GSVzEMbBKUI qmmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zFNEdwSv; 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 g23si4579240otr.31.2020.03.03.13.41.35; Tue, 03 Mar 2020 13:41:47 -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; dkim=pass header.i=@kernel.org header.s=default header.b=zFNEdwSv; 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 S1730595AbgCCTLr (ORCPT + 99 others); Tue, 3 Mar 2020 14:11:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:47204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728467AbgCCTLr (ORCPT ); Tue, 3 Mar 2020 14:11:47 -0500 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 95B192073B for ; Tue, 3 Mar 2020 19:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583262706; bh=Gm97G7ePTvTA/2qImrmMfXs4ah+ywyggwz9iheWgI34=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=zFNEdwSvQ65AQQj+EjXhFKyKnE4i/lJyYwLSS+ADHBpVaPtUkoLFAiyvHSC1cKiJh EYfrrxQmOXeBXtbvN9MopG2vxijGaxFQ4mmfFvLPzqxTudAwxoAj2HOPArIUTQ/Xaf L5pahdot351ChS+RD22FpHcjnYJhEpnrtZ3tQ/J0= Received: by mail-wr1-f50.google.com with SMTP id h9so4883271wrr.10 for ; Tue, 03 Mar 2020 11:11:46 -0800 (PST) X-Gm-Message-State: ANhLgQ04LOVmxut6iK24eKQS24t3dVSMpuSQSOhau2Djxq7RkyoMhCaW qRxlOQahbcb16buHjx+JsRgGmCAeuQvkkzTYycj0Og== X-Received: by 2002:adf:a411:: with SMTP id d17mr6691415wra.126.1583262705029; Tue, 03 Mar 2020 11:11:45 -0800 (PST) MIME-Version: 1.0 References: <20200301230537.2247550-1-nivedita@alum.mit.edu> <20200301230537.2247550-4-nivedita@alum.mit.edu> In-Reply-To: <20200301230537.2247550-4-nivedita@alum.mit.edu> From: Ard Biesheuvel Date: Tue, 3 Mar 2020 20:11:34 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/5] efi/x86: Add kernel preferred address to PE header To: Arvind Sankar Cc: linux-efi , "the arch/x86 maintainers" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2 Mar 2020 at 00:05, Arvind Sankar wrote: > > Store the kernel's link address as ImageBase in the PE header. Note that > the PE specification requires the ImageBase to be 64k aligned. The > preferred address should almost always satisfy that, except for 32-bit > kernel if the configuration has been customized. > > Signed-off-by: Arvind Sankar > --- > arch/x86/boot/header.S | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S > index 4ee25e28996f..0d8d2cb28fd9 100644 > --- a/arch/x86/boot/header.S > +++ b/arch/x86/boot/header.S > @@ -138,10 +138,12 @@ optional_header: > #endif > > extra_header_fields: > + # PE specification requires ImageBase to be 64k-aligned > + .set ImageBase, (LOAD_PHYSICAL_ADDR+0xffff) & ~0xffff Could you call this image_base please, and put some spaces around the + > #ifdef CONFIG_X86_32 > - .long 0 # ImageBase > + .long ImageBase # ImageBase > #else > - .quad 0 # ImageBase > + .quad ImageBase # ImageBase > #endif > .long 0x20 # SectionAlignment > .long 0x20 # FileAlignment > -- > 2.24.1 >