Skip to content
Snippets Groups Projects
  1. Apr 16, 2021
  2. Jan 21, 2021
  3. Oct 05, 2020
  4. Jun 16, 2020
  5. Mar 18, 2020
  6. Nov 14, 2019
  7. Oct 23, 2019
  8. Aug 28, 2019
  9. Jul 30, 2019
  10. May 21, 2019
  11. Apr 25, 2019
  12. Feb 21, 2019
    • Alexander Shishkin's avatar
      stm class: Prevent division by zero · bf7cbaae
      Alexander Shishkin authored
      
      Using STP_POLICY_ID_SET ioctl command with dummy_stm device, or any STM
      device that supplies zero mmio channel size, will trigger a division by
      zero bug in the kernel.
      
      Prevent this by disallowing channel widths other than 1 for such devices.
      
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Fixes: 7bd1d409 ("stm class: Introduce an abstraction for System Trace Module devices")
      CC: stable@vger.kernel.org # v4.4+
      bf7cbaae
    • Zhi Jin's avatar
      stm class: Fix an endless loop in channel allocation · a1d75dad
      Zhi Jin authored
      
      There is a bug in the channel allocation logic that leads to an endless
      loop when looking for a contiguous range of channels in a range with a
      mixture of free and occupied channels. For example, opening three
      consequtive channels, closing the first two and requesting 4 channels in
      a row will trigger this soft lockup. The bug is that the search loop
      forgets to skip over the range once it detects that one channel in that
      range is occupied.
      
      Restore the original intent to the logic by fixing the omission.
      
      Signed-off-by: default avatarZhi Jin <zhi.jin@intel.com>
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Fixes: 7bd1d409 ("stm class: Introduce an abstraction for System Trace Module devices")
      CC: stable@vger.kernel.org # v4.4+
      a1d75dad
  13. Dec 19, 2018
    • Alexander Shishkin's avatar
      stm class: Fix a module refcount leak in policy creation error path · c18614a1
      Alexander Shishkin authored
      
      Commit c7fd62bc ("stm class: Introduce framing protocol drivers")
      adds a bug into the error path of policy creation, that would do a
      module_put() on a wrong module, if one tried to create a policy for
      an stm device which already has a policy, using a different protocol.
      IOW,
      
      | mkdir /config/stp-policy/dummy_stm.0:p_basic.test
      | mkdir /config/stp-policy/dummy_stm.0:p_sys-t.test # puts "p_basic"
      | mkdir /config/stp-policy/dummy_stm.0:p_sys-t.test # "p_basic" -> -1
      
      throws:
      
      | general protection fault: 0000 [#1] SMP PTI
      | CPU: 3 PID: 2887 Comm: mkdir
      | RIP: 0010:module_put.part.31+0xe/0x90
      | Call Trace:
      |  module_put+0x13/0x20
      |  stm_put_protocol+0x11/0x20 [stm_core]
      |  stp_policy_make+0xf1/0x210 [stm_core]
      |  ? __kmalloc+0x183/0x220
      |  ? configfs_mkdir+0x10d/0x4c0
      |  configfs_mkdir+0x169/0x4c0
      |  vfs_mkdir+0x108/0x1c0
      |  do_mkdirat+0xe8/0x110
      |  __x64_sys_mkdir+0x1b/0x20
      |  do_syscall_64+0x5a/0x140
      |  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Correct this sad mistake by calling calling 'put' on the correct
      reference, which happens to match another error path in the same
      function, so we consolidate the two at the same time.
      
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Fixes: c7fd62bc ("stm class: Introduce framing protocol drivers")
      Reported-by: default avatarAmmy Yi <ammy.yi@intel.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c18614a1
  14. Oct 11, 2018
  15. May 26, 2018
  16. May 25, 2018
    • Alexander Shishkin's avatar
      stm class: Use vmalloc for the master map · b5e2ced9
      Alexander Shishkin authored
      
      Fengguang is running into a warning from the buddy allocator:
      
      > swapper/0: page allocation failure: order:9, mode:0x14040c0(GFP_KERNEL|__GFP_COMP), nodemask=(null)
      > CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.17.0-rc1 #262
      > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
      > Call Trace:
      ...
      >  __kmalloc+0x14b/0x180: ____cache_alloc at mm/slab.c:3127
      >  stm_register_device+0xf3/0x5c0: stm_register_device at drivers/hwtracing/stm/core.c:695
      ...
      
      Which is basically a result of the stm class trying to allocate ~512kB
      for the dummy_stm with its default parameters. There's no reason, however,
      for it not to be vmalloc()ed instead, which is what this patch does.
      
      Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      CC: stable@vger.kernel.org # v4.4+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b5e2ced9
  17. May 14, 2018
  18. Mar 28, 2018
  19. Dec 04, 2017
  20. Nov 02, 2017
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      
      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: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  21. Oct 19, 2017
  22. Sep 22, 2017
    • Alexander Shishkin's avatar
      stm class: Fix a use-after-free · fd085bb1
      Alexander Shishkin authored
      
      For reasons unknown, the stm_source removal path uses device_destroy()
      to kill the underlying device object. Because device_destroy() uses
      devt to look for the device to destroy and the fact that stm_source
      devices don't have one (or all have the same one), it just picks the
      first device in the class, which may well be the wrong one.
      
      That is, loading stm_console and stm_heartbeat and then removing both
      will die in dereferencing a freed object.
      
      Since this should have been device_unregister() in the first place,
      use it instead of device_destroy().
      
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Fixes: 7bd1d409 ("stm class: Introduce an abstraction for System Trace Module devices")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fd085bb1
  23. Aug 25, 2017
  24. Nov 22, 2016
Loading