Commit Graph

11 Commits

Author SHA1 Message Date
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
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: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Levin, Alexander (Sasha Levin) e58e871bec tools/lib/lockdep: Remove private kernel headers
Move to using tools/include/ instead.

Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@redhat.com
Link: http://lkml.kernel.org/r/20170531003747.10557-2-alexander.levin@verizon.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-06-05 09:28:14 +02:00
Alexander Sverdlin 20fb654aef tools/lib/lockdep: Don't mix fd-based and stream IO
Mixing fd-based and stream-base IO results in interleaved output like
following:

=====================================
liblockdep 4.7.6
-------------------------------------
conopal/372 is trying to release lock (0x3a45c) at:
/lib/libpt.so.2.17-alpha2(_ZN11PTimedMutex6SignalEv+0x3c) [0xb613c688]
but there are no more locks to release!
other info that might help us debug this:
no locks held by conopal/372.
stack backtrace:
=====================================
liblockdep 4.7.6
---------------------------------/usr/lib/liblockdep.so.4.7.6(+0x1e3c)[0xb67c2e3c]
/usr/lib/liblockdep.so.4.7.6(+0x5fe0)[0xb67c6fe0]
/usr/lib/liblockdep.so.4.7.6(+0x6450)[0xb67c7450]
/usr/lib/liblockdep.so.4.7.6(lock_release+0x5c)[0xb67c7c40]
/usr/lib/liblockdep.so.4.7.6(pthread_mutex_unlock+0x38)[0xb67c91d4]
/lib/libpt.so.2.17-alpha2(_ZN11PTimedMutex6SignalEv+0x3c)[0xb613c688]
/lib/libpt.so.2.17-alpha2(_ZN10PContainer14AssignContentsERKS_+0xe4)[0xb6160730]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormat14AssignContentsERK10PContainer+0x90)[0xb6435edc]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormataSERK7PString+0x68)[0xb643b610]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormatC2EPKc+0x68)[0xb643b6cc]
/lib/libopal.so.3.17-alpha2(_ZN11OpalWAVFile14AddMediaFormatERK15OpalMediaFormat+0x330)[0xb66b2224]
/lib/libopal.so.3.17-alpha2(+0x2526f8)[0xb640c6f8]
/lib/ld-linux-armhf.so.3(+0x102f0)[0xb6f852f0]
/lib/ld-linux-armhf.so.3(+0x1044c)[0xb6f8544c]
/lib/ld-linux-armhf.so.3(+0xac4)[0xb6f75ac4]
/usr/lib/liblockdep.so.4.7.6(+0x1e3c)[0xb67c2e3c]
/usr/lib/liblockdep.so.4.7.6(+0x5fe0)[0xb67c6fe0]
/usr/lib/liblockdep.so.4.7.6(+0x6450)[0xb67c7450]
/usr/lib/liblockdep.so.4.7.6(lock_release+0x5c)[0xb67c7c40]
/usr/lib/liblockdep.so.4.7.6(pthread_mutex_unlock+0x38)[0xb67c91d4]
/lib/libpt.so.2.17-alpha2(_ZN11PTimedMutex6SignalEv+0x3c)[0xb613c688]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormat14AssignContentsERK10PContainer+0x78)[0xb6435ec4]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormataSERK7PString+0x68)[0xb643b610]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormatC2EPKc+0x68)[0xb643b6cc]
/lib/libopal.so.3.17-alpha2(_ZN11OpalWAVFile14AddMediaFormatERK15OpalMediaFormat+0x330)[0xb66b2224]
/lib/libopal.so.3.17-alpha2(+0x2526f8)[0xb640c6f8]
/lib/ld-linux-armhf.so.3(+0x102f0)[0xb6f852f0]
/lib/ld-linux-armhf.so.3(+0x1044c)[0xb6f8544c]
/lib/ld-linux-armhf.so.3(+0xac4)[0xb6f75ac4]

