1. 17 Dec, 2018 1 commit
    • Kees Cook's avatar
      pstore/ram: Correctly calculate usable PRZ bytes · b718d6be
      Kees Cook authored
      [ Upstream commit 89d328f6 ]
      
      The actual number of bytes stored in a PRZ is smaller than the
      bytes requested by platform data, since there is a header on each
      PRZ. Additionally, if ECC is enabled, there are trailing bytes used
      as well. Normally this mismatch doesn't matter since PRZs are circular
      buffers and the leading "overflow" bytes are just thrown away. However, in
      the case of a compressed record, this rather badly corrupts the results.
      
      This corruption was visible with "ramoops.mem_size=204800 ramoops.ecc=1".
      Any stored crashes would not be uncompressable (producing a pstorefs
      "dmesg-*.enc.z" file), and triggering errors at boot:
      
        [    2.790759] pstore: crypto_comp_decompress failed, ret = -22!
      
      Backporting this depends on commit 70ad35db
      
       ("pstore: Convert console
      write to use ->write_buf")
      Reported-by: default avatarJoel Fernandes <joel@joelfernandes.org>
      Fixes: b0aad7a9
      
       ("pstore: Add compression support to pstore")
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b718d6be
  2. 31 May, 2017 1 commit
  3. 20 Apr, 2017 1 commit
    • David Howells's avatar
      Annotate hardware config module parameters in fs/pstore/ · b90fe0c4
      David Howells authored
      
      
      When the kernel is running in secure boot mode, we lock down the kernel to
      prevent userspace from modifying the running kernel image.  Whilst this
      includes prohibiting access to things like /dev/mem, it must also prevent
      access by means of configuring driver modules in such a way as to cause a
      device to access or modify the kernel image.
      
      To this end, annotate module_param* statements that refer to hardware
      configuration and indicate for future reference what type of parameter they
      specify.  The parameter parser in the core sees this information and can
      skip such parameters with an error message if the kernel is locked down.
      The module initialisation then runs as normal, but just sees whatever the
      default values for those parameters is.
      
      Note that we do still need to do the module initialisation because some
      drivers have viable defaults set in case parameters aren't specified and
      some drivers support automatic configuration (e.g. PNP or PCI) in addition
      to manually coded parameters.
      
      This patch annotates drivers in fs/pstore/.
      Suggested-by: default avatarAlan Cox <gnomes@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      cc: Anton Vorontsov <anton@enomsg.org>
      cc: Colin Cross <ccross@android.com>
      cc: Tony Luck <tony.luck@intel.com>
      b90fe0c4
  4. 07 Mar, 2017 5 commits
  5. 13 Feb, 2017 1 commit
  6. 09 Feb, 2017 1 commit
  7. 16 Nov, 2016 7 commits
  8. 11 Nov, 2016 1 commit
  9. 08 Sep, 2016 5 commits
    • Geliang Tang's avatar
      ramoops: move spin_lock_init after kmalloc error checking · f88baf68
      Geliang Tang authored
      
      
      If cxt->pstore.buf allocated failed, no need to initialize
      cxt->pstore.buf_lock. So this patch moves spin_lock_init() after the
      error checking.
      Signed-off-by: default avatarGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      f88baf68
    • Mark Salyzyn's avatar
      pstore/pmsg: drop bounce buffer · 5bf6d1b9
      Mark Salyzyn authored
      
      
      Removing a bounce buffer copy operation in the pmsg driver path is
      always better. We also gain in overall performance by not requesting
      a vmalloc on every write as this can cause precious RT tasks, such
      as user facing media operation, to stall while memory is being
      reclaimed. Added a write_buf_user to the pstore functions, a backup
      platform write_buf_user that uses the small buffer that is part of
      the instance, and implemented a ramoops write_buf_user that only
      supports PSTORE_TYPE_PMSG.
      Signed-off-by: default avatarMark Salyzyn <salyzyn@android.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      5bf6d1b9
    • Namhyung Kim's avatar
      pstore/ram: Set pstore flags dynamically · 79d955af
      Namhyung Kim authored
      
      
      The ramoops can be configured to enable each pstore type by setting
      their size.  In that case, it'd be better not to register disabled types
      in the first place.
      
      Cc: Anton Vorontsov <anton@enomsg.org>
      Cc: Colin Cross <ccross@android.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      79d955af
    • Namhyung Kim's avatar
      pstore: Split pstore fragile flags · c950fd6f
      Namhyung Kim authored
      
      
      This patch adds new PSTORE_FLAGS for each pstore type so that they can
      be enabled separately.  This is a preparation for ongoing virtio-pstore
      work to support those types flexibly.
      
      The PSTORE_FLAGS_FRAGILE is changed to PSTORE_FLAGS_DMESG to preserve the
      original behavior.
      
      Cc: Anton Vorontsov <anton@enomsg.org>
      Cc: Colin Cross <ccross@android.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: linux-acpi@vger.kernel.org
      Cc: linux-efi@vger.kernel.org
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      [kees: retained "FRAGILE" for now to make merges easier]
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      c950fd6f
    • Sebastian Andrzej Siewior's avatar
      pstore/ramoops: fixup driver removal · 4407de74
      Sebastian Andrzej Siewior authored
      A basic rmmod ramoops segfaults. Let's see why.
      
      Since commit 34f0ec82 ("pstore: Correct the max_dump_cnt clearing of
      ramoops") sets ->max_dump_cnt to zero before looping over ->przs but we
      didn't use it before that either.
      
      And since commit ee1d2674
      
       ("pstore: add pstore unregister") we free
      that memory on rmmod.
      
      But even then, we looped until a NULL pointer or ERR. I don't see where
      it is ensured that the last member is NULL. Let's try this instead:
      simply error recovery and free. Clean up in error case where resources
      were allocated. And then, in the free path, rely on ->max_dump_cnt in
      the free path.
      
      Cc: Anton Vorontsov <anton@enomsg.org>
      Cc: Colin Cross <ccross@android.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Cc: stable@vger.kernel.org # 4.4.x-
      4407de74
  10. 05 Aug, 2016 2 commits
  11. 14 Jun, 2016 1 commit
    • Greg Hackmann's avatar
      pstore/ram: add Device Tree bindings · 35da6094
      Greg Hackmann authored
      
      
      ramoops is one of the remaining places where ARM vendors still rely on
      board-specific shims.  Device Tree lets us replace those shims with
      generic code.
      
      These bindings mirror the ramoops module parameters, with two small
      differences:
      
      (1) dump_oops becomes an optional "no-dump-oops" property, since ramoops
          sets dump_oops=1 by default.
      
      (2) mem_type=1 becomes the more self-explanatory "unbuffered" property.
      Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
      [fixed platform_get_drvdata() crash, thanks to Brian Norris]
      [switched from u64 to u32 to simplify code, various whitespace fixes]
      [use dev_of_node() to gain code-elimination for CONFIG_OF=n]
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      35da6094
  12. 02 Jun, 2016 1 commit
    • Geliang Tang's avatar
      pstore: add lzo/lz4 compression support · 8cfc8ddc
      Geliang Tang authored
      
      
      Like zlib compression in pstore, this patch added lzo and lz4
      compression support so that users can have more options and better
      compression ratio.
      
      The original code treats the compressed data together with the
      uncompressed ECC correction notice by using zlib decompress. The
      ECC correction notice is missing in the decompression process. The
      treatment also makes lzo and lz4 not working. So I treat them
      separately by using pstore_decompress() to treat the compressed
      data, and memcpy() to treat the uncompressed ECC correction notice.
      Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      8cfc8ddc
  13. 10 Mar, 2016 1 commit
  14. 22 Oct, 2015 1 commit
  15. 21 May, 2015 3 commits
  16. 16 Mar, 2015 1 commit
  17. 17 Jan, 2015 1 commit
  18. 16 Jan, 2015 2 commits
  19. 11 Dec, 2014 1 commit
    • Tony Lindgren's avatar
      pstore-ram: Allow optional mapping with pgprot_noncached · 027bc8b0
      Tony Lindgren authored
      
      
      On some ARMs the memory can be mapped pgprot_noncached() and still
      be working for atomic operations. As pointed out by Colin Cross
      <ccross@android.com>, in some cases you do want to use
      pgprot_noncached() if the SoC supports it to see a debug printk
      just before a write hanging the system.
      
      On ARMs, the atomic operations on strongly ordered memory are
      implementation defined. So let's provide an optional kernel parameter
      for configuring pgprot_noncached(), and use pgprot_writecombine() by
      default.
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Rob Herring <robherring2@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Anton Vorontsov <anton@enomsg.org>
      Cc: Colin Cross <ccross@android.com>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: stable@vger.kernel.org
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      027bc8b0
  20. 05 Nov, 2014 1 commit
    • Ben Zhang's avatar
      pstore/ram: Strip ramoops header for correct decompression · a28726b4
      Ben Zhang authored
      
      
      pstore compression/decompression was added during 3.12.
      The ramoops driver prepends a "====timestamp.timestamp-C|D\n"
      header to the compressed record before handing it over to pstore
      driver which doesn't know about the header. In pstore_decompress(),
      the pstore driver reads the first "==" as a zlib header, so the
      decompression always fails. For example, this causes the driver
      to write /dev/pstore/dmesg-ramoops-0.enc.z instead of
      /dev/pstore/dmesg-ramoops-0.
      
      This patch makes the ramoops driver remove the header before
      pstore decompression.
      Signed-off-by: default avatarBen Zhang <benzh@chromium.org>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      a28726b4
  21. 20 Oct, 2014 1 commit
  22. 17 Mar, 2014 1 commit