1. 17 7月, 2018 1 次提交
    • A
      efi/esrt: Only call efi_mem_reserve() for boot services memory · 61f0d555
      Ard Biesheuvel 提交于
      The following commit:
      
        7e1550b8 ("efi: Drop type and attribute checks in efi_mem_desc_lookup()")
      
      refactored the implementation of efi_mem_desc_lookup() so that the type
      check is moved to the callers, one of which is the x86 version of
      efi_arch_mem_reserve(), where we added a modified check that only takes
      EFI_BOOT_SERVICES_DATA regions into account.
      
      This is reasonable, since it is the only memory type that requires this,
      but doing so uncovered some unexpected behavior in the ESRT code, which
      permits the ESRT table to reside in other types of memory than what the
      UEFI spec mandates (i.e., EFI_BOOT_SERVICES_DATA), and unconditionally
      calls efi_mem_reserve() on the region in question. This may result in
      errors such as
      
        esrt: Reserving ESRT space from 0x000000009c810318 to 0x000000009c810350.
        efi: Failed to lookup EFI memory descriptor for 0x000000009c810318
      
      when the ESRT table is not in EFI_BOOT_SERVICES_DATA memory, but we try
      to reserve it nonetheless.
      
      So make the call to efi_mem_reserve() conditional on the memory type.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      61f0d555
  2. 16 7月, 2018 4 次提交
    • A
      efi: Drop type and attribute checks in efi_mem_desc_lookup() · 7e1550b8
      Ard Biesheuvel 提交于
      The current implementation of efi_mem_desc_lookup() includes the
      following check on the memory descriptor it returns:
      
          if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
              md->type != EFI_BOOT_SERVICES_DATA &&
              md->type != EFI_RUNTIME_SERVICES_DATA) {
                  continue;
          }
      
      This means that only EfiBootServicesData or EfiRuntimeServicesData
      regions are considered, or any other region type provided that it
      has the EFI_MEMORY_RUNTIME attribute set.
      
      Given what the name of the function implies, and the fact that any
      physical address can be described in the UEFI memory map only a single
      time, it does not make sense to impose this condition in the body of the
      loop, but instead, should be imposed by the caller depending on the value
      that is returned to it.
      
      Two such callers exist at the moment:
      
      - The BGRT code when running on x86, via efi_mem_reserve() and
        efi_arch_mem_reserve(). In this case, the region is already known to
        be EfiBootServicesData, and so the check is redundant.
      
      - The ESRT handling code which introduced this function, which calls it
        both directly from efi_esrt_init() and again via efi_mem_reserve() and
        efi_arch_mem_reserve() [on x86].
      
      So let's move this check into the callers instead. This preserves the
      current behavior both for BGRT and ESRT handling, and allows the lookup
      routine to be reused by other [upcoming] users that don't have this
      limitation.
      
      In the ESRT case, keep the entire condition, so that platforms that
      deviate from the UEFI spec and use something other than
      EfiBootServicesData for the ESRT table will keep working as before.
      
      For x86's efi_arch_mem_reserve() implementation, limit the type to
      EfiBootServicesData, since it is the only type the reservation code
      expects to operate on in the first place.
      
      While we're at it, drop the __init annotation so that drivers can use it
      as well.
      Tested-by: NLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20180711094040.12506-8-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      7e1550b8
    • A
      efi/libstub/arm: Add opt-in Kconfig option for the DTB loader · 3d7ee348
      Ard Biesheuvel 提交于
      There are various ways a platform can provide a device tree binary
      to the kernel, with different levels of sophistication:
      
      - ideally, the UEFI firmware, which is tightly coupled with the
        platform, provides a device tree image directly as a UEFI
        configuration table, and typically permits the contents to be
        manipulated either via menu options or via UEFI environment
        variables that specify a replacement image,
      
      - GRUB for ARM has a 'devicetree' directive which allows a device
        tree image to be loaded from any location accessible to GRUB, and
        supersede the one provided by the firmware,
      
      - the EFI stub implements a dtb= command line option that allows a
        device tree image to be loaded from a file residing in the same
        file system as the one the kernel image was loaded from.
      
      The dtb= command line option was never intended to be more than a
      development feature, to allow the other options to be implemented
      in parallel. So let's make it an opt-in feature that is disabled
      by default, but can be re-enabled at will.
      
      Note that we already disable the dtb= command line option when we
      detect that we are running with UEFI Secure Boot enabled.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NAlexander Graf <agraf@suse.de>
      Acked-by: NLeif Lindholm <leif.lindholm@linaro.org>
      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: http://lkml.kernel.org/r/20180711094040.12506-7-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      3d7ee348
    • A
      efi/cper: Avoid using get_seconds() · 7bb49709
      Arnd Bergmann 提交于
      get_seconds() is deprecated because of the 32-bit time overflow
      in y2038/y2106 on 32-bit architectures. The way it is used in
      cper_next_record_id() causes an overflow in 2106 when unsigned UTC
      seconds overflow, even on 64-bit architectures.
      
      This starts using ktime_get_real_seconds() to give us more than 32 bits
      of timestamp on all architectures, and then changes the algorithm to use
      39 bits for the timestamp after the y2038 wrap date, plus an always-1
      bit at the top. This gives us another 127 epochs of 136 years, with
      strictly monotonically increasing sequence numbers across boots.
      
      This is almost certainly overkill, but seems better than just extending
      the deadline from 2038 to 2106.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      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: http://lkml.kernel.org/r/20180711094040.12506-5-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      7bb49709
    • S
      efi: Use a work queue to invoke EFI Runtime Services · 3eb420e7
      Sai Praneeth 提交于
      Presently, when a user process requests the kernel to execute any
      UEFI runtime service, the kernel temporarily switches to a separate
      set of page tables that describe the virtual mapping of the UEFI
      runtime services regions in memory. Since UEFI runtime services are
      typically invoked with interrupts enabled, any code that may be called
      during this time, will have an incorrect view of the process's address
      space. Although it is unusual for code running in interrupt context to
      make assumptions about the process context it runs in, there are cases
      (such as the perf subsystem taking samples) where this causes problems.
      
      So let's set up a work queue for calling UEFI runtime services, so that
      the actual calls are made when the work queue items are dispatched by a
      work queue worker running in a separate kernel thread. Such threads are
      not expected to have userland mappings in the first place, and so the
      additional mappings created for the UEFI runtime services can never
      clash with any.
      
      The ResetSystem() runtime service is not covered by the work queue
      handling, since it is not expected to return, and may be called at a
      time when the kernel is torn down to the point where we cannot expect
      work queues to still be operational.
      
      The non-blocking variants of SetVariable() and QueryVariableInfo()
      are also excluded: these are intended to be used from atomic context,
      which obviously rules out waiting for a completion to be signalled by
      another thread. Note that these variants are currently only used for
      UEFI runtime services calls that occur very early in the boot, and
      for ones that occur in critical conditions, e.g., to flush kernel logs
      to UEFI variables via efi-pstore.
      Suggested-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      [ardb: exclude ResetSystem() from the workqueue treatment
             merge from 2 separate patches and rewrite commit log]
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      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: http://lkml.kernel.org/r/20180711094040.12506-4-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      3eb420e7
  3. 22 6月, 2018 1 次提交
  4. 15 6月, 2018 1 次提交
  5. 13 6月, 2018 1 次提交
    • K
      treewide: kzalloc() -> kcalloc() · 6396bb22
      Kees Cook 提交于
      The kzalloc() function has a 2-factor argument form, kcalloc(). This
      patch replaces cases of:
      
              kzalloc(a * b, gfp)
      
      with:
              kcalloc(a * b, gfp)
      
      as well as handling cases of:
      
              kzalloc(a * b * c, gfp)
      
      with:
      
              kzalloc(array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              kzalloc_array(array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              kzalloc(4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      type TYPE;
      expression THING, E;
      @@
      
      (
        kzalloc(
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        kzalloc(
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        kzalloc(
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      identifier SIZE, COUNT;
      @@
      
      - kzalloc
      + kcalloc
        (
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        kzalloc(
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        kzalloc(
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kzalloc(
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        kzalloc(
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        kzalloc(C1 * C2 * C3, ...)
      |
        kzalloc(
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        kzalloc(sizeof(THING) * C2, ...)
      |
        kzalloc(sizeof(TYPE) * C2, ...)
      |
        kzalloc(C1 * C2 * C3, ...)
      |
        kzalloc(C1 * C2, ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      6396bb22
  6. 06 6月, 2018 1 次提交
  7. 19 5月, 2018 1 次提交
  8. 17 5月, 2018 1 次提交
    • A
      device property: Get rid of union aliasing · 63dcc709
      Andy Shevchenko 提交于
      Commit 318a1971 (device property: refactor built-in properties
      support) went way too far and brought a union aliasing. Partially
      revert it here to get rid of union aliasing.
      
      Note, all Apple properties are considered as u8 arrays. To get a value
      of any of them the caller must use device_property_read_u8_array().
      
      What's union aliasing?
      ~~~~~~~~~~~~~~~~~~~~~~
      
      The C99 standard in section 6.2.5 paragraph 20 defines union type as
      "an overlapping nonempty set of member objects". It also states in
      section 6.7.2.1 paragraph 14 that "the value of at most one of the
      members can be stored in a union object at any time'.
      
      Union aliasing is a type punning mechanism using union members to store
      as one type and read back as another.
      
      Why it's not good?
      ~~~~~~~~~~~~~~~~~~
      
      Section 6.2.6.1 paragraph 6 says that a union object may not be a trap
      representation, although its member objects may be.
      
      Meanwhile annex J.1 says that "the value of a union member other than
      the last one stored into" is unspecified [removed in C11].
      
      In TC3, a footnote is added which specifies that accessing a member of a
      union other than the last one stored causes "the object representation"
      to be re-interpreted in the new type and specifically refers to this as
      "type punning". This conflicts to some degree with Annex J.1.
      
      While it's working in Linux with GCC, the use of union members to do
      type punning is not clear area in the C standard and might lead to
      unspecified behaviour.
      
      More information is available in this [1] blog post.
      
      [1]: https://davmac.wordpress.com/2010/02/26/c99-revisited/Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      63dcc709
  9. 14 5月, 2018 11 次提交
  10. 13 3月, 2018 1 次提交
  11. 12 3月, 2018 3 次提交
  12. 09 3月, 2018 5 次提交
    • A
      efi/apple-properties: Use memremap() instead of ioremap() · 44612d7e
      Andy Shevchenko 提交于
      The memory we are accessing through virtual address has no IO side
      effects. Moreover, for IO memory we have to use special accessors,
      which we don't use.
      
      Due to above, convert the driver to use memremap() instead of ioremap().
      Tested-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20180308080020.22828-12-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      44612d7e
    • A
      efi: Reorder pr_notice() with add_device_randomness() call · 5b4e4c3a
      Ard Biesheuvel 提交于
      Currently, when we receive a random seed from the EFI stub, we call
      add_device_randomness() to incorporate it into the entropy pool, and
      issue a pr_notice() saying we are about to do that, e.g.,
      
        [    0.000000] efi:  RNG=0x87ff92cf18
        [    0.000000] random: fast init done
        [    0.000000] efi: seeding entropy pool
      
      Let's reorder those calls to make the output look less confusing:
      
        [    0.000000] efi: seeding entropy pool
        [    0.000000] efi:  RNG=0x87ff92cf18
        [    0.000000] random: fast init done
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20180308080020.22828-11-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      5b4e4c3a
    • A
      efi/arm*: Stop printing addresses of virtual mappings · 1832e641
      Ard Biesheuvel 提交于
      With the recent %p -> %px changes, we now get something like this in
      the kernel boot log on ARM/arm64 EFI systems:
      
           Remapping and enabling EFI services.
             EFI remap 0x00000087fb830000 =>         (ptrval)
             EFI remap 0x00000087fbdb0000 =>         (ptrval)
             EFI remap 0x00000087fffc0000 =>         (ptrval)
      
      The physical addresses of the UEFI runtime regions will also be
      printed when booting with the efi=debug command line option, and the
      virtual addresses can be inspected via /sys/kernel/debug/efi_page_tables
      (if enabled).
      
      So let's just remove the lines above.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NLeif Lindholm <leif.lindholm@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20180308080020.22828-4-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      1832e641
    • A
      efi/apple-properties: Remove redundant attribute initialization from unmarshal_key_value_pairs() · 6e98503d
      Andy Shevchenko 提交于
      There is no need to artificially supply a property length and fake data
      if property has type of boolean.
      
      Remove redundant piece of data and code.
      Reviewed-and-tested-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20180308080020.22828-3-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      6e98503d
    • M
      efi/arm*: Only register page tables when they exist · 6b31a2fa
      Mark Rutland 提交于
      Currently the arm/arm64 runtime code registers the runtime servies
      pagetables with ptdump regardless of whether runtime services page
      tables have been created.
      
      As efi_mm.pgd is NULL in these cases, attempting to dump the efi page
      tables results in a NULL pointer dereference in the ptdump code:
      
      /sys/kernel/debug# cat efi_page_tables
      [  479.522600] Unable to handle kernel NULL pointer dereference at virtual address 00000000
      [  479.522715] Mem abort info:
      [  479.522764]   ESR = 0x96000006
      [  479.522850]   Exception class = DABT (current EL), IL = 32 bits
      [  479.522899]   SET = 0, FnV = 0
      [  479.522937]   EA = 0, S1PTW = 0
      [  479.528200] Data abort info:
      [  479.528230]   ISV = 0, ISS = 0x00000006
      [  479.528317]   CM = 0, WnR = 0
      [  479.528317] user pgtable: 4k pages, 48-bit VAs, pgd = 0000000064ab0cb0
      [  479.528449] [0000000000000000] *pgd=00000000fbbe4003, *pud=00000000fb66e003, *pmd=0000000000000000
      [  479.528600] Internal error: Oops: 96000006 [#1] PREEMPT SMP
      [  479.528664] Modules linked in:
      [  479.528699] CPU: 0 PID: 2457 Comm: cat Not tainted 4.15.0-rc3-00065-g2ad2ee7ecb5c-dirty #7
      [  479.528799] Hardware name: FVP Base (DT)
      [  479.528899] pstate: 00400009 (nzcv daif +PAN -UAO)
      [  479.528941] pc : walk_pgd.isra.1+0x20/0x1d0
      [  479.529011] lr : ptdump_walk_pgd+0x30/0x50
      [  479.529105] sp : ffff00000bf4bc20
      [  479.529185] x29: ffff00000bf4bc20 x28: 0000ffff9d22e000
      [  479.529271] x27: 0000000000020000 x26: ffff80007b4c63c0
      [  479.529358] x25: 00000000014000c0 x24: ffff80007c098900
      [  479.529445] x23: ffff00000bf4beb8 x22: 0000000000000000
      [  479.529532] x21: ffff00000bf4bd70 x20: 0000000000000001
      [  479.529618] x19: ffff00000bf4bcb0 x18: 0000000000000000
      [  479.529760] x17: 000000000041a1c8 x16: ffff0000082139d8
      [  479.529800] x15: 0000ffff9d3c6030 x14: 0000ffff9d2527f4
      [  479.529924] x13: 00000000000003f3 x12: 0000000000000038
      [  479.530000] x11: 0000000000000003 x10: 0101010101010101
      [  479.530099] x9 : 0000000017e94050 x8 : 000000000000003f
      [  479.530226] x7 : 0000000000000000 x6 : 0000000000000000
      [  479.530313] x5 : 0000000000000001 x4 : 0000000000000000
      [  479.530416] x3 : ffff000009069fd8 x2 : 0000000000000000
      [  479.530500] x1 : 0000000000000000 x0 : 0000000000000000
      [  479.530599] Process cat (pid: 2457, stack limit = 0x000000005d1b0e6f)
      [  479.530660] Call trace:
      [  479.530746]  walk_pgd.isra.1+0x20/0x1d0
      [  479.530833]  ptdump_walk_pgd+0x30/0x50
      [  479.530907]  ptdump_show+0x10/0x20
      [  479.530920]  seq_read+0xc8/0x470
      [  479.531023]  full_proxy_read+0x60/0x90
      [  479.531100]  __vfs_read+0x18/0x100
      [  479.531180]  vfs_read+0x88/0x160
      [  479.531267]  SyS_read+0x48/0xb0
      [  479.531299]  el0_svc_naked+0x20/0x24
      [  479.531400] Code: 91400420 f90033a0 a90707a2 f9403fa0 (f9400000)
      [  479.531499] ---[ end trace bfe8e28d8acb2b67 ]---
      Segmentation fault
      
      Let's avoid this problem by only registering the tables after their
      successful creation, which is also less confusing when EFI runtime
      services are not in use.
      Reported-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20180308080020.22828-2-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      6b31a2fa
  13. 21 1月, 2018 1 次提交
  14. 19 1月, 2018 1 次提交
    • M
      x86/efi: Clarify that reset attack mitigation needs appropriate userspace · a5c03c31
      Matthew Garrett 提交于
      Some distributions have turned on the reset attack mitigation feature,
      which is designed to force the platform to clear the contents of RAM if
      the machine is shut down uncleanly. However, in order for the platform
      to be able to determine whether the shutdown was clean or not, userspace
      has to be configured to clear the MemoryOverwriteRequest flag on
      shutdown - otherwise the firmware will end up clearing RAM on every
      reboot, which is unnecessarily time consuming. Add some additional
      clarity to the kconfig text to reduce the risk of systems being
      configured this way.
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Acked-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      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
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      a5c03c31
  15. 08 1月, 2018 1 次提交
  16. 03 1月, 2018 5 次提交
  17. 07 12月, 2017 1 次提交