1. 01 7月, 2013 1 次提交
  2. 30 4月, 2013 3 次提交
    • M
      efi, pstore: Read data from variable store before memcpy() · 8a415b8c
      Matt Fleming 提交于
      Seiji reported getting empty dmesg-* files, because the data was never
      actually read in efi_pstore_read_func(), and so the memcpy() was copying
      garbage data.
      
      This patch necessitated adding __efivar_entry_get() which is callable
      between efivar_entry_iter_{begin,end}(). We can also delete
      __efivar_entry_size() because efi_pstore_read_func() was the only
      caller.
      Reported-by: NSeiji Aguchi <seiji.aguchi@hds.com>
      Tested-by: NSeiji Aguchi <seiji.aguchi@hds.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Matthew Garrett <matthew.garrett@nebula.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      8a415b8c
    • M
      efi, pstore: Remove entry from list when erasing · 12abcfde
      Matt Fleming 提交于
      We need to remove the entry from the EFI variable list before we erase
      it from the variable store and free the associated state, otherwise it's
      possible to hit the following crash,
      
        BUG: unable to handle kernel NULL pointer dereference at (null)
        IP: [<ffffffff8142ea0f>] __efivar_entry_iter+0xcf/0x120
        PGD 19483f067 PUD 195426067 PMD 0
        Oops: 0000 [#1] SMP
        [...]
        Call Trace:
         [<ffffffff81430ebf>] efi_pstore_erase+0xef/0x140
         [<ffffffff81003138>] ? math_error+0x288/0x2d0
         [<ffffffff811ea491>] pstore_unlink+0x41/0x60
         [<ffffffff811741ff>] vfs_unlink+0x9f/0x110
         [<ffffffff8117813b>] do_unlinkat+0x18b/0x280
         [<ffffffff8116d7e6>] ? sys_newfstatat+0x36/0x50
         [<ffffffff81178472>] sys_unlinkat+0x22/0x40
         [<ffffffff81543282>] system_call_fastpath+0x16/0x1b
      Reported-by: NSeiji Aguchi <seiji.aguchi@hds.com>
      Tested-by: NSeiji Aguchi <seiji.aguchi@hds.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Matthew Garrett <matthew.garrett@nebula.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      12abcfde
    • M
      efi, pstore: Initialise 'entry' before iterating · 4ee39e97
      Matt Fleming 提交于
      Seiji reports hitting the following crash when erasing pstore dump
      variables,
      
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000fa4
        IP: [<ffffffff8142dadf>] __efivar_entry_iter+0x2f/0x120
        PGD 18482a067 PUD 190724067 PMD 0
        Oops: 0000 [#1] SMP
        [...]
        Call Trace:
         [<ffffffff8143001f>] efi_pstore_erase+0xdf/0x130
         [<ffffffff81200038>] ? cap_socket_create+0x8/0x10
         [<ffffffff811ea491>] pstore_unlink+0x41/0x60
         [<ffffffff811741ff>] vfs_unlink+0x9f/0x110
         [<ffffffff8117813b>] do_unlinkat+0x18b/0x280
         [<ffffffff81178472>] sys_unlinkat+0x22/0x40
         [<ffffffff81542402>] system_call_fastpath+0x16/0x1b
      
      'entry' needs to be initialised in efi_pstore_erase() when iterating
      with __efivar_entry_iter(), otherwise the garbage pointer will be
      dereferenced, leading to crashes like the above.
      Reported-by: NSeiji Aguchi <seiji.aguchi@hds.com>
      Tested-by: NSeiji Aguchi <seiji.aguchi@hds.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Matthew Garrett <matthew.garrett@nebula.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      4ee39e97
  3. 17 4月, 2013 1 次提交
    • M
      efivars: Move pstore code into the new EFI directory · 04851772
      Matt Fleming 提交于
      efivars.c has grown far too large and needs to be divided up. Create a
      new directory and move the persistence storage code to efi-pstore.c now
      that it uses the new efivar API. This helps us to greatly reduce the
      size of efivars.c and paves the way for moving other code out of
      efivars.c.
      
      Note that because CONFIG_EFI_VARS can be built as a module efi-pstore
      must also include support for building as a module.
      Reviewed-by: NTom Gundersen <teg@jklm.no>
      Tested-by: NTom Gundersen <teg@jklm.no>
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Cc: Anton Vorontsov <cbouatmailru@gmail.com>
      Cc: Colin Cross <ccross@android.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      04851772