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-01 17:07:57 +03:00
/* SPDX-License-Identifier: GPL-2.0 */
2005-04-17 02:20:36 +04:00
/ * ld s c r i p t t o m a k e s39 0 L i n u x k e r n e l
* Written b y M a r t i n S c h w i d e f s k y ( s c h w i d e f s k y @de.ibm.com)
* /
2008-11-27 13:05:58 +03:00
# include < a s m / t h r e a d _ i n f o . h >
2007-10-12 18:11:50 +04:00
# include < a s m / p a g e . h >
2016-05-28 11:03:55 +03:00
/ *
* Put . b s s . . s w a p p e r _ p g _ d i r a s t h e f i r s t t h i n g i n . b s s . T h i s w i l l
* make s u r e i t h a s 1 6 k a l i g n m e n t .
* /
# define B S S _ F I R S T _ S E C T I O N S * ( . b s s . . s w a p p e r _ p g _ d i r )
2016-06-07 11:12:55 +03:00
/* Handle ro_after_init data on our own. */
# define R O _ A F T E R _ I N I T _ D A T A
2019-10-30 00:13:30 +03:00
# define E M I T S _ P T _ N O T E
2005-04-17 02:20:36 +04:00
# include < a s m - g e n e r i c / v m l i n u x . l d s . h >
2018-04-10 15:14:02 +03:00
# include < a s m / v m l i n u x . l d s . h >
2005-04-17 02:20:36 +04:00
OUTPUT_ F O R M A T ( " e l f64 - s39 0 " , " e l f64 - s39 0 " , " e l f64 - s39 0 " )
OUTPUT_ A R C H ( s39 0 : 6 4 - b i t )
2018-06-12 16:11:40 +03:00
ENTRY( s t a r t u p _ c o n t i n u e )
2005-04-17 02:20:36 +04:00
jiffies = j i f f i e s _ 6 4 ;
2008-01-26 16:11:21 +03:00
PHDRS {
text P T _ L O A D F L A G S ( 5 ) ; /* R_E */
data P T _ L O A D F L A G S ( 7 ) ; /* RWE */
note P T _ N O T E F L A G S ( 0 ) ; /* ___ */
}
2005-04-17 02:20:36 +04:00
SECTIONS
{
2018-06-27 18:10:14 +03:00
. = 0 x1 0 0 0 0 0 ;
2007-10-12 18:11:49 +04:00
.text : {
2019-08-05 15:25:16 +03:00
_ stext = . ; /* Start of text section */
_ text = . ; /* Text and read-only data */
2009-04-26 06:11:06 +04:00
HEAD_ T E X T
TEXT_ T E X T
2007-10-12 18:11:49 +04:00
SCHED_ T E X T
2016-10-08 03:02:55 +03:00
CPUIDLE_ T E X T
2007-10-12 18:11:49 +04:00
LOCK_ T E X T
KPROBES_ T E X T
2009-06-12 12:26:46 +04:00
IRQENTRY_ T E X T
2016-03-26 00:22:05 +03:00
SOFTIRQENTRY_ T E X T
2018-06-27 15:58:46 +03:00
* ( .text . * _ indirect_ * )
2007-10-12 18:11:49 +04:00
* ( .fixup )
* ( .gnu .warning )
2019-08-05 15:25:16 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
_ etext = . ; /* End of text section */
2008-02-05 18:50:38 +03:00
} : text = 0 x07 0 0
2005-04-17 02:20:36 +04:00
2019-10-30 00:13:34 +03:00
RO_ D A T A ( P A G E _ S I Z E )
2005-04-17 02:20:36 +04:00
2007-10-12 18:11:50 +04:00
. = ALIGN( P A G E _ S I Z E ) ;
2009-10-06 12:33:57 +04:00
_ sdata = . ; /* Start of data section */
2007-10-12 18:11:49 +04:00
2016-06-07 11:12:55 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
_ _ start_ r o _ a f t e r _ i n i t = . ;
.data . .ro_after_init : {
* ( .data . .ro_after_init )
2018-09-30 19:49:50 +03:00
JUMP_ T A B L E _ D A T A
2019-10-30 00:13:28 +03:00
} : data
2016-06-07 11:12:55 +03:00
EXCEPTION_ T A B L E ( 1 6 )
. = ALIGN( P A G E _ S I Z E ) ;
_ _ end_ r o _ a f t e r _ i n i t = . ;
2007-10-12 18:11:49 +04:00
2019-10-30 00:13:35 +03:00
RW_ D A T A ( 0 x10 0 , P A G E _ S I Z E , T H R E A D _ S I Z E )
2019-04-01 20:10:45 +03:00
BOOT_ D A T A _ P R E S E R V E D
2007-10-12 18:11:49 +04:00
_ edata = . ; /* End of data section */
/* will be freed after init */
2007-10-12 18:11:50 +04:00
. = ALIGN( P A G E _ S I Z E ) ; /* Init code and data */
2007-10-12 18:11:49 +04:00
_ _ init_ b e g i n = . ;
2009-09-11 12:28:44 +04:00
2016-03-22 12:54:24 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
.init .text : AT( A D D R ( . i n i t . t e x t ) - L O A D _ O F F S E T ) {
2018-05-09 10:51:39 +03:00
_ sinittext = . ;
2016-03-22 12:54:24 +03:00
INIT_ T E X T
. = ALIGN( P A G E _ S I Z E ) ;
2018-05-09 10:51:39 +03:00
_ einittext = . ;
2016-03-22 12:54:24 +03:00
}
2009-09-11 12:28:44 +04:00
2007-10-12 18:11:49 +04:00
/ *
* .exit .text is discarded a t r u n t i m e , n o t l i n k t i m e ,
* to d e a l w i t h r e f e r e n c e s f r o m _ _ b u g _ t a b l e
* /
.exit .text : {
2008-01-20 16:15:03 +03:00
EXIT_ T E X T
2007-10-12 18:11:49 +04:00
}
2013-02-11 17:26:24 +04:00
.exit .data : {
EXIT_ D A T A
}
s390: introduce CPU alternatives
Implement CPU alternatives, which allows to optionally patch newer
instructions at runtime, based on CPU facilities availability.
A new kernel boot parameter "noaltinstr" disables patching.
Current implementation is derived from x86 alternatives. Although
ideal instructions padding (when altinstr is longer then oldinstr)
is added at compile time, and no oldinstr nops optimization has to be
done at runtime. Also couple of compile time sanity checks are done:
1. oldinstr and altinstr must be <= 254 bytes long,
2. oldinstr and altinstr must not have an odd length.
alternative(oldinstr, altinstr, facility);
alternative_2(oldinstr, altinstr1, facility1, altinstr2, facility2);
Both compile time and runtime padding consists of either 6/4/2 bytes nop
or a jump (brcl) + 2 bytes nop filler if padding is longer then 6 bytes.
.altinstructions and .altinstr_replacement sections are part of
__init_begin : __init_end region and are freed after initialization.
Signed-off-by: Vasily Gorbik <gor@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2017-10-12 14:01:47 +03:00
/ *
* struct a l t _ i n s t e n t r i e s . F r o m t h e h e a d e r ( a l t e r n a t i v e . h ) :
* " Alternative i n s t r u c t i o n s f o r d i f f e r e n t C P U t y p e s o r c a p a b i l i t i e s "
* Think l o c k i n g i n s t r u c t i o n s o n s p i n l o c k s .
* Note, t h a t i t i s a p a r t o f _ _ i n i t r e g i o n .
* /
. = ALIGN( 8 ) ;
.altinstructions : {
_ _ alt_ i n s t r u c t i o n s = . ;
* ( .altinstructions )
_ _ alt_ i n s t r u c t i o n s _ e n d = . ;
}
/ *
* And h e r e a r e t h e r e p l a c e m e n t i n s t r u c t i o n s . T h e l i n k e r s t i c k s
* them a s b i n a r y b l o b s . T h e . a l t i n s t r u c t i o n s h a s e n o u g h d a t a t o
* get t h e a d d r e s s a n d t h e l e n g t h o f t h e m t o p a t c h t h e k e r n e l s a f e l y .
* Note, t h a t i t i s a p a r t o f _ _ i n i t r e g i o n .
* /
.altinstr_replacement : {
* ( .altinstr_replacement )
}
2018-01-26 14:46:47 +03:00
/ *
* Table w i t h t h e p a t c h l o c a t i o n s t o u n d o e x p o l i n e s
* /
.nospec_call_table : {
_ _ nospec_ c a l l _ s t a r t = . ;
* ( .s390_indirect * )
_ _ nospec_ c a l l _ e n d = . ;
}
.nospec_return_table : {
_ _ nospec_ r e t u r n _ s t a r t = . ;
* ( .s390_return * )
_ _ nospec_ r e t u r n _ e n d = . ;
}
2018-04-10 15:14:02 +03:00
BOOT_ D A T A
[S390] Fix hypervisor detection for KVM
Currently we use the cpuid (via STIDP instruction) to recognize LPAR,
z/VM and KVM.
The architecture states, that bit 0-7 of STIDP returns all zero, and
if STIDP is executed in a virtual machine, the VM operating system
will replace bits 0-7 with FF.
KVM should not use FE to distinguish z/VM from KVM for interested
guests. The proper way to detect the hypervisor is the STSI (Store
System Information) instruction, which return information about the
hypervisors via function code 3, selector1=2, selector2=2.
This patch changes the detection routine of Linux to use STSI instead
of STIDP. This detection is earlier than bootmem, we have to use a
static buffer. Since STSI expects a 4kb block (4kb aligned) this
patch also changes the init.data alignment for s390. As this section
will be freed during boot, this should be no problem.
Patch is tested with LPAR, z/VM, KVM on LPAR, and KVM under z/VM.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-03-26 17:23:58 +03:00
/* early.c uses stsi, which requires page aligned data. */
. = ALIGN( P A G E _ S I Z E ) ;
2009-09-11 12:28:44 +04:00
INIT_ D A T A _ S E C T I O N ( 0 x10 0 )
2007-10-12 18:11:49 +04:00
2011-03-24 20:50:09 +03:00
PERCPU_ S E C T I O N ( 0 x10 0 )
2019-02-03 23:35:45 +03:00
.dynsym ALIGN( 8 ) : {
_ _ dynsym_ s t a r t = . ;
* ( .dynsym )
_ _ dynsym_ e n d = . ;
}
.rela .dyn ALIGN( 8 ) : {
_ _ rela_ d y n _ s t a r t = . ;
* ( .rela * )
_ _ rela_ d y n _ e n d = . ;
}
2007-10-12 18:11:50 +04:00
. = ALIGN( P A G E _ S I Z E ) ;
2007-10-12 18:11:49 +04:00
_ _ init_ e n d = . ; /* freed after init ends here */
2016-05-28 11:03:55 +03:00
BSS_ S E C T I O N ( P A G E _ S I Z E , 4 * P A G E _ S I Z E , P A G E _ S I Z E )
2007-10-12 18:11:49 +04:00
_ end = . ;
2018-07-19 17:51:25 +03:00
/ *
* uncompressed i m a g e i n f o u s e d b y t h e d e c o m p r e s s o r
* it s h o u l d m a t c h s t r u c t v m l i n u x _ i n f o
* /
2018-10-17 14:59:46 +03:00
.vmlinux .info 0 ( INFO) : {
2018-04-10 15:14:02 +03:00
QUAD( _ s t e x t ) / * d e f a u l t _ l m a * /
QUAD( s t a r t u p _ c o n t i n u e ) / * e n t r y * /
QUAD( _ _ b s s _ s t a r t - _ s t e x t ) / * i m a g e _ s i z e * /
QUAD( _ _ b s s _ s t o p - _ _ b s s _ s t a r t ) / * b s s _ s i z e * /
QUAD( _ _ b o o t _ d a t a _ s t a r t ) / * b o o t d a t a _ o f f * /
QUAD( _ _ b o o t _ d a t a _ e n d - _ _ b o o t _ d a t a _ s t a r t ) / * b o o t d a t a _ s i z e * /
2019-04-01 20:10:45 +03:00
QUAD( _ _ b o o t _ d a t a _ p r e s e r v e d _ s t a r t ) / * b o o t d a t a _ p r e s e r v e d _ o f f * /
QUAD( _ _ b o o t _ d a t a _ p r e s e r v e d _ e n d -
_ _ boot_ d a t a _ p r e s e r v e d _ s t a r t ) / * b o o t d a t a _ p r e s e r v e d _ s i z e * /
2019-02-03 23:35:45 +03:00
QUAD( _ _ d y n s y m _ s t a r t ) / * d y n s y m _ s t a r t * /
QUAD( _ _ r e l a _ d y n _ s t a r t ) / * r e l a _ d y n _ s t a r t * /
QUAD( _ _ r e l a _ d y n _ e n d ) / * r e l a _ d y n _ e n d * /
2018-10-17 14:59:46 +03:00
} : NONE
2018-07-19 17:51:25 +03:00
2007-10-12 18:11:49 +04:00
/* Debugging sections. */
STABS_ D E B U G
DWARF_ D E B U G
linker script: unify usage of discard definition
Discarded sections in different archs share some commonality but have
considerable differences. This led to linker script for each arch
implementing its own /DISCARD/ definition, which makes maintaining
tedious and adding new entries error-prone.
This patch makes all linker scripts to move discard definitions to the
end of the linker script and use the common DISCARDS macro. As ld
uses the first matching section definition, archs can include default
discarded sections by including them earlier in the linker script.
ia64 is notable because it first throws away some ia64 specific
subsections and then include the rest of the sections into the final
image, so those sections must be discarded before the inclusion.
defconfig compile tested for x86, x86-64, powerpc, powerpc64, ia64,
alpha, sparc, sparc64 and s390. Michal Simek tested microblaze.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Tested-by: Michal Simek <monstr@monstr.eu>
Cc: linux-arch@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Tony Luck <tony.luck@intel.com>
2009-07-09 06:27:40 +04:00
/* Sections to be discarded */
DISCARDS
2017-11-20 13:41:07 +03:00
/ DISCARD/ : {
* ( .eh_frame )
}
2005-04-17 02:20:36 +04:00
}