mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gary Lin <glin@suse.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	Joey Lee <jlee@suse.com>, Vojtech Pavlik <vojtech@suse.cz>
Subject: Re: [PATCH v2] efi: Config options to assign versions in the PE-COFF header
Date: Thu, 13 Apr 2017 15:47:28 +0800	[thread overview]
Message-ID: <20170413074728.5zglfjw2rxgc6lpj@GaryWorkstation> (raw)
In-Reply-To: <CAKv+Gu8ZS1rdDwLrspv_VnYHOfxkdxUpZe_h1Sw3-N2SBpeJ5g@mail.gmail.com>

On Thu, Apr 13, 2017 at 08:26:04AM +0100, Ard Biesheuvel wrote:
> On 13 April 2017 at 04:58, Gary Lin <glin@suse.com> wrote:
> > This commit adds the new config options to allow the user to modify the
> > following fields in the PE-COFF header.
> >
> > UINT16 MajorOperatingSystemVersion
> > UINT16 MinorOperatingSystemVersion
> > UINT16 MajorImageVersion
> > UINT16 MinorImageVersion
> >
> > Those fields are mainly for the executables or libraries in Windows NT
> > or higher to specify the minimum supported Windows version and the
> > version of the image itself.
> >
> > Given the fact that those fields are ignored in UEFI, we can safely reuse
> > those fields for other purposes, e.g. Security Version(*).
> >
> > (*) https://github.com/lcp/shim/wiki/Security-Version
> >
> > v2 changes:
> > - Modify the header direct instead of using an external script as
> >   suggested by Ard Biesheuvel
> > - Include arm and arm64
> >
> 
> Thanks for the update. Could we put the Kconfig changes in
> drivers/firmware/efi/Kconfig, rather than duplicating them 3 times?

Sure. Will send a v3 to update Kconfig.

Thanks,

Gary Lin

