Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp833725ybb; Fri, 10 Apr 2020 11:02:48 -0700 (PDT) X-Google-Smtp-Source: APiQypKtffuua+F+hqUDq/8DJlpYjYMwF0NS3zFIAGJF7fVc+8bi18URvHZYvlqO6KmouMWkhFAS X-Received: by 2002:ac8:138c:: with SMTP id h12mr387699qtj.210.1586541768154; Fri, 10 Apr 2020 11:02:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586541768; cv=none; d=google.com; s=arc-20160816; b=QCrzemGLiQZmzgGIJ5REtZNVnU2qDiKx5V3cxFpRwEc3orL6xk0bG3UAD0n2KN8ySC KmIbpsNjRsC5K+laGZjyTMfcSllhvfZo7V6/ZCBhypuwePxB3tZARhDx6Xj7kgXe+UCo YNkgM2+MNRHUKbeaMrmzk752jsz22V1n3l2Ejg2DtZsBhELfPFzBDEBE5/YD+lFF+g1c twXxCkPgFl3mmwdJuBrld1RM904SemIWnQ/Op0odo2sr76POilF++P2kugSblp9NK0ep kH3J4R7bMNDN8L+218tEcKkr5SI1R/op4pUKK21T0ppfG3a8qEYXvOUStTtK8wfktJay fDVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=mQm+cfpWWNubJH8IeV0+wdXKUR9XPtCh19rQwA2lnYY=; b=aVo8bdhllk+7cKXoDobm0DlsulvHr6jz4S1kbJerPSEZi59VwhIFgIxMq+Mu9SnoIg yrakoAfruMi/b+5K+LK+zuR6dzdyCsChbQjYfIXuXGhbY5r1rAXRIT6rM3p6ayecOTcr hxBA/MMlNTej4rjmVK107zvbpQ4pZ7mK+ly/kY4d9K9CZo10ON0l3Ej35v3PCFd2gRMg 96N2+N3QCT/AoU1wetiKlPgW44ykRuJLjIRR20oe7g9RQJo5jxh8lyhtfm6jCVrxyOu4 EiXHZOdiGOQHvvecfv28fwyOqtK/QDj1DBQfFqI70s9nokA401sWegNULahkJHdVQAIj T9FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=CaveKvpO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x45si1582003qtx.344.2020.04.10.11.02.28; Fri, 10 Apr 2020 11:02:48 -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=fail header.i=@gmail.com header.s=20161025 header.b=CaveKvpO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726659AbgDJSB1 (ORCPT + 99 others); Fri, 10 Apr 2020 14:01:27 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:42347 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbgDJSB1 (ORCPT ); Fri, 10 Apr 2020 14:01:27 -0400 Received: by mail-qt1-f196.google.com with SMTP id b10so2061175qtt.9; Fri, 10 Apr 2020 11:01:26 -0700 (PDT) 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; bh=mQm+cfpWWNubJH8IeV0+wdXKUR9XPtCh19rQwA2lnYY=; b=CaveKvpOLQXG9VhSr0uDNp6G9Afwvp6Ys1zEJo7nBfUkRj+OVK4oMLcdM7OW8gV3yw InN4odf+FfCkSJstJGjCaH3Oy5aqir5boQPlBZfptZvJxNoy2RjM8gIn/jnEPV5OL3Er 8yP4RDZ50n39q3l1QhAXtGfranzbVBNsBKX3FMSgZdCHWwv7P6L7xjQoPlW4GeOTDRDB +iiZkk9EJBfC82r+1wt8+f/D6mivq4igWA53XV6VJguSmSFdHr3skL2Do4El8fvHXvy9 JQuSzY+P++qi0LQHkX8tJHr6J+jiWWngWMtnYq370tGQHiLJ8/TZXxcf1m6JkF5MOLuX J15g== 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; bh=mQm+cfpWWNubJH8IeV0+wdXKUR9XPtCh19rQwA2lnYY=; b=SulLoZUtDm941b4FXb4OiXsaYYbGeo0WSZsjwjCHf6UxohYEF27EiJJGMr3JT+OSEg hwOLuRHOho9+7rM+16wCfR4E+jETSkyOauInxeOTp6gNhE78Zf92NFyT04KLNuSWuo4r p8wqfsGHPcg7Y2DwH12lpmaWhsFcgWJlO2hiPMcSOf3HtALb3AbBUqXrIrycL3Q6CEsQ z2PSfkZghpbN8200jBHFej+az54m6tQSgeuO3sGttJuKcgYVDE/L4hc8yHgERvjDiVod o7u4jhgZ3aB1UpielWSP1EvIRQlxLH2rjP7Ml9KQZ9Qrgr11VP4ahp4OTWXkP/+4yQjz FIUQ== X-Gm-Message-State: AGi0PuZeOMXJvfvPALP9LlJvOZHsO4ul1V5WJNbRkc3R+06xCBDtl0kY fkt7LC673YCui1Yl5LmCSA0= X-Received: by 2002:ac8:4e01:: with SMTP id c1mr400253qtw.170.1586541686346; Fri, 10 Apr 2020 11:01:26 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id g2sm2034804qtj.96.2020.04.10.11.01.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 11:01:25 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Fri, 10 Apr 2020 14:01:23 -0400 To: Ard Biesheuvel Cc: Arvind Sankar , Brian Gerst , linux-efi , Ingo Molnar , Thomas Gleixner , Linux Kernel Mailing List , Arnd Bergmann , Borislav Petkov , Colin Ian King , Gary Lin , Jiri Slaby , Sergey Shatunov , Takashi Iwai Subject: Re: [PATCH 3/9] efi/x86: Move efi stub globals from .bss to .data Message-ID: <20200410180123.GA1155098@rani.riverdale.lan> References: <20200409130434.6736-1-ardb@kernel.org> <20200409130434.6736-4-ardb@kernel.org> <20200409210847.GA1312580@rani.riverdale.lan> <20200410151612.GA970420@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 10, 2020 at 06:03:38PM +0200, Ard Biesheuvel wrote: > On Fri, 10 Apr 2020 at 17:16, Arvind Sankar wrote: > > > > On Fri, Apr 10, 2020 at 10:20:42AM +0200, Ard Biesheuvel wrote: > > > On Thu, 9 Apr 2020 at 23:08, Arvind Sankar wrote: > > > > > > > > On Thu, Apr 09, 2020 at 04:53:07PM -0400, Brian Gerst wrote: > > > > > > Can we use the -fno-zero-initialized-in-bss compiler flag instead of > > > > > > explicitly marking global variables? > > > > > > > > > > Scratch that. Apparently it only works when a variable is explicitly > > > > > initialized to zero. > > > > > > > > > > -- > > > > > Brian Gerst > > > > > > > > Right, there doesn't seem to be a compiler option to turn off the use of > > > > .bss altogether. > > > > > > Yeah. I'll try to come up with a way to consolidate this a bit across > > > architectures (which is a bit easier now that all of the EFI stub C > > > code lives in the same place). It is probably easiest to use a section > > > renaming trick similar to the one I added for ARM (as Arvind suggested > > > as well, IIRC), and get rid of the per-symbol annotations altogether. > > > > Does that work for 32-bit ARM, or does it need to be .data to tell the > > compiler to avoid generating GOT references? If that's fine, we don't > > actually need to rename sections -- linker script magic is enough. For > > eg, the below pulls the EFI stub bss into .data for x86 without the need > > for the annotations. > > > > diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S > > index 508cfa6828c5..e324819c95bc 100644 > > --- a/arch/x86/boot/compressed/vmlinux.lds.S > > +++ b/arch/x86/boot/compressed/vmlinux.lds.S > > @@ -52,6 +52,7 @@ SECTIONS > > _data = . ; > > *(.data) > > *(.data.*) > > + drivers/firmware/efi/libstub/lib.a:(.bss .bss.*) > > _edata = . ; > > } > > . = ALIGN(L1_CACHE_BYTES); > > No, we can add this to ARM as well, and get rid of the > __efistub_global annotations entirely. Cool. > > We'll still need .data.efistub for the .data pieces, but that is a > separate issue. You can avoid that by using an archive specification like above. i.e. adding drivers/firmware/efi/libstub/lib.a:(.data .data.*) to the .init.data output section will pull in just the .data input sections from the EFI stub into the .init.data section.