From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D1CDC3F2C6 for ; Tue, 3 Mar 2020 23:35:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A26D20716 for ; Tue, 3 Mar 2020 23:35:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KshmkRwn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728346AbgCCXfB (ORCPT ); Tue, 3 Mar 2020 18:35:01 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:36519 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728327AbgCCXfB (ORCPT ); Tue, 3 Mar 2020 18:35:01 -0500 Received: by mail-qk1-f195.google.com with SMTP id u25so757197qkk.3; Tue, 03 Mar 2020 15:35:00 -0800 (PST) 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=mv8DBr/4IZAnH6uZUX2k2VHUQoNtWWcAjMVSdauA5Qw=; b=KshmkRwngcwfRq2RmS2yFVvllh7z2ekdPd9uwWhU/5MHzOnyNnHM9vG6r45o9fNOeZ niFoV6ESGVeOhRtxnDX8qBD2mCRlhfmyKiiunZ+iLFW77uBg6yAawO8wAz+SXATFniak ESrroSBXfFhJ954OiRiYGncFRJr4Gf8H5PaoSs103N6zn+ubhlIQeNZ3DdaB1kVxdqMg ZRoQSneUfjqOgC/+Q3giHLwMFXefh4n8i/fklN/eF3U+XiYkxmqYRfilijOzYts1N9jt WSGXHEEW6IyIFNu2+4JwvbHAgW4N1Oj9/1hRoU/ylr+sxy2FMEbrvcqsQWJAsA/s09/r iCDw== 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=mv8DBr/4IZAnH6uZUX2k2VHUQoNtWWcAjMVSdauA5Qw=; b=EyaIR0GSSRWLooki8cB7cN2OyCFGMsjODYPJ2zICgiA+1obwEwFsd9y6G9NDhZTL2O 0N7q6O5AGQ/D1cGX6Y96KT4JUA32H2QM0INAfwJt3NqajP0sOu0bw93ZVu8tGkG1tgnf 0FntEg0XTHaScPW5ZfYXpAoowm5x1l4nFLkxAg16FVRJvWYpcEOyHloVXTjmDnYICbl5 R++SWQPO7G69abSDnavJfPkVeFVKeScY/+7v41lZhE0BcnvAUKwTz5H6IcsluPvWMsA0 qOu9zGZnnHdr4gzu180x2O4AYbHg5fA6GS5/7hcW49QO0hoTvVg2hibHy37kjPhsJxF5 PRtg== X-Gm-Message-State: ANhLgQ3KFpfbCug+q0aYQ4x7Y6LLKYknkT/gvFWbksVBbnf/WzueXm22 8BDdxgwzylTQLVYRjzM49M5ofNvBlg0= X-Google-Smtp-Source: ADFU+vtZBBbwMF3sMJrjPdpFShiTNBAjg4Ok9/h9xJ6x/5l2XJPzFxYac5IU2kQGXl5/Z7WBGhWGow== X-Received: by 2002:a37:270a:: with SMTP id n10mr489200qkn.244.1583278500230; Tue, 03 Mar 2020 15:35:00 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id d5sm13268330qke.105.2020.03.03.15.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Mar 2020 15:34:59 -0800 (PST) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Tue, 3 Mar 2020 18:34:58 -0500 To: Ard Biesheuvel Cc: Arvind Sankar , linux-efi , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: [PATCH v2 5/5] efi/x86: Don't relocate the kernel unless necessary Message-ID: <20200303233457.GA154112@rani.riverdale.lan> References: <20200301230537.2247550-1-nivedita@alum.mit.edu> <20200303221205.4048668-1-nivedita@alum.mit.edu> <20200303221205.4048668-6-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org 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.