Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4233342ybf; Tue, 3 Mar 2020 23:30:57 -0800 (PST) X-Google-Smtp-Source: ADFU+vvE88bJgoVAOM2PEaiuoSUwGMox4F0a3zZgRxX+JwsVaB20ev1W1CAB4RSv17iz9qpX4yUZ X-Received: by 2002:a9d:12a8:: with SMTP id g37mr1390929otg.160.1583307057227; Tue, 03 Mar 2020 23:30:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583307057; cv=none; d=google.com; s=arc-20160816; b=cX4+ojBv6FV61svfMv18//AuCVo4eRJFRHh1yH4q6tfcK2951/JBEpir6EqCLiNAB2 XJLUlNRecSZ1yS1rdgYlWZAbm9Fh+qFmb17uHKuzsAt2qiCMFiL/VKggHEREnaOmhfYJ 0PWMTCeJAZP/Z+XF1s4u0z7yN9CRin1xn2snOaTc2SN+EGFWv891pcj/qKaN3hEHMy8C s5T/4yZOcoJXuX5qWlRVHpc4spZF7QnmTj29KLor9qoC1vFFPRb873Ro8CIS8Jl7S9Jn zM7omDvIcvCENqrd7+B+h0c1DzsyCAs0VWVrYvNDlpD1PoYqGksOANhJlKuFXeZS7m2I JbHQ== 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=yXbKC32hYikH+Y6iOqAYkto1iApXG/+ZDVtzPLhDxcM=; b=fWmKM+zFf8FPUfnQOfse1jgks8iqUyZ92zoKUNZqwl8vhZFhOHcAaMMtx/EuaJnh4k jHnHWYLHie+Lk8GqIL1BmnP8bnA/WT91cxJslaBe2TChE0S9GTyl3jCR6vP03A2yerlj niXoVkvDYFQKWV0vAzOJ6dOtxFIWYC53QLZWRNS127UzJDIpX2nB7ttf7cM8rSjERHed MMMygzjQt7KBFmPdOldr7RhZ/D6+Is2HZxyMNcxiiS4RkKae9/rRtVejibIrPoBoXpMK 2gVM+34ek/8M0UQTU4OXoI10NNPuDu55u8U+GBjKGI4tXUYSgt7A0USrr1clSydQHXGR MSCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tqbC00iy; 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 l26si648890oti.152.2020.03.03.23.30.45; Tue, 03 Mar 2020 23:30:57 -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=tqbC00iy; 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 S1728530AbgCDHae (ORCPT + 99 others); Wed, 4 Mar 2020 02:30:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:39380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728370AbgCDHae (ORCPT ); Wed, 4 Mar 2020 02:30:34 -0500 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 B12A52166E for ; Wed, 4 Mar 2020 07:30:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583307034; bh=yXbKC32hYikH+Y6iOqAYkto1iApXG/+ZDVtzPLhDxcM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tqbC00iy+DNya5rs/jGwyyYVkti7AdUBoSwr3dgm54D8yR8q3c25dBsoQYBz2ykmL iUueu0FAG7GhyeZBk4I2+kTNVeJgdCqSTfuwTC7pskoyQHdUkx5xyrFc4y4rH/X9T1 7aY0DwgoyPlPeJiPRlmO9tvn2arFgE6UpIqv++j8= Received: by mail-wm1-f53.google.com with SMTP id 6so717306wmi.5 for ; Tue, 03 Mar 2020 23:30:33 -0800 (PST) X-Gm-Message-State: ANhLgQ2VWnggHtQklbIfDp79C2c/CkIyoSxTmQQx7VFNPwZ/wfpkusKC YSFyougrwOz9rn88qsokCxw+X42WGTWb0vPL6Kubkw== X-Received: by 2002:a05:600c:24b:: with SMTP id 11mr2129718wmj.1.1583307031690; Tue, 03 Mar 2020 23:30:31 -0800 (PST) MIME-Version: 1.0 References: <20200301230537.2247550-1-nivedita@alum.mit.edu> <20200303221205.4048668-1-nivedita@alum.mit.edu> <20200303221205.4048668-6-nivedita@alum.mit.edu> <20200303233457.GA154112@rani.riverdale.lan> In-Reply-To: <20200303233457.GA154112@rani.riverdale.lan> From: Ard Biesheuvel Date: Wed, 4 Mar 2020 08:30:20 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 5/5] efi/x86: Don't relocate the kernel unless necessary 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 Wed, 4 Mar 2020 at 00:35, Arvind Sankar wrote: > > On Wed, Mar 04, 2020 at 12:08:33AM +0100, Ard Biesheuvel wrote: > > On Tue, 3 Mar 2020 at 23:12, Arvind Sankar wrote: > > > > > > Add alignment slack to the PE image size, so that we can realign the > > > decompression buffer within the space allocated for the image. > > > > > > Only relocate the kernel if it has been loaded at an unsuitable address: > > > * Below LOAD_PHYSICAL_ADDR, or > > > * Above 64T for 64-bit and 512MiB for 32-bit > > > > > > For 32-bit, the upper limit is conservative, but the exact limit can be > > > difficult to calculate. > > > > > > > Could we get rid of the call to efi_low_alloc_above() in > > efi_relocate_kernel(), and just allocate top down with the right > > alignment? I'd like to get rid of efi_low_alloc() et al if we can. > > > > But we don't have a top-down allocator, do we? ALLOCATE_MAX_ADDRESS > guarantees the maximum, but it doesn't guarantee that you'll be as high > as possible. Good point. We do have a top-down allocator in practice, but it is not guaranteed by the API.