1. 12 11月, 2017 1 次提交
    • A
      pstore: Use ktime_get_real_fast_ns() instead of __getnstimeofday() · df27067e
      Arnd Bergmann 提交于
      __getnstimeofday() is a rather odd interface, with a number of quirks:
      
      - The caller may come from NMI context, but the implementation is not NMI safe,
        one way to get there from NMI is
      
            NMI handler:
              something bad
                panic()
                  kmsg_dump()
                    pstore_dump()
                       pstore_record_init()
                         __getnstimeofday()
      
      - The calling conventions are different from any other timekeeping functions,
        to deal with returning an error code during suspended timekeeping.
      
      Address the above issues by using a completely different method to get the
      time: ktime_get_real_fast_ns() is NMI safe and has a reasonable behavior
      when timekeeping is suspended: it returns the time at which it got
      suspended. As Thomas Gleixner explained, this is safe, as
      ktime_get_real_fast_ns() does not call into the clocksource driver that
      might be suspended.
      
      The result can easily be transformed into a timespec structure. Since
      ktime_get_real_fast_ns() was not exported to modules, add the export.
      
      The pstore behavior for the suspended case changes slightly, as it now
      stores the timestamp at which timekeeping was suspended instead of storing
      a zero timestamp.
      
      This change is not addressing y2038-safety, that's subject to a more
      complex follow up patch.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NKees Cook <keescook@chromium.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Anton Vorontsov <anton@enomsg.org>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Colin Cross <ccross@android.com>
      Link: https://lkml.kernel.org/r/20171110152530.1926955-1-arnd@arndb.de
      df27067e
  2. 05 10月, 2017 1 次提交
    • K
      timer: Remove expires and data arguments from DEFINE_TIMER · 1d27e3e2
      Kees Cook 提交于
      Drop the arguments from the macro and adjust all callers with the
      following script:
      
        perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
          $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts
      Acked-by: Guenter Roeck <linux@roeck-us.net> # for watchdog parts
      Acked-by: David S. Miller <davem@davemloft.net> # for networking parts
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: Kalle Valo <kvalo@codeaurora.org> # for wireless parts
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Cc: linux-mips@linux-mips.org
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Lai Jiangshan <jiangshanlai@gmail.com>
      Cc: Sebastian Reichel <sre@kernel.org>
      Cc: Kalle Valo <kvalo@qca.qualcomm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: linux1394-devel@lists.sourceforge.net
      Cc: Chris Metcalf <cmetcalf@mellanox.com>
      Cc: linux-s390@vger.kernel.org
      Cc: linux-wireless@vger.kernel.org
      Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Ursula Braun <ubraun@linux.vnet.ibm.com>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: Harish Patil <harish.patil@cavium.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Michael Reed <mdr@sgi.com>
      Cc: Manish Chopra <manish.chopra@cavium.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: linux-pm@vger.kernel.org
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Julian Wiedmann <jwi@linux.vnet.ibm.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Mark Gross <mark.gross@intel.com>
      Cc: linux-watchdog@vger.kernel.org
      Cc: linux-scsi@vger.kernel.org
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: netdev@vger.kernel.org
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
      Link: https://lkml.kernel.org/r/1507159627-127660-11-git-send-email-keescook@chromium.orgSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      1d27e3e2
  3. 06 7月, 2017 1 次提交
    • D
      pstore: Implement show_options · 349d7438
      David Howells 提交于
      Implement the show_options superblock op for pstore as part of a bid to get
      rid of s_options and generic_show_options() to make it easier to implement
      a context-based mount where the mount options can be passed individually
      over a file descriptor.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cc: Kees Cook <keescook@chromium.org>
      cc: Anton Vorontsov <anton@enomsg.org>
      cc: Colin Cross <ccross@android.com>
      cc: Tony Luck <tony.luck@intel.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      349d7438
  4. 28 6月, 2017 1 次提交
  5. 01 6月, 2017 5 次提交
  6. 28 4月, 2017 1 次提交
    • K
      pstore: Solve lockdep warning by moving inode locks · 3a7d2fd1
      Kees Cook 提交于
      Lockdep complains about a possible deadlock between mount and unlink
      (which is technically impossible), but fixing this improves possible
      future multiple-backend support, and keeps locking in the right order.
      
      The lockdep warning could be triggered by unlinking a file in the
      pstore filesystem:
      
        -> #1 (&sb->s_type->i_mutex_key#14){++++++}:
               lock_acquire+0xc9/0x220
               down_write+0x3f/0x70
               pstore_mkfile+0x1f4/0x460
               pstore_get_records+0x17a/0x320
               pstore_fill_super+0xa4/0xc0
               mount_single+0x89/0xb0
               pstore_mount+0x13/0x20
               mount_fs+0xf/0x90
               vfs_kern_mount+0x66/0x170
               do_mount+0x190/0xd50
               SyS_mount+0x90/0xd0
               entry_SYSCALL_64_fastpath+0x1c/0xb1
      
        -> #0 (&psinfo->read_mutex){+.+.+.}:
               __lock_acquire+0x1ac0/0x1bb0
               lock_acquire+0xc9/0x220
               __mutex_lock+0x6e/0x990
               mutex_lock_nested+0x16/0x20
               pstore_unlink+0x3f/0xa0
               vfs_unlink+0xb5/0x190
               do_unlinkat+0x24c/0x2a0
               SyS_unlinkat+0x16/0x30
               entry_SYSCALL_64_fastpath+0x1c/0xb1
      
        Possible unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(&sb->s_type->i_mutex_key#14);
                                      lock(&psinfo->read_mutex);
                                      lock(&sb->s_type->i_mutex_key#14);
         lock(&psinfo->read_mutex);
      Reported-by: NMarta Lofstedt <marta.lofstedt@intel.com>
      Reported-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      3a7d2fd1
  7. 08 3月, 2017 17 次提交
  8. 25 2月, 2017 1 次提交
  9. 16 11月, 2016 1 次提交
    • N
      pstore: Convert console write to use ->write_buf · 70ad35db
      Namhyung Kim 提交于
      Maybe I'm missing something, but I don't know why it needs to copy the
      input buffer to psinfo->buf and then write.  Instead we can write the
      input buffer directly.  The only implementation that supports console
      message (i.e. ramoops) already does it for ftrace messages.
      
      For the upcoming virtio backend driver, it needs to protect psinfo->buf
      overwritten from console messages.  If it could use ->write_buf method
      instead of ->write, the problem will be solved easily.
      
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      70ad35db
  10. 09 11月, 2016 1 次提交
  11. 09 9月, 2016 2 次提交
    • M
      pstore/pmsg: drop bounce buffer · 5bf6d1b9
      Mark Salyzyn 提交于
      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: NMark Salyzyn <salyzyn@android.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      5bf6d1b9
    • N
      pstore: Split pstore fragile flags · c950fd6f
      Namhyung Kim 提交于
      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: NNamhyung Kim <namhyung@kernel.org>
      [kees: retained "FRAGILE" for now to make merges easier]
      Signed-off-by: NKees Cook <keescook@chromium.org>
      c950fd6f
  12. 03 6月, 2016 1 次提交
    • G
      pstore: add lzo/lz4 compression support · 8cfc8ddc
      Geliang Tang 提交于
      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: NGeliang Tang <geliangtang@163.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      8cfc8ddc
  13. 01 6月, 2016 3 次提交
  14. 03 11月, 2015 1 次提交
  15. 22 10月, 2015 2 次提交
  16. 22 5月, 2015 1 次提交