1. 25 12月, 2019 10 次提交
  2. 14 12月, 2019 1 次提交
  3. 12 11月, 2019 3 次提交
    • D
      x86/boot: Introduce setup_indirect · b3c72fc9
      Daniel Kiper 提交于
      The setup_data is a bit awkward to use for extremely large data objects,
      both because the setup_data header has to be adjacent to the data object
      and because it has a 32-bit length field. However, it is important that
      intermediate stages of the boot process have a way to identify which
      chunks of memory are occupied by kernel data. Thus introduce an uniform
      way to specify such indirect data as setup_indirect struct and
      SETUP_INDIRECT type.
      
      And finally bump setup_header version in arch/x86/boot/header.S.
      Suggested-by: NH. Peter Anvin (Intel) <hpa@zytor.com>
      Signed-off-by: NDaniel Kiper <daniel.kiper@oracle.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NRoss Philipson <ross.philipson@oracle.com>
      Reviewed-by: NH. Peter Anvin (Intel) <hpa@zytor.com>
      Acked-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: ard.biesheuvel@linaro.org
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: dave.hansen@linux.intel.com
      Cc: eric.snowberg@oracle.com
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: kanth.ghatraju@oracle.com
      Cc: linux-doc@vger.kernel.org
      Cc: linux-efi <linux-efi@vger.kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: rdunlap@infradead.org
      Cc: ross.philipson@oracle.com
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20191112134640.16035-4-daniel.kiper@oracle.com
      b3c72fc9
    • D
      x86/boot: Introduce kernel_info.setup_type_max · 00cd1c15
      Daniel Kiper 提交于
      This field contains maximal allowed type for setup_data.
      
      Do not bump setup_header version in arch/x86/boot/header.S because it
      will be followed by additional changes coming into the Linux/x86 boot
      protocol.
      Suggested-by: NH. Peter Anvin (Intel) <hpa@zytor.com>
      Signed-off-by: NDaniel Kiper <daniel.kiper@oracle.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NRoss Philipson <ross.philipson@oracle.com>
      Reviewed-by: NH. Peter Anvin (Intel) <hpa@zytor.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: ard.biesheuvel@linaro.org
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: dave.hansen@linux.intel.com
      Cc: eric.snowberg@oracle.com
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: kanth.ghatraju@oracle.com
      Cc: linux-doc@vger.kernel.org
      Cc: linux-efi <linux-efi@vger.kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: rdunlap@infradead.org
      Cc: ross.philipson@oracle.com
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20191112134640.16035-3-daniel.kiper@oracle.com
      00cd1c15
    • D
      x86/boot: Introduce kernel_info · 2c33c27f
      Daniel Kiper 提交于
      The relationships between the headers are analogous to the various data
      sections:
      
        setup_header = .data
        boot_params/setup_data = .bss
      
      What is missing from the above list? That's right:
      
        kernel_info = .rodata
      
      We have been (ab)using .data for things that could go into .rodata or .bss for
      a long time, for lack of alternatives and -- especially early on -- inertia.
      Also, the BIOS stub is responsible for creating boot_params, so it isn't
      available to a BIOS-based loader (setup_data is, though).
      
      setup_header is permanently limited to 144 bytes due to the reach of the
      2-byte jump field, which doubles as a length field for the structure, combined
      with the size of the "hole" in struct boot_params that a protected-mode loader
      or the BIOS stub has to copy it into. It is currently 119 bytes long, which
      leaves us with 25 very precious bytes. This isn't something that can be fixed
      without revising the boot protocol entirely, breaking backwards compatibility.
      
      boot_params proper is limited to 4096 bytes, but can be arbitrarily extended
      by adding setup_data entries. It cannot be used to communicate properties of
      the kernel image, because it is .bss and has no image-provided content.
      
      kernel_info solves this by providing an extensible place for information about
      the kernel image. It is readonly, because the kernel cannot rely on a
      bootloader copying its contents anywhere, but that is OK; if it becomes
      necessary it can still contain data items that an enabled bootloader would be
      expected to copy into a setup_data chunk.
      
      Do not bump setup_header version in arch/x86/boot/header.S because it
      will be followed by additional changes coming into the Linux/x86 boot
      protocol.
      Suggested-by: NH. Peter Anvin (Intel) <hpa@zytor.com>
      Signed-off-by: NDaniel Kiper <daniel.kiper@oracle.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NRoss Philipson <ross.philipson@oracle.com>
      Reviewed-by: NH. Peter Anvin (Intel) <hpa@zytor.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: ard.biesheuvel@linaro.org
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: dave.hansen@linux.intel.com
      Cc: eric.snowberg@oracle.com
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: kanth.ghatraju@oracle.com
      Cc: linux-doc@vger.kernel.org
      Cc: linux-efi <linux-efi@vger.kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: rdunlap@infradead.org
      Cc: ross.philipson@oracle.com
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20191112134640.16035-2-daniel.kiper@oracle.com
      2c33c27f
  4. 07 11月, 2019 3 次提交
    • D
      x86/efi: Add efi_fake_mem support for EFI_MEMORY_SP · 199c8471
      Dan Williams 提交于
      Given that EFI_MEMORY_SP is platform BIOS policy decision for marking
      memory ranges as "reserved for a specific purpose" there will inevitably
      be scenarios where the BIOS omits the attribute in situations where it
      is desired. Unlike other attributes if the OS wants to reserve this
      memory from the kernel the reservation needs to happen early in init. So
      early, in fact, that it needs to happen before e820__memblock_setup()
      which is a pre-requisite for efi_fake_memmap() that wants to allocate
      memory for the updated table.
      
      Introduce an x86 specific efi_fake_memmap_early() that can search for
      attempts to set EFI_MEMORY_SP via efi_fake_mem and update the e820 table
      accordingly.
      
      The KASLR code that scans the command line looking for user-directed
      memory reservations also needs to be updated to consider
      "efi_fake_mem=nn@ss:0x40000" requests.
      Acked-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NDave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      199c8471
    • D
      x86/efi: EFI soft reservation to E820 enumeration · 262b45ae
      Dan Williams 提交于
      UEFI 2.8 defines an EFI_MEMORY_SP attribute bit to augment the
      interpretation of the EFI Memory Types as "reserved for a specific
      purpose".
      
      The proposed Linux behavior for specific purpose memory is that it is
      reserved for direct-access (device-dax) by default and not available for
      any kernel usage, not even as an OOM fallback.  Later, through udev
      scripts or another init mechanism, these device-dax claimed ranges can
      be reconfigured and hot-added to the available System-RAM with a unique
      node identifier. This device-dax management scheme implements "soft" in
      the "soft reserved" designation by allowing some or all of the
      reservation to be recovered as typical memory. This policy can be
      disabled at compile-time with CONFIG_EFI_SOFT_RESERVE=n, or runtime with
      efi=nosoftreserve.
      
      This patch introduces 2 new concepts at once given the entanglement
      between early boot enumeration relative to memory that can optionally be
      reserved from the kernel page allocator by default. The new concepts
      are:
      
      - E820_TYPE_SOFT_RESERVED: Upon detecting the EFI_MEMORY_SP
        attribute on EFI_CONVENTIONAL memory, update the E820 map with this
        new type. Only perform this classification if the
        CONFIG_EFI_SOFT_RESERVE=y policy is enabled, otherwise treat it as
        typical ram.
      
      - IORES_DESC_SOFT_RESERVED: Add a new I/O resource descriptor for
        a device driver to search iomem resources for application specific
        memory. Teach the iomem code to identify such ranges as "Soft Reserved".
      
      Note that the comment for do_add_efi_memmap() needed refreshing since it
      seemed to imply that the efi map might overflow the e820 table, but that
      is not an issue as of commit 7b6e4ba3 "x86/boot/e820: Clean up the
      E820_X_MAX definition" that removed the 128 entry limit for
      e820__range_add().
      
      A follow-on change integrates parsing of the ACPI HMAT to identify the
      node and sub-range boundaries of EFI_MEMORY_SP designated memory. For
      now, just identify and reserve memory of this type.
      Acked-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Reviewed-by: NDave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      262b45ae
    • D
      x86: efi/random: Invoke EFI_RNG_PROTOCOL to seed the UEFI RNG table · 0d959814
      Dominik Brodowski 提交于
      Invoke the EFI_RNG_PROTOCOL protocol in the context of the x86 EFI stub,
      same as is done on arm/arm64 since commit 568bc4e8 ("efi/arm*/libstub:
      Invoke EFI_RNG_PROTOCOL to seed the UEFI RNG table"). Within the stub,
      a Linux-specific RNG seed UEFI config table will be seeded. The EFI routines
      in the core kernel will pick that up later, yet still early during boot,
      to seed the kernel entropy pool. If CONFIG_RANDOM_TRUST_BOOTLOADER, entropy
      is credited for this seed.
      Signed-off-by: NDominik Brodowski <linux@dominikbrodowski.net>
      Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      0d959814
  5. 31 10月, 2019 1 次提交
    • K
      x86, efi: Never relocate kernel below lowest acceptable address · 220dd769
      Kairui Song 提交于
      Currently, kernel fails to boot on some HyperV VMs when using EFI.
      And it's a potential issue on all x86 platforms.
      
      It's caused by broken kernel relocation on EFI systems, when below three
      conditions are met:
      
      1. Kernel image is not loaded to the default address (LOAD_PHYSICAL_ADDR)
         by the loader.
      2. There isn't enough room to contain the kernel, starting from the
         default load address (eg. something else occupied part the region).
      3. In the memmap provided by EFI firmware, there is a memory region
         starts below LOAD_PHYSICAL_ADDR, and suitable for containing the
         kernel.
      
      EFI stub will perform a kernel relocation when condition 1 is met. But
      due to condition 2, EFI stub can't relocate kernel to the preferred
      address, so it fallback to ask EFI firmware to alloc lowest usable memory
      region, got the low region mentioned in condition 3, and relocated
      kernel there.
      
      It's incorrect to relocate the kernel below LOAD_PHYSICAL_ADDR. This
      is the lowest acceptable kernel relocation address.
      
      The first thing goes wrong is in arch/x86/boot/compressed/head_64.S.
      Kernel decompression will force use LOAD_PHYSICAL_ADDR as the output
      address if kernel is located below it. Then the relocation before
      decompression, which move kernel to the end of the decompression buffer,
      will overwrite other memory region, as there is no enough memory there.
      
      To fix it, just don't let EFI stub relocate the kernel to any address
      lower than lowest acceptable address.
      
      [ ardb: introduce efi_low_alloc_above() to reduce the scope of the change ]
      Signed-off-by: NKairui Song <kasong@redhat.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: https://lkml.kernel.org/r/20191029173755.27149-6-ardb@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      220dd769
  6. 18 10月, 2019 8 次提交
    • Z
      x86/boot/acpi: Move get_cmdline_acpi_rsdp() under #ifdef guard · 228d1200
      Zhenzhong Duan 提交于
      When building with "EXTRA_CFLAGS=-Wall" gcc warns:
      
      arch/x86/boot/compressed/acpi.c:29:30: warning: get_cmdline_acpi_rsdp defined but not used [-Wunused-function]
      
      get_cmdline_acpi_rsdp() is only used when CONFIG_RANDOMIZE_BASE and
      CONFIG_MEMORY_HOTREMOVE are both enabled, so any build where one of these
      config options is disabled has this issue.
      
      Move the function under the same ifdef guard as the call site.
      
      [ tglx: Add context to the changelog so it becomes useful ]
      
      Fixes: 41fa1ee9 ("acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down")
      Signed-off-by: NZhenzhong Duan <zhenzhong.duan@oracle.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/1569719633-32164-1-git-send-email-zhenzhong.duan@oracle.com
      
      228d1200
    • J
      x86/asm/32: Change all ENTRY+ENDPROC to SYM_FUNC_* · 6d685e53
      Jiri Slaby 提交于
      These are all functions which are invoked from elsewhere, so annotate
      them as global using the new SYM_FUNC_START and their ENDPROC's by
      SYM_FUNC_END.
      
      Now, ENTRY/ENDPROC can be forced to be undefined on X86, so do so.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Bill Metzenthen <billm@melbpc.org.au>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-efi <linux-efi@vger.kernel.org>
      Cc: linux-efi@vger.kernel.org
      Cc: linux-pm@vger.kernel.org
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: platform-driver-x86@vger.kernel.org
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-28-jslaby@suse.cz
      6d685e53
    • J
      x86/asm: Change all ENTRY+ENDPROC to SYM_FUNC_* · 6dcc5627
      Jiri Slaby 提交于
      These are all functions which are invoked from elsewhere, so annotate
      them as global using the new SYM_FUNC_START and their ENDPROC's by
      SYM_FUNC_END.
      
      Make sure ENTRY/ENDPROC is not defined on X86_64, given these were the
      last users.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> [hibernate]
      Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> [xen bits]
      Acked-by: Herbert Xu <herbert@gondor.apana.org.au> [crypto]
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Armijn Hemel <armijn@tjaldur.nl>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Enrico Weigelt <info@metux.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jim Mattson <jmattson@google.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: kvm ML <kvm@vger.kernel.org>
      Cc: Len Brown <len.brown@intel.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-efi <linux-efi@vger.kernel.org>
      Cc: linux-efi@vger.kernel.org
      Cc: linux-pm@vger.kernel.org
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: platform-driver-x86@vger.kernel.org
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Sean Christopherson <sean.j.christopherson@intel.com>
      Cc: Stefano Stabellini <sstabellini@kernel.org>
      Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: Wanpeng Li <wanpengli@tencent.com>
      Cc: Wei Huang <wei@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Cc: xen-devel@lists.xenproject.org
      Cc: Xiaoyao Li <xiaoyao.li@linux.intel.com>
      Link: https://lkml.kernel.org/r/20191011115108.12392-25-jslaby@suse.cz
      6dcc5627
    • J
      x86/asm/64: Add ENDs to some functions and relabel with SYM_CODE_* · 4aec216b
      Jiri Slaby 提交于
      All these are functions which are invoked from elsewhere but they are
      not typical C functions. So annotate them using the new SYM_CODE_START.
      All these were not balanced with any END, so mark their ends by
      SYM_CODE_END appropriately too.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> [xen bits]
      Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> [power mgmt]
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-pm@vger.kernel.org
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Pingfan Liu <kernelfans@gmail.com>
      Cc: platform-driver-x86@vger.kernel.org
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Stefano Stabellini <sstabellini@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wei Huang <wei@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Cc: xen-devel@lists.xenproject.org
      Cc: Xiaoyao Li <xiaoyao.li@linux.intel.com>
      Link: https://lkml.kernel.org/r/20191011115108.12392-23-jslaby@suse.cz
      4aec216b
    • J
      x86/asm: Make some functions local · ef1e0315
      Jiri Slaby 提交于
      There are a couple of assembly functions which are invoked only locally
      in the file they are defined. In C, they are marked "static". In
      assembly, annotate them using SYM_{FUNC,CODE}_START_LOCAL (and switch
      their ENDPROC to SYM_{FUNC,CODE}_END too). Whether FUNC or CODE is used,
      depends on whether ENDPROC or END was used for a particular function
      before.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-efi <linux-efi@vger.kernel.org>
      Cc: linux-efi@vger.kernel.org
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: platform-driver-x86@vger.kernel.org
      Cc: Stefano Stabellini <sstabellini@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20191011115108.12392-21-jslaby@suse.cz
      ef1e0315
    • J
      x86/asm: Do not annotate functions with GLOBAL · 37818afd
      Jiri Slaby 提交于
      GLOBAL is an x86's custom macro and is going to die very soon. It was
      meant for global symbols, but here, it was used for functions. Instead,
      use the new macros SYM_FUNC_START* and SYM_CODE_START* (depending on the
      type of the function) which are dedicated to global functions. And since
      they both require a closing by SYM_*_END, do that here too.
      
      startup_64, which does not use GLOBAL but uses .globl explicitly, is
      converted too.
      
      "No alignments" are preserved.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: Enrico Weigelt <info@metux.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: linux-arch@vger.kernel.org
      Cc: Maran Wilson <maran.wilson@oracle.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-17-jslaby@suse.cz
      37818afd
    • J
      x86/boot: Annotate data appropriately · b8c3f9b5
      Jiri Slaby 提交于
      Use the new SYM_DATA, SYM_DATA_START, and SYM_DATA_END* macros for data,
      so that the data in the object file look sane:
      
        Value   Size Type    Bind   Vis      Ndx Name
          0000    10 OBJECT  GLOBAL DEFAULT    3 efi32_boot_gdt
          000a    10 OBJECT  LOCAL  DEFAULT    3 save_gdt
          0014     8 OBJECT  LOCAL  DEFAULT    3 func_rt_ptr
          001c    48 OBJECT  GLOBAL DEFAULT    3 efi_gdt64
          004c     0 OBJECT  LOCAL  DEFAULT    3 efi_gdt64_end
      
          0000    48 OBJECT  LOCAL  DEFAULT    3 gdt
          0030     0 OBJECT  LOCAL  DEFAULT    3 gdt_end
          0030     8 OBJECT  LOCAL  DEFAULT    3 efi_config
          0038    49 OBJECT  GLOBAL DEFAULT    3 efi32_config
          0069    49 OBJECT  GLOBAL DEFAULT    3 efi64_config
      
      All have correct size and type now.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: Enrico Weigelt <info@metux.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wei Huang <wei@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Cc: Xiaoyao Li <xiaoyao.li@linux.intel.com>
      Link: https://lkml.kernel.org/r/20191011115108.12392-13-jslaby@suse.cz
      b8c3f9b5
    • J
      x86/boot: Annotate local functions · deff8a24
      Jiri Slaby 提交于
      .Lrelocated, .Lpaging_enabled, .Lno_longmode, and .Lin_pm32 are
      self-standing local functions, annotate them as such and preserve "no
      alignment".
      
      The annotations do not generate anything yet.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wei Huang <wei@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Cc: Xiaoyao Li <xiaoyao.li@linux.intel.com>
      Link: https://lkml.kernel.org/r/20191011115108.12392-8-jslaby@suse.cz
      deff8a24
  7. 12 10月, 2019 1 次提交
  8. 11 10月, 2019 1 次提交
    • J
      x86/asm: Make more symbols local · 30a2441c
      Jiri Slaby 提交于
      During the assembly cleanup patchset review, I found more symbols which
      are used only locally. So make them really local by prepending ".L" to
      them. Namely:
      
       - wakeup_idt is used only in realmode/rm/wakeup_asm.S.
       - in_pm32 is used only in boot/pmjump.S.
       - retint_user is used only in entry/entry_64.S, perhaps since commit
         2ec67971 ("x86/entry/64/compat: Remove most of the fast system
         call machinery"), where entry_64_compat's caller was removed.
      
      Drop GLOBAL from all of them too. I do not see more candidates in the
      series.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NBorislav Petkov <bp@suse.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: bp@alien8.de
      Cc: hpa@zytor.com
      Link: https://lkml.kernel.org/r/20191011092213.31470-1-jslaby@suse.czSigned-off-by: NIngo Molnar <mingo@kernel.org>
      30a2441c
  9. 01 10月, 2019 1 次提交
    • B
      arch/x86/boot: Use prefix map to avoid embedded paths · 9e2276fa
      Bruce Ashfield 提交于
      It was observed that the kernel embeds the absolute build path in the
      x86 boot image when the __FILE__ macro is expanded.
      
      > From https://bugzilla.yoctoproject.org/show_bug.cgi?id=13458:
      
        If you turn on the buildpaths QA test, or try a reproducible build, you
        discover that the kernel image contains build paths.
      
        $ strings bzImage-5.0.19-yocto-standard |grep tmp/
        out of pgt_buf in
        /data/poky-tmp/reproducible/tmp/work-shared/qemux86-64/kernel-source/arch/x86/boot/compressed/kaslr_64.c!?
      
        But what's this in the top-level Makefile:
      
        $ git grep prefix-map
        Makefile:KBUILD_CFLAGS  += $(call
        cc-option,-fmacro-prefix-map=$(srctree)/=)
      
        So the __FILE__ shouldn't be using the full path.  However
        arch/x86/boot/compressed/Makefile has this:
      
        KBUILD_CFLAGS := -m$(BITS) -O2
      
        So that clears KBUILD_FLAGS, removing the -fmacro-prefix-map option.
      
      Use -fmacro-prefix-map to have relative paths in the boot image too.
      
       [ bp: Massage commit message and put the KBUILD_CFLAGS addition in
         ..boot/Makefile after the KBUILD_AFLAGS assignment because gas
         doesn't support -fmacro-prefix-map. ]
      Signed-off-by: NBruce Ashfield <bruce.ashfield@gmail.com>
      Signed-off-by: NRoss Burton <ross.burton@intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: George Rimar <grimar@accesssoftek.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Nathan Chancellor <natechancellor@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20190926093226.8568-1-ross.burton@intel.com
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=204333
      9e2276fa
  10. 06 9月, 2019 1 次提交
    • J
      x86/asm: Make some functions local labels · 98ededb6
      Jiri Slaby 提交于
      Boris suggests to make a local label (prepend ".L") to these functions
      to eliminate them from the symbol table. These are functions with very
      local names and really should not be visible anywhere.
      
      Note that objtool won't see these functions anymore (to generate ORC
      debug info). But all the functions are not annotated with ENDPROC, so
      they won't have objtool's attention anyway.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steve Winslow <swinslow@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wei Huang <wei@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Cc: Xiaoyao Li <xiaoyao.li@linux.intel.com>
      Link: https://lkml.kernel.org/r/20190906075550.23435-2-jslaby@suse.cz
      98ededb6
  11. 27 8月, 2019 1 次提交
  12. 20 8月, 2019 1 次提交
    • J
      acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down · 41fa1ee9
      Josh Boyer 提交于
      This option allows userspace to pass the RSDP address to the kernel, which
      makes it possible for a user to modify the workings of hardware. Reject
      the option when the kernel is locked down. This requires some reworking
      of the existing RSDP command line logic, since the early boot code also
      makes use of a command-line passed RSDP when locating the SRAT table
      before the lockdown code has been initialised. This is achieved by
      separating the command line RSDP path in the early boot code from the
      generic RSDP path, and then copying the command line RSDP into boot
      params in the kernel proper if lockdown is not enabled. If lockdown is
      enabled and an RSDP is provided on the command line, this will only be
      used when parsing SRAT (which shouldn't permit kernel code execution)
      and will be ignored in the rest of the kernel.
      
      (Modified by Matthew Garrett in order to handle the early boot RSDP
      environment)
      Signed-off-by: NJosh Boyer <jwboyer@redhat.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      cc: Dave Young <dyoung@redhat.com>
      cc: linux-acpi@vger.kernel.org
      Signed-off-by: NJames Morris <jmorris@namei.org>
      41fa1ee9
  13. 19 8月, 2019 1 次提交
  14. 16 8月, 2019 1 次提交
    • R
      x86/boot: Use common BUILD_BUG_ON · d5a1badd
      Rikard Falkeborn 提交于
      Defining BUILD_BUG_ON causes redefinition warnings when adding includes of
      include/linux/build_bug.h in files unrelated to x86/boot.  For example,
      adding an include of build_bug.h to include/linux/bits.h shows the
      following warnings:
      
        CC      arch/x86/boot/cpucheck.o
        In file included from ./include/linux/bits.h:22,
                         from ./arch/x86/include/asm/msr-index.h:5,
                         from arch/x86/boot/cpucheck.c:28:
        ./include/linux/build_bug.h:49: warning: "BUILD_BUG_ON" redefined
           49 | #define BUILD_BUG_ON(condition) \
              |
        In file included from arch/x86/boot/cpucheck.c:22:
        arch/x86/boot/boot.h:31: note: this is the location of the previous definition
           31 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
              |
      
      The macro was added to boot.h in commit 62bd0337 ("Top header file for
      new x86 setup code"). At that time, BUILD_BUG_ON was defined in
      kernel.h. Presumably BUILD_BUG_ON was redefined to avoid pulling in
      kernel.h. Since then, BUILD_BUG_ON and similar macros have been split to a
      separate header file.
      Signed-off-by: NRikard Falkeborn <rikard.falkeborn@gmail.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Link: https://lkml.kernel.org/r/20190811184938.1796-2-rikard.falkeborn@gmail.com
      
      d5a1badd
  15. 08 8月, 2019 1 次提交
  16. 19 7月, 2019 3 次提交
  17. 28 6月, 2019 1 次提交
    • B
      x86/boot: Add xloadflags bits to check for 5-level paging support · f2d08c5d
      Baoquan He 提交于
      The current kernel supports 5-level paging mode, and supports dynamically
      choosing the paging mode during bootup depending on the kernel image,
      hardware and kernel parameter settings. This flexibility brings several
      issues to kexec/kdump:
      
      1) Dynamic switching between paging modes requires support in the target
         kernel. This means kexec from a 5-level paging kernel into a kernel
         which does not support mode switching is not possible. So the loader
         needs to be able to analyze the supported paging modes of the kexec
         target kernel.
      
      2) If running on a 5-level paging kernel and the kexec target kernel is a
         4-level paging kernel, the target immage cannot be loaded above the 64TB
         address space limit. But the kexec loader searches for a load area from
         top to bottom which would eventually put the target kernel above 64TB
         when the machine has large enough RAM size. So the loader needs to be
         able to analyze the paging mode of the target kernel to load it at a
         suitable spot in the address space.
      
      Solution:
      
      Add two bits XLF_5LEVEL and XLF_5LEVEL_ENABLED:
      
       - Bit XLF_5LEVEL indicates whether 5-level paging mode switching support
         is available. (Issue #1)
      
       - Bit XLF_5LEVEL_ENABLED indicates whether the kernel was compiled with
         full 5-level paging support (CONFIG_X86_5LEVEL=y). (Issue #2)
      
      The loader will use these bits to verify whether the target kernel is
      suitable to be kexec'ed to from a 5-level paging kernel and to determine
      the constraints of the target kernel load address.
      
      The flags will be used by the kernel kexec subsystem and the userspace
      kexec tools.
      
      [ tglx: Massaged changelog ]
      Signed-off-by: NBaoquan He <bhe@redhat.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: bp@alien8.de
      Cc: hpa@zytor.com
      Cc: dyoung@redhat.com
      Link: https://lkml.kernel.org/r/20190524073810.24298-2-bhe@redhat.com
      f2d08c5d
  18. 27 6月, 2019 1 次提交