> 
> > Cc: Russell King <linux@armlinux.org.uk>
> > Cc: Matt Fleming <matt@codeblueprint.co.uk>
> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Will Deacon <will.deacon@arm.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: Joey Lee <jlee@suse.com>
> > Cc: Vojtech Pavlik <vojtech@suse.cz>
> > Signed-off-by: Gary Lin <glin@suse.com>
> > ---
> >  arch/arm/Kconfig                      | 24 ++++++++++++++++++++++++
> >  arch/arm/boot/compressed/efi-header.S |  8 ++++----
> >  arch/arm64/Kconfig                    | 24 ++++++++++++++++++++++++
> >  arch/arm64/kernel/head.S              |  8 ++++----
> >  arch/x86/Kconfig                      | 24 ++++++++++++++++++++++++
> >  arch/x86/boot/header.S                |  8 ++++----
> >  6 files changed, 84 insertions(+), 12 deletions(-)
> >
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index 0d4e71b42c77..4965ad2ccc23 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -2090,6 +2090,30 @@ config EFI
> >           is only useful for kernels that may run on systems that have
> >           UEFI firmware.
> >
> > +config EFI_MAJOR_OS
> > +       hex "EFI Major OS Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> > +config EFI_MINOR_OS
> > +       hex "EFI Minor OS Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> > +config EFI_MAJOR_IMAGE
> > +       hex "EFI Major Image Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> > +config EFI_MINOR_IMAGE
> > +       hex "EFI Minor Image Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> >  endmenu
> >
> >  menu "CPU Power Management"
> > diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S
> > index 9d5dc4fda3c1..67715472a76f 100644
> > --- a/arch/arm/boot/compressed/efi-header.S
> > +++ b/arch/arm/boot/compressed/efi-header.S
> > @@ -69,10 +69,10 @@ extra_header_fields:
> >                 .long   0                       @ ImageBase
> >                 .long   0x200                   @ SectionAlignment
> >                 .long   0x200                   @ FileAlignment
> > -               .short  0                       @ MajorOperatingSystemVersion
> > -               .short  0                       @ MinorOperatingSystemVersion
> > -               .short  0                       @ MajorImageVersion
> > -               .short  0                       @ MinorImageVersion
> > +               .short  CONFIG_EFI_MAJOR_OS     @ MajorOperatingSystemVersion
> > +               .short  CONFIG_EFI_MINOR_OS     @ MinorOperatingSystemVersion
> > +               .short  CONFIG_EFI_MAJOR_IMAGE  @ MajorImageVersion
> > +               .short  CONFIG_EFI_MINOR_IMAGE  @ MinorImageVersion
> >                 .short  0                       @ MajorSubsystemVersion
> >                 .short  0                       @ MinorSubsystemVersion
> >                 .long   0                       @ Win32VersionValue
> > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > index 3741859765cf..c782c422e58c 100644
> > --- a/arch/arm64/Kconfig
> > +++ b/arch/arm64/Kconfig
> > @@ -1033,6 +1033,30 @@ config EFI
> >           allow the kernel to be booted as an EFI application. This
> >           is only useful on systems that have UEFI firmware.
> >
> > +config EFI_MAJOR_OS
> > +       hex "EFI Major OS Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> > +config EFI_MINOR_OS
> > +       hex "EFI Minor OS Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> > +config EFI_MAJOR_IMAGE
> > +       hex "EFI Major Image Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> > +config EFI_MINOR_IMAGE
> > +       hex "EFI Minor Image Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> >  config DMI
> >         bool "Enable support for SMBIOS (DMI) tables"
> >         depends on EFI
> > diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
> > index 4fb6ccd886d1..9faa4b04d0ef 100644
> > --- a/arch/arm64/kernel/head.S
> > +++ b/arch/arm64/kernel/head.S
> > @@ -129,10 +129,10 @@ extra_header_fields:
> >         .quad   0                               // ImageBase
> >         .long   0x1000                          // SectionAlignment
> >         .long   PECOFF_FILE_ALIGNMENT           // FileAlignment
> > -       .short  0                               // MajorOperatingSystemVersion
> > -       .short  0                               // MinorOperatingSystemVersion
> > -       .short  0                               // MajorImageVersion
> > -       .short  0                               // MinorImageVersion
> > +       .short  CONFIG_EFI_MAJOR_OS             // MajorOperatingSystemVersion
> > +       .short  CONFIG_EFI_MINOR_OS             // MinorOperatingSystemVersion
> > +       .short  CONFIG_EFI_MAJOR_IMAGE          // MajorImageVersion
> > +       .short  CONFIG_EFI_MINOR_IMAGE          // MinorImageVersion
> >         .short  0                               // MajorSubsystemVersion
> >         .short  0                               // MinorSubsystemVersion
> >         .long   0                               // Win32VersionValue
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index 5bbdef151805..233933fde7dd 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -1803,6 +1803,30 @@ config EFI_STUB
> >
> >           See Documentation/efi-stub.txt for more information.
> >
> > +config EFI_MAJOR_OS
> > +       hex "EFI Major OS Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> > +config EFI_MINOR_OS
> > +       hex "EFI Minor OS Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> > +config EFI_MAJOR_IMAGE
> > +       hex "EFI Major Image Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> > +config EFI_MINOR_IMAGE
> > +       hex "EFI Minor Image Version"
> > +       range 0x0 0xFFFF
> > +       default "0x0"
> > +       depends on EFI_STUB
> > +
> >  config EFI_MIXED
> >         bool "EFI mixed-mode support"
> >         depends on EFI_STUB && X86_64
> > diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
> > index 3dd5be33aaa7..863813007207 100644
> > --- a/arch/x86/boot/header.S
> > +++ b/arch/x86/boot/header.S
> > @@ -156,10 +156,10 @@ extra_header_fields:
> >  #endif
> >         .long   0x20                            # SectionAlignment
> >         .long   0x20                            # FileAlignment
> > -       .word   0                               # MajorOperatingSystemVersion
> > -       .word   0                               # MinorOperatingSystemVersion
> > -       .word   0                               # MajorImageVersion
> > -       .word   0                               # MinorImageVersion
> > +       .word   CONFIG_EFI_MAJOR_OS             # MajorOperatingSystemVersion
> > +       .word   CONFIG_EFI_MINOR_OS             # MinorOperatingSystemVersion
> > +       .word   CONFIG_EFI_MAJOR_IMAGE          # MajorImageVersion
> > +       .word   CONFIG_EFI_MINOR_IMAGE          # MinorImageVersion
> >         .word   0                               # MajorSubsystemVersion
> >         .word   0                               # MinorSubsystemVersion
> >         .long   0                               # Win32VersionValue
> > --
> > 2.12.0
> >
> 

  reply	other threads:[~2017-04-13  7:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13  3:58 Gary Lin
2017-04-13  7:26 ` Ard Biesheuvel
2017-04-13  7:47   ` Gary Lin [this message]
2017-04-17 18:09     ` Roy Franz (HPE)
2017-04-18  4:09       ` Gary Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170413074728.5zglfjw2rxgc6lpj@GaryWorkstation \
    --to=glin@suse.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=hpa@zytor.com \
    --cc=jlee@suse.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vojtech@suse.cz \
    --cc=will.deacon@arm.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®