Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3544385ybb; Mon, 6 Apr 2020 10:44:37 -0700 (PDT) X-Google-Smtp-Source: APiQypI138uhV7jkCDk2TJNLv1ZyeA22F58HlPEGZw8QiACq6JgyBgi3jQrH8+x4+RPMywGO1cGx X-Received: by 2002:a4a:8926:: with SMTP id f35mr227788ooi.97.1586195077717; Mon, 06 Apr 2020 10:44:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586195077; cv=none; d=google.com; s=arc-20160816; b=Kz20xqs2edaG9531jqA+lFHx3ohzgx0oAf88HKS0vqtIdgCnDoMuzpZUQLBs26WnlH fdy/qNL1M9RDm+7V09SPBGbJuZ3JLdQZYJ6hxLBmIbyMNw1ZJbQ4Nkwz4dFDX1U9gwFj NXIo/3KDJoNZtLM9G1j+uX1ppMPPdT1j1vYsYJPz0xxSJ502YxEcXxYisKGwCn/gF1R+ 9ovV7WvOu2SVnciVcO62ISxfSxw4nxR7066K5zXDwa2XOjt5BHNdm3uIiik/qo2tsvU3 cmwCH+oVTFH9IRqZhUUGPnxXrORLqGweFb+LX++Nk3WxOS4WweV0WXrG/HAWSe1/KAyU qa6g== 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=3ryN2+XGnu4KkFlcLTuOzqjZr/0tbM726BTBlHgTY1w=; b=pvC4/cMYVwELnLbgio+oOCI5vf5XxYtopmCRZFzQgq01S4iWxXTeWKdTnGQDZxAAqk 8c9OXLeT+isv8yXzzSMVyzSmdcVpYiJCQXx3V2BwgZCSFML0gWA5g/MEyoD8UIxf8O7c Ih+ZlY/nePXc6R0ZaSw81R2QH/l0x3JFFCHAeSRDNZ2+JlSScGKeVGPUS1l7snFMducX O09MVXXWJ9AE0cFt1y2oAZdb8oVffb3FC45V1lw5ZLvfOlkc4YiQlLqxYbZ5AhDddxEN 4sIpqwOQyDr6u88NpSUFZjW2gOuSiLlCI/wPZlR3D4opWf8Jif6nAp8Isa4t03/+PrbU AwaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bvojjPgq; 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 m81si7786629oig.190.2020.04.06.10.44.24; Mon, 06 Apr 2020 10:44:37 -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=pass header.i=@kernel.org header.s=default header.b=bvojjPgq; 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 S1729711AbgDFQ7u (ORCPT + 99 others); Mon, 6 Apr 2020 12:59:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:44916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728690AbgDFQ7u (ORCPT ); Mon, 6 Apr 2020 12:59:50 -0400 Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (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 8EBD7224F9; Mon, 6 Apr 2020 16:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586192388; bh=BvXBikF5zktNf7QS73awek+bnt1KyWnIJgoxiHrD7qg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=bvojjPgqEM28uYRBkGHErCClmCMsQ2DiE+7Pi978RWpcDGKOVIrwVbaYQnnmWQJZ8 dnDWvM7McPg2QPRxpWyQ5OArkZ93zjd5mH7FNw4uKhTsIrpgRtvQXtPE3T2Gt9Pf9k a3AG6dqPpdZOyilBFQm1l+RGnL+1tLbn0SOHNFlU= Received: by mail-il1-f181.google.com with SMTP id k29so192672ilg.0; Mon, 06 Apr 2020 09:59:48 -0700 (PDT) X-Gm-Message-State: AGi0PuZNSgvfqr249o2Tc+ThHUN4qFnp+zpKMcXCEIGtOoryEAVj+Puy VhmqdhUGwd46mSj9cCnEIwG6WLuSEdHS33Qj7RE= X-Received: by 2002:a92:443:: with SMTP id 64mr253419ile.258.1586192387909; Mon, 06 Apr 2020 09:59:47 -0700 (PDT) MIME-Version: 1.0 References: <20200406035110.GA3241052@rani.riverdale.lan> <20200406084738.GA2520@zn.tnic> <20200406112042.GC2520@zn.tnic> <20200406132215.GA113388@rani.riverdale.lan> <20200406160148.GB113388@rani.riverdale.lan> <20200406165243.GA303819@rani.riverdale.lan> In-Reply-To: <20200406165243.GA303819@rani.riverdale.lan> From: Ard Biesheuvel Date: Mon, 6 Apr 2020 18:59:36 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] x86/boot/compressed/64: Remove .bss/.pgtable from bzImage To: Arvind Sankar Cc: Borislav Petkov , Sergey Shatunov , hpa@zytor.com, Linux Kernel Mailing List , mingo@redhat.com, Thomas Gleixner , x86@kernel.org, linux-efi , initramfs@vger.kernel.org, Donovan Tremura , Harald Hoyer 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, 6 Apr 2020 at 18:52, Arvind Sankar wrote: > > On Mon, Apr 06, 2020 at 06:22:33PM +0200, Ard Biesheuvel wrote: > > > > > We could just pull the stub's bss section all into data with objcopy > > > similar to what ARM64 does [1]? i.e. rename .bss to .bss.efistub and > > > then pull that into .data in the linker script for the compressed > > > kernel? > > > > > > > I don't follow. I'm not aware of arm64 doing anything out of the > > ordinary with .bss? Note that arm64 does not have a separate > > decompressor, so the EFI stub is part of the kernel proper. This is > > why sections are renamed to start with .init > > ARM64 renames the stub sections prefixing them with .init, and that > includes .bss. The ARM64 linker script then puts .init.bss into the > .init.data section. So I was suggesting doing something similar with the > x86 stub, renaming .bss to .bss.efistub, and then putting that into > .data via linker script. > OK, I see what you mean now. IIRC, putting that into .init.data was simply because there was no way to selectively prefix sections, and leave .bss alone. But I guess we can combine all these different histories and rationales into one coherent way of managing the stub's .bss. > Anyway, I'll do the section annotation for now as that will be less > churn and we can revisit this after that. > > > > > > There is also this scary looking comment in gnu-efi's linker script: > > > /* the EFI loader doesn't seem to like a .bss section, so we stick > > > it all into .data: */ > > > I don't know what the history of that is. > > > > > > > I don't remember, to be honest, but I'm pretty sure I copy-pasted that > > from elsewhere at the time. > > > > > [1] As an aside, why doesn't ARM do this as well rather than using the > > > section(.data) annotation? > > > > > > > The ARM decompressor has this hideous hack, where text [and rodata] > > executes straight from flash, and BSS is relocated into DRAM. In order > > for this to work, it actually *requires* GOT indirections for BSS > > items, to ensure that all BSS references use absolute addresses, which > > can be relocated independently from the rest of the kernel image. This > > is the reason ARM does not permit a .data section in the decompressor. > > However, the EFI stub does not support execute in place from flash, > > and so we can permit a .data section there. At the same time, we don't > > support GOT indirections in the EFI stub, so we cannot use the BSS > > section. So instead, we just put the few BSS pieces we have into .data > > instead. > > > > I see, thanks.