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=-5.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 91451C33C8C for ; Tue, 7 Jan 2020 14:14:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B633208C4 for ; Tue, 7 Jan 2020 14:14:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oVoXT8i+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727806AbgAGOOB (ORCPT ); Tue, 7 Jan 2020 09:14:01 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35970 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727658AbgAGOOB (ORCPT ); Tue, 7 Jan 2020 09:14:01 -0500 Received: by mail-wr1-f66.google.com with SMTP id z3so54124186wru.3 for ; Tue, 07 Jan 2020 06:13:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x8VlU2NEbg3UY0tduTeudov8UnqBVPGWfCHW9YzhxsU=; b=oVoXT8i+59hpPmg2hhx3V7aLUhwPYxrgMMAAuY7ZJVZkuDO+EDEe/lhEHPORb7osOS X/CQdRwDql78SRg/i+822i7sAHk36eD9sfFF7w5C34uZMFK+KmDR+Uh54w92Fb+sZ7PJ 8/tXlsVFuNmEWpMkkbTsnostKjrwthfhlYdilK1QaFfCu9xBAwQacIJrZFSMsRMpfE5v JXkAAh1QyFWwPjNtwmyniArM/BH5e16n7WOy/5BBf/eDk3wezIdwddnifcZ+7p097fO2 Rgw3UbM0YBzrTxdF3QF8UioF4y/MwetwqIiUCDbnsPhttLjN6uLhqV7Lbq17eokr8X8N sPSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x8VlU2NEbg3UY0tduTeudov8UnqBVPGWfCHW9YzhxsU=; b=JCYZOnbtd1y6+Emt+0/59tPMvlZvl7UbgDXuoUWXXPsPWIhl9c3KeuWEThqlweg+T6 4fMCG0Z2YNODEj+6d7YlRLqUCTBPVvcSuewYO0vmExJcKlBX1z6R2rul8NttWtV839u+ iiAexFYyR4pS15GX+6P4m3rnFvx4mK1kgdl13D9tQtvRjiVbAqGB7HkuW9vvHE6H4VGi FpcV1wFHdAAi1iOLPqjTAmimTytpYJE+RcfLKJ8byIZH+A36Pu+9S+aaIqmvpVSAV4ZE QOdmm+9sCk76dS/yZzCi7AmUQdRQb8U613O7/05kfqYCIcdSyNfzayi7+QOO3qel+Kdl x+4Q== X-Gm-Message-State: APjAAAVSgBEH54mV/ROdOSrdB2atCSc9nwL+znPHkweB75Nv2h4MgYC8 bhbZ90Ifu3UVY5mDgTCD12OmKFahg5eOTlQRasyfrKpcKTLWrg== X-Google-Smtp-Source: APXvYqwtAxDOCIZWNRekZ010aVDEOegJYCydUFiFNEz+DeskLa2VE/vCi5j1QxxS3lHgIp7VXciebwdjosNOK+5ynGU= X-Received: by 2002:adf:cf0a:: with SMTP id o10mr97113107wrj.325.1578406437849; Tue, 07 Jan 2020 06:13:57 -0800 (PST) MIME-Version: 1.0 References: <20200107135500.644618-1-nivedita@alum.mit.edu> In-Reply-To: From: Ard Biesheuvel Date: Tue, 7 Jan 2020 15:13:46 +0100 Message-ID: Subject: Re: [PATCH 0/3] Relocate GOT before calling EFI stub To: Arvind Sankar Cc: Ard Biesheuvel , linux-efi Content-Type: text/plain; charset="UTF-8" Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On Tue, 7 Jan 2020 at 15:01, Ard Biesheuvel wrote: > > On Tue, 7 Jan 2020 at 14:55, Arvind Sankar wrote: > > > > This series performs GOT relocation before calling into C code for the > > EFI stub. While the stub does not currently require GOT relocation, it's > > quite easy to introduce code that will use the GOT on old toolchains, > > but not recent ones, which can lead to unexpected issues. > > > > This is based on > > https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git/log/?h=next > > > > with commit 4169bb99cd70 ("efi/libstub/x86: use mandatory 16-byte stack > > alignment in mixed mode") reverted, as it caused a crash in mixed mode. > > > > Hi Arvind, > > I appreciate the effort, but I really don't think this is a good idea. > > A GOT is completely pointless in bare metal code, and fortunately, > modern toolchains make it easier to suppress GOT entries from being > emitted. So instead of adding back asm code that I just removed, I > think it would be better to investigate whether we can get rid of the > GOT entirely. > With the following added to arch/x86/boot/compressed/vmlinux.lds.S, the 64-bit kernel already links without error. ASSERT (_got == _egot, "GOT entries detected"); The 32-bit kernel produces a GOT with 3 entries: I'm trying to narrow down where they come from. > > > > > Arvind Sankar (3): > > x86/boot/compressed/64: Make adjust_got easier to use repeatedly > > x86/boot/compressed/32: Allow adjust_got to be called repeatedly > > x86/boot: Perform GOT relocation before calling EFI stub > > > > arch/x86/boot/compressed/eboot.c | 4 +- > > arch/x86/boot/compressed/head_32.S | 65 +++++++++++++++++++++---- > > arch/x86/boot/compressed/head_64.S | 76 +++++++++++++++++------------- > > 3 files changed, 99 insertions(+), 46 deletions(-) > > > > -- > > 2.24.1 > >