All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] efi: Constify all the things
@ 2017-01-02 10:24 Lukas Wunner
       [not found] ` <cover.1483318593.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
  0 siblings, 1 reply; 22+ messages in thread
From: Lukas Wunner @ 2017-01-02 10:24 UTC (permalink / raw)
  To: Matt Fleming, Ard Biesheuvel, linux-efi-u79uwXL29TY76Z2rM5mHXA
  Cc: Tony Luck, Fenghua Yu, Boris Ostrovsky, David Vrabel,
	Juergen Gross, Anton Vorontsov, Colin Cross, Kees Cook,
	Artur Paszkiewicz, Mike Marciniszyn, Dennis Dalessandro,
	Huang Ying, Rasmus Villemoes

When disassembling the EFI stub I noticed that GUIDs and efi_char16_t
strings are not placed in rodata but generated on the stack at runtime.
GUIDs occupy up to 80 bytes of text instead of just 16 bytes rodata
which annoyed me enough to go down the rabbit hole of fixing it.
This series constifies all GUIDs and EFI-related strings I could find.

The most important patch is [10/10] to constify the EFI_GUID() macro.
This has to be at the end of the series to avoid compiler warnings.
Reviewers may want to read its commit message first as it contains
background information.  In particular it explains why this series
only fixes the kernel side of things.  Additional work is necessary
on the compiler side to actually have all the GUIDs and strings in
rodata.  At the moment both gcc and clang achieve that only partially.

Ard Biesheuvel expressed an interest in these patches in November but
stressed the importance that arguments to EFI boot/runtime/protocol
services may only be declared const if the spec marks them "IN":
https://lkml.org/lkml/2016/11/21/459

Hence I've split the series by boot/runtime/protocol services to allow
for easy verification of this fact.  Constification of GetVariable() /
SetVariable() is further split in one patch for the function signatures
and another for the actual arguments because changing the function
signatures is quite involved in this case.

efi.git/next needs to be rebased on v4.10-rc1 before this series can be
applied because it requires commits f6697df36bdf ("x86/efi: Prevent mixed
mode boot corruption with CONFIG_VMAP_STACK=y") and 2fbadc3002c5
("arm/arm64: xen: Move shared architecture headers to include/xen/arm").

Unfortunately I was not able to compile-test on ia64, there's no cross-
compiler package available on Debian. :-(  I did not receive complaints
from 0-day, so I'm cautiously optimistic that I didn't cause breakage
there.

I've pushed the patches to GitHub to ease reviewing/fetching:
https://github.com/l1k/linux/commits/efi_const_v1

Thanks,

Lukas


Ard Biesheuvel (1):
  efi: use typed function pointers for runtime services table

Lukas Wunner (9):
  efi: Constify GetVariable() / SetVariable() signatures
  efi: Constify GetVariable() / SetVariable() arguments
  efi: Constify HandleProtocol() / LocateHandle() / LocateProtocol()
  efi: Constify InstallConfigurationTable()
  efi: Constify EFI_FILE_PROTOCOL.GetInfo()
  efi: Constify EFI_RNG_PROTOCOL.GetRNG()
  efi: Constify EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString()
  efi: Constify efi_guidcmp() arguments
  uuid: Constify UUID compound literals

 arch/ia64/kernel/efi.c                         | 24 ++++------
 arch/x86/boot/compressed/eboot.c               | 50 ++++++++++-----------
 arch/x86/include/asm/xen/interface.h           |  1 +
 arch/x86/platform/efi/efi_64.c                 | 18 ++++----
 arch/x86/platform/efi/quirks.c                 |  2 +-
 drivers/firmware/efi/efi-pstore.c              | 10 ++---
 drivers/firmware/efi/efibc.c                   |  3 +-
 drivers/firmware/efi/libstub/arm-stub.c        | 17 +++----
 drivers/firmware/efi/libstub/arm32-stub.c      |  2 +-
 drivers/firmware/efi/libstub/efi-stub-helper.c |  7 ++-
 drivers/firmware/efi/libstub/efistub.h         |  2 +-
 drivers/firmware/efi/libstub/fdt.c             |  3 +-
 drivers/firmware/efi/libstub/gop.c             | 12 +++--
 drivers/firmware/efi/libstub/random.c          | 16 +++----
 drivers/firmware/efi/runtime-wrappers.c        | 15 ++++---
 drivers/firmware/google/gsmi.c                 | 10 ++---
 drivers/infiniband/hw/hfi1/efivar.c            |  6 +--
 drivers/scsi/isci/probe_roms.c                 |  2 +-
 drivers/xen/efi.c                              | 12 ++---
 include/linux/efi.h                            | 61 ++++++++++++++------------
 include/uapi/linux/uuid.h                      |  4 +-
 include/xen/arm/interface.h                    |  1 +
 include/xen/interface/platform.h               | 11 ++++-
 include/xen/xen-ops.h                          | 12 ++---
 24 files changed, 143 insertions(+), 158 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-01-06 20:13 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-02 10:24 [PATCH 00/10] efi: Constify all the things Lukas Wunner
     [not found] ` <cover.1483318593.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-01-02 10:24   ` [PATCH 01/10] efi: use typed function pointers for runtime services table Lukas Wunner
2017-01-02 10:24   ` [PATCH 02/10] efi: Constify GetVariable() / SetVariable() signatures Lukas Wunner
     [not found]     ` <bd030e11cd114fb1d568b21eddfc1fa75cd42e5e.1483318593.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-01-03  5:17       ` Juergen Gross
