1. 22 5月, 2019 1 次提交
  2. 08 3月, 2018 1 次提交
    • K
      pstore: Select compression at runtime · fe1d4758
      Kees Cook 提交于
      To allow for easier build test coverage and run-time testing, this allows
      multiple compression algorithms to be built into pstore. Still only one
      is supported to operate at a time (which can be selected at build time
      or at boot time, similar to how LSMs are selected).
      Signed-off-by: NKees Cook <keescook@chromium.org>
      fe1d4758
  3. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  4. 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
  5. 01 6月, 2017 1 次提交
  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 1 次提交
  8. 16 11月, 2016 1 次提交
    • J
      pstore: Add ftrace timestamp counter · fbccdeb8
      Joel Fernandes 提交于
      In preparation for merging the per CPU buffers into one buffer when
      we retrieve the pstore ftrace data, we store the timestamp as a
      counter in the ftrace pstore record.  We store the CPU number as well
      if !PSTORE_CPU_IN_IP, in this case we shift the counter and may lose
      ordering there but we preserve the same record size. The timestamp counter
      is also racy, and not doing any locking or synchronization here results
      in the benefit of lower overhead. Since we don't care much here for exact
      ordering of function traces across CPUs, we don't synchronize and may lose
      some counter updates but I'm ok with that.
      
      Using trace_clock() results in much lower performance so avoid using it
      since we don't want accuracy in timestamp and need a rough ordering to
      perform merge.
      Signed-off-by: NJoel Fernandes <joelaf@google.com>
      [kees: updated commit message, added comments]
      Signed-off-by: NKees Cook <keescook@chromium.org>
      fbccdeb8
  9. 23 10月, 2015 1 次提交
  10. 22 10月, 2015 1 次提交
  11. 17 1月, 2015 1 次提交
  12. 20 8月, 2013 1 次提交
  13. 27 11月, 2012 1 次提交
    • S
      efi_pstore: Add a sequence counter to a variable name · 755d4fe4
      Seiji Aguchi 提交于
      [Issue]
      
      Currently, a variable name, which identifies each entry, consists of type, id and ctime.
      But if multiple events happens in a short time, a second/third event may fail to log because
      efi_pstore can't distinguish each event with current variable name.
      
      [Solution]
      
      A reasonable way to identify all events precisely is introducing a sequence counter to
      the variable name.
      
      The sequence counter has already supported in a pstore layer with "oopscount".
      So, this patch adds it to a variable name.
      Also, it is passed to read/erase callbacks of platform drivers in accordance with
      the modification of the variable name.
      
        <before applying this patch>
       a variable name of first event: dump-type0-1-12345678
       a variable name of second event: dump-type0-1-12345678
      
        type:0
        id:1
        ctime:12345678
      
       If multiple events happen in a short time, efi_pstore can't distinguish them because
       variable names are same among them.
      
        <after applying this patch>
      
       it can be distinguishable by adding a sequence counter as follows.
      
       a variable name of first event: dump-type0-1-1-12345678
       a variable name of Second event: dump-type0-1-2-12345678
      
        type:0
        id:1
        sequence counter: 1(first event), 2(second event)
        ctime:12345678
      
      In case of a write callback executed in pstore_console_write(), "0" is added to
      an argument of the write callback because it just logs all kernel messages and
      doesn't need to care about multiple events.
      Signed-off-by: NSeiji Aguchi <seiji.aguchi@hds.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NMike Waychison <mikew@google.com>
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      755d4fe4
  14. 07 9月, 2012 1 次提交
    • A
      pstore/ftrace: Convert to its own enable/disable debugfs knob · 65f8c95e
      Anton Vorontsov 提交于
      With this patch we no longer reuse function tracer infrastructure, now
      we register our own tracer back-end via a debugfs knob.
      
      It's a bit more code, but that is the only downside. On the bright side we
      have:
      
      - Ability to make persistent_ram module removable (when needed, we can
        move ftrace_ops struct into a module). Note that persistent_ram is still
        not removable for other reasons, but with this patch it's just one
        thing less to worry about;
      
      - Pstore part is more isolated from the generic function tracer. We tried
        it already by registering our own tracer in available_tracers, but that
        way we're loosing ability to see the traces while we record them to
        pstore. This solution is somewhere in the middle: we only register
        "internal ftracer" back-end, but not the "front-end";
      
      - When there is only pstore tracing enabled, the kernel will only write
        to the pstore buffer, omitting function tracer buffer (which, of course,
        still can be enabled via 'echo function > current_tracer').
      Suggested-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NAnton Vorontsov <anton.vorontsov@linaro.org>
      65f8c95e
  15. 18 7月, 2012 2 次提交
    • A
      pstore: Headers should include all stuff they use · 67a101f5
      Anton Vorontsov 提交于
      Headers should really include all the needed prototypes, types, defines
      etc. to be self-contained. This is a long-standing issue, but apparently
      the new tracing code unearthed it (SMP=n is also a prerequisite):
      
      In file included from fs/pstore/internal.h:4:0,
                       from fs/pstore/ftrace.c:21:
      include/linux/pstore.h:43:15: error: field ‘read_mutex’ has incomplete type
      
      While at it, I also added the following:
      
      linux/types.h -> size_t, phys_addr_t, uXX and friends
      linux/spinlock.h -> spinlock_t
      linux/errno.h -> Exxxx
      linux/time.h -> struct timespec (struct passed by value)
      struct module and rs_control forward declaration (passed via pointers).
      Signed-off-by: NAnton Vorontsov <anton.vorontsov@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      67a101f5
    • A
      pstore: Add persistent function tracing · 060287b8
      Anton Vorontsov 提交于
      With this support kernel can save function call chain log into a
      persistent ram buffer that can be decoded and dumped after reboot
      through pstore filesystem. It can be used to determine what function
      was last called before a reset or panic.
      
      We store the log in a binary format and then decode it at read time.
      
      p.s.
      Mostly the code comes from trace_persistent.c driver found in the
      Android git tree, written by Colin Cross <ccross@android.com>
      (according to sign-off history). I reworked the driver a little bit,
      and ported it to pstore.
      Signed-off-by: NAnton Vorontsov <anton.vorontsov@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      060287b8
  16. 17 8月, 2011 1 次提交
    • L
      pstore: defer inserting OOPS entries into pstore · 6dda9266
      Luck, Tony 提交于
      Life is simple for all the kernel terminating types of kmsg_dump
      call backs - pstore just saves the tail end of the console log. But
      for "oops" the situation is more complex - the kernel may carry on
      running (possibly for ever).  So we'd like to make the logged copy
      of the oops appear in the pstore filesystem - so that the user has
      a handle to clear the entry from the persistent backing store (if
      we don't, the store may fill with "oops" entries (that are also
      safely stashed in /var/log/messages) leaving no space for real
      errors.
      
      Current code calls pstore_mkfile() immediately. But this may
      not be safe. The oops could have happened with arbitrary locks
      held, or in interrupt or NMI context. So allocating memory and
      calling into generic filesystem code seems unwise.
      
      This patch defers making the entry appear. At the time
      of the oops, we merely set a flag "pstore_new_entry" noting that
      a new entry has been added. A periodic timer checks once a minute
      to see if the flag is set - if so, it schedules a work queue to
      rescan the backing store and make all new entries appear in the
      pstore filesystem.
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      6dda9266
  17. 23 7月, 2011 1 次提交
  18. 22 3月, 2011 1 次提交
  19. 29 12月, 2010 1 次提交
    • T
      pstore: new filesystem interface to platform persistent storage · ca01d6dd
      Tony Luck 提交于
      Some platforms have a small amount of non-volatile storage that
      can be used to store information useful to diagnose the cause of
      a system crash.  This is the generic part of a file system interface
      that presents information from the crash as a series of files in
      /dev/pstore.  Once the information has been seen, the underlying
      storage is freed by deleting the files.
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      ca01d6dd