1. 02 Nov, 2017 1 commit
    • 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
      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>
  2. 08 Sep, 2017 1 commit
    • Linus Torvalds's avatar
      genksyms: fix gperf removal conversion · 3aea311c
      Linus Torvalds authored
      I had stupidly missed one special use of 'is_reserved_word()' when I
      converted the code to avoid gperf.
      I had changed that function to return the token ID directly rather than
      a pointer to the token descriptor structure, but that meant that the
      test for "is this a reserved word" changed from checking the return
      value against NULL, to checking that it wasn't negative.
      And while I had converted the main token parser over, I missed the
      special case of the typeof phrase handling.  And since our dependency
      chain for genksyms does not include the genksyms program itself
      changing, my kernel rebuild didn't show the problem.
      Fixes: bb3290d9 ("Remove gperf usage from toolchain")
      Reported-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  3. 19 Aug, 2017 1 commit
  4. 05 Jun, 2017 1 commit
  5. 03 Feb, 2017 1 commit
    • Ard Biesheuvel's avatar
      kbuild: modversions: add infrastructure for emitting relative CRCs · 56067812
      Ard Biesheuvel authored
      This add the kbuild infrastructure that will allow architectures to emit
      vmlinux symbol CRCs as 32-bit offsets to another location in the kernel
      where the actual value is stored. This works around problems with CRCs
      being mistaken for relocatable symbols on kernels that self relocate at
      runtime (i.e., powerpc with CONFIG_RELOCATABLE=y)
      For the kbuild side of things, this comes down to the following:
       - introducing a Kconfig symbol MODULE_REL_CRCS
       - adding a -R switch to genksyms to instruct it to emit the CRC symbols
         as references into the .rodata section
       - making modpost distinguish such references from absolute CRC symbols
         by the section index (SHN_ABS)
       - making kallsyms disregard non-absolute symbols with a __crc_ prefix
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  6. 05 Jan, 2017 2 commits
  7. 29 Nov, 2016 2 commits
  8. 25 Aug, 2016 2 commits
  9. 20 Apr, 2016 1 commit
  10. 09 Dec, 2015 1 commit
    • Michal Marek's avatar
      genksyms: Handle string literals with spaces in reference files · a78f70e8
      Michal Marek authored
      The reference files use spaces to separate tokens, however, we must
      preserve spaces inside string literals. Currently the only case in the
      tree is struct edac_raw_error_desc in <linux/edac.h>:
      $ KBUILD_SYMTYPES=1 make -s drivers/edac/amd64_edac.symtypes
      $ mv drivers/edac/amd64_edac.{symtypes,symref}
      $ KBUILD_SYMTYPES=1 make -s drivers/edac/amd64_edac.symtypes
      drivers/edac/amd64_edac.c:527: warning: amd64_get_dram_hole_info: modversion changed because of changes in struct edac_raw_error_desc
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
  11. 20 Aug, 2015 2 commits
    • Michal Marek's avatar
      genksyms: Regenerate parser · 5b733fac
      Michal Marek authored
      Rebuild the parser after commit 1c722503 (genksyms: Duplicate
      function pointer type definitions segfault), using bison 2.7.
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
    • Richard Yao's avatar
      genksyms: Duplicate function pointer type definitions segfault · 1c722503
      Richard Yao authored
      I noticed that genksyms will segfault when it sees duplicate function
      pointer type declaration when I placed the same function pointer
      definition in two separate headers in a local branch as an intermediate
      step of some refactoring. This can be reproduced by piping the following
      minimal test case into `genksyms -r /dev/null` or alternatively, putting
      it into a C file attempting a build:
      typedef int (*f)();
      typedef int (*f)();
      Attaching gdb to genksyms to understand this failure is useless without
      changing CFLAGS to emit debuginfo. Once you have debuginfo, you will
      find that the failure is that `char *s` was NULL and the program
      executed `while(*s)`. At which point, further debugging requires
      familiarity with compiler front end / parser development.
      What happens is that flex identifies the first instance of the token "f"
      as IDENT and the yacc parser adds it to the symbol table. On the second
      instance, flex will identify "f" as TYPE, which triggers an error case
      in the yacc parser. Given that TYPE would have been IDENT had it not
      been in the symbol table, the the segmentaion fault could be avoided by
      treating TYPE as IDENT in the affected rule.
      Some might consider placing identical function pointer type declarations
      in different headers to be poor style might consider a failure to be
      beneficial. However, failing through a segmentation fault makes the
      cause non-obvious and can waste the time of anyone who encounters it.
      Signed-off-by: default avatarRichard Yao <richard.yao@clusterhq.com>
      Acked-by: default avatarMadhuri Yechuri <madhuriyechuri@clusterhq.com>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
  12. 03 Apr, 2014 1 commit
    • Jan Beulich's avatar
      genksyms: fix typeof() handling · dc533240
      Jan Beulich authored
      Recent increased use of typeof() throughout the tree resulted in a
      number of symbols (25 in a typical distro config of ours) not getting a
      proper CRC calculated for them anymore, due to the parser in genksyms
      not coping with several of these uses (interestingly in the majority of
      [if not all] cases the problem is due to the use of typeof() in code
      preceding a certain export, not in the declaration/definition of the
      exported function/object itself; I wasn't able to find a way to address
      this more general parser shortcoming).
      The use of parameter_declaration is a little more relaxed than would be
      ideal (permitting not just a bare type specification, but also one with
      identifier), but since the same code is being passed through an actual
      compiler, there's no apparent risk of allowing through any broken code.
      Otoh using parameter_declaration instead of the ad hoc
      "decl_specifier_seq '*'" / "decl_specifier_seq" pair allows all types to
      be handled rather than just plain ones and pointers to plain ones.
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Cc: Michal Marek <mmarek@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  13. 20 Mar, 2013 1 commit
    • James Hogan's avatar
      genksyms: pass symbol-prefix instead of arch · d70f82ac
      James Hogan authored
      Pass symbol-prefix to genksyms instead of arch, so that the decision
      what symbol prefix to use is kept in one place.
      Basically genksyms used to take a -a $ARCH argument and it used that to
      determine whether to add an underscore symbol prefix. It's now changed
      to take a -s $SYMBOL_PREFIX argument so that the caller decides whether
      a symbol prefix is required. The build system then uses
      CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX to determine whether to pass the
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
  14. 02 Mar, 2013 1 commit
  15. 08 Jan, 2012 1 commit
  16. 11 Oct, 2011 3 commits
  17. 25 Jul, 2011 1 commit
    • Jesper Juhl's avatar
      genksyms: Use same type in loop comparison · 1ae14703
      Jesper Juhl authored
      The ARRAY_SIZE macro in scripts/genksyms/genksyms.c returns a value of
      type size_t. That value is being compared to a variable of type int in
      a loop in read_node(). Change the int variable to size_t type as well,
      so we don't do signed vs unsigned type comparisons with all the
      potential promotion/sign extension trouble that can cause (also
      silences compiler warnings at high levels of warnings).
      Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
  18. 09 Jun, 2011 4 commits
  19. 17 Mar, 2011 7 commits
  20. 25 Nov, 2010 1 commit
  21. 02 Feb, 2010 1 commit
  22. 12 Dec, 2009 1 commit
  23. 15 Nov, 2009 1 commit
    • Josh Triplett's avatar
      genksyms: Mark is_reserved_word static · ed9df091
      Josh Triplett authored
      The genksyms keyword gperf hash provides a function is_reserved_word.
      genksyms #includes the resulting generated file keywords.c, so the
      function gets used only in the same source file that defines it.  Mark
      is_reserved_word static, and regenerate the corresponding generated
      Signed-off-by: default avatarJosh Triplett <josh@joshtriplett.org>
  24. 23 Sep, 2009 1 commit
  25. 14 Jan, 2009 1 commit