2017-01-02 10:24   ` [PATCH 05/10] efi: Constify InstallConfigurationTable() Lukas Wunner
2017-01-02 10:24   ` [PATCH 07/10] efi: Constify EFI_RNG_PROTOCOL.GetRNG() Lukas Wunner
2017-01-02 10:24   ` [PATCH 03/10] efi: Constify GetVariable() / SetVariable() arguments Lukas Wunner
     [not found]     ` <2be92e87ff7855bcd88c86a7436f46d3488483f0.1483318593.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-01-03 18:25       ` Dennis Dalessandro
2017-01-04 17:38       ` Ard Biesheuvel
     [not found]         ` <CAKv+Gu8UnAzQGsmyWYsWsOY3B+J9HXechwBX_Vk-rntBtO+Dug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-06 10:16           ` Lukas Wunner
     [not found]             ` <20170106101652.GB21850-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-01-06 16:28               ` Ard Biesheuvel
     [not found]                 ` <CAKv+Gu-izRwdrUu7zZLSnf_mjCwFFZ0AsyF5iMR49+UXkmpsgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-06 20:13                   ` Kees Cook
2017-01-02 10:24   ` [PATCH 08/10] efi: Constify EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString() Lukas Wunner
2017-01-02 10:24   ` [PATCH 09/10] efi: Constify efi_guidcmp() arguments Lukas Wunner
2017-01-02 10:24   ` [PATCH 06/10] efi: Constify EFI_FILE_PROTOCOL.GetInfo() Lukas Wunner
2017-01-02 10:24   ` [PATCH 10/10] uuid: Constify UUID compound literals Lukas Wunner
     [not found]     ` <c61bbe4733f78c830f6073e86f32159751bbda8c.1483318593.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-01-04 17:54       ` Ard Biesheuvel
     [not found]         ` <CAKv+Gu8GqCrjOM6nTTHQckyUzrv+BO-B=st35yOptPfjA7Hitg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-06  9:57           ` Lukas Wunner
     [not found]             ` <20170106095711.GA21850-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-01-06 16:26               ` Ard Biesheuvel
2017-01-02 10:24   ` [PATCH 04/10] efi: Constify HandleProtocol() / LocateHandle() / LocateProtocol() Lukas Wunner
2017-01-03 21:19   ` [PATCH 00/10] efi: Constify all the things Kees Cook
2017-01-04 17:26   ` Ard Biesheuvel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.