Therefore change all bare printf(...) to dprintf(STDOUT_FILENO, ...) to
sychronize with backtrace_symbols_fd().

[ BUG: bad unlock balance detected! ]
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: a.p.zijlstra@chello.nl
Cc: ben@decadent.org.uk
Link: http://lkml.kernel.org/r/20170525130005.5947-12-alexander.levin@verizon.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-06-05 09:28:08 +02:00
Andrey Ryabinin 06bea3dbfe locking/lockdep: Eliminate lockdep_init()
Lockdep is initialized at compile time now.  Get rid of lockdep_init().

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Krinkin <krinkin.m.u@gmail.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Cc: mm-commits@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-02-09 12:03:25 +01:00
Sasha Levin 33fef662d2 tools/liblockdep: Use the rbtree header provided by common tools headers
Recent changes to rbtree.h may break compilation. There is no
reason to use a liblockdep specific header to begin with, so
we'll use the one shared with all other tools/.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1440479985-6696-3-git-send-email-sasha.levin@oracle.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-08-25 09:44:23 +02:00
Kirill Smelkov 95bfdf23e4 tools/liblockdep: Fix debug_check thinko in mutex destroy
In mutex destroy code currently we pass to debug_check_no_locks_freed()

    [mem_from, mem_end)

address region. But debug_check_no_locks_freed() accepts

    mem_from, mem_*len*

i.e. second parameter is region length, not end address. And it was
always so, starting from 2006 (fbb9ce95 "lockdep: core").

Fix it, or else on a mutex destroy we wrongly check
much-wider-than-mutex region and can find not-yet-released other locks
there and wrongly report BUGs on them.

Signed-off-by: Kirill Smelkov <kirr@nexedi.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2014-12-19 15:50:55 -05:00
S. Lockwood-Childs b10827814e tools/liblockdep: Account for bitfield changes in lockdeps lock_acquire
Commit fb9edbe984 shortened held_lock->check from a 2-bit field
to a 1-bit field.

Make liblockdep compatible with the new definition by passing check=1
to lock_acquire() calls, rather than the old value check=2 (which
inadvertently disabled checks by overflowing to 0).

Without this fix, several of the test cases in liblockdep run_tests.sh
were failing.

Signed-off-by: S. Lockwood-Childs <sjl@vctlabs.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2014-07-07 12:20:16 -04:00
Sasha Levin 0c37c686b3 tools/liblockdep: Remove debug print left over from development
Remove a debug print in init_preload() which was left over from
development and isn't usefull at all currently. It was also causing
false positive test results.

Reported-by: S. Lockwood-Childs <sjl@vctlabs.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2014-07-07 12:14:27 -04:00
zhangdianfang 6c642e442e tools/liblockdep: Fix comparison of a boolean value with a value of 2
Comparison of a boolean value (!__init_state) with a value of 2 (done)
as currently happens in the code is unlikely to succeed and causes
repeated initialization of the pthread function pointers.

Instead, remove boolean comparison so that we would initialize said
function pointers only once.

Ref: https://bugzilla.kernel.org/show_bug.cgi?id=76741
Cc: Jean Delvare <jdelvare@suse.de>
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Dianfang Zhang <zhangdianfang@huawei.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2014-07-07 12:02:21 -04:00
Ira W. Snyder 367d896daf tools/liblockdep: Fix initialization code path
This makes initialization actually happen. Without it, initialization is
always skipped due to an incorrect conditional statement.

Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2014-02-26 21:21:49 -05:00
Sasha Levin 231941eec8 liblockdep: Support using LD_PRELOAD
This allows lockdep to be used without being compiled in the
original program.

Usage is quite simple:

	LD_PRELOAD=/path/to/liblockdep.so /path/to/my/program

And magically, you'll have lockdep checking in your program!

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: torvalds@linux-foundation.org
Link: http://lkml.kernel.org/r/1371163284-6346-8-git-send-email-sasha.levin@oracle.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-11-27 11:55:24 +01:00