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 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2012-05-09 02:22:28 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Trampoline.S Derived from Setup.S by Linus Torvalds
|
|
|
|
*
|
|
|
|
* 4 Jan 1997 Michael Chastain: changed to gnu as.
|
|
|
|
* 15 Sept 2005 Eric Biederman: 64bit PIC support
|
|
|
|
*
|
|
|
|
* Entry: CS:IP point to the start of our code, we are
|
|
|
|
* in real mode with no stack, but the rest of the
|
|
|
|
* trampoline page to make our stack and everything else
|
|
|
|
* is a mystery.
|
|
|
|
*
|
2012-05-09 02:22:43 +08:00
|
|
|
* On entry to trampoline_start, the processor is in real mode
|
2012-05-09 02:22:28 +08:00
|
|
|
* with 16-bit addressing and 16-bit data. CS has some value
|
|
|
|
* and IP is zero. Thus, data addresses need to be absolute
|
|
|
|
* (no relocation) and are taken with regard to r_base.
|
|
|
|
*
|
|
|
|
* With the addition of trampoline_level4_pgt this code can
|
|
|
|
* now enter a 64bit kernel that lives at arbitrary 64bit
|
|
|
|
* physical addresses.
|
|
|
|
*
|
|
|
|
* If you work on this file, check the object module with objdump
|
|
|
|
* --full-contents --reloc to make sure there are no relocation
|
|
|
|
* entries.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
#include <asm/pgtable_types.h>
|
|
|
|
#include <asm/page_types.h>
|
|
|
|
#include <asm/msr.h>
|
|
|
|
#include <asm/segment.h>
|
|
|
|
#include <asm/processor-flags.h>
|
2017-07-18 05:10:25 +08:00
|
|
|
#include <asm/realmode.h>
|
2012-05-09 02:22:37 +08:00
|
|
|
#include "realmode.h"
|
2012-05-09 02:22:28 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.code16
|
|
|
|
|
2012-05-09 02:22:46 +08:00
|
|
|
.balign PAGE_SIZE
|
2019-10-11 19:51:02 +08:00
|
|
|
SYM_CODE_START(trampoline_start)
|
2012-05-09 02:22:28 +08:00
|
|
|
cli # We should be safe anyway
|
|
|
|
wbinvd
|
|
|
|
|
2012-05-09 02:22:37 +08:00
|
|
|
LJMPW_RM(1f)
|
2012-05-09 02:22:28 +08:00
|
|
|
1:
|
|
|
|
mov %cs, %ax # Code and data in the same place
|
|
|
|
mov %ax, %ds
|
|
|
|
mov %ax, %es
|
|
|
|
mov %ax, %ss
|
|
|
|
|
|
|
|
# Setup stack
|
2012-05-09 02:22:40 +08:00
|
|
|
movl $rm_stack_end, %esp
|
2012-05-09 02:22:28 +08:00
|
|
|
|
|
|
|
call verify_cpu # Verify the cpu supports long mode
|
|
|
|
testl %eax, %eax # Check for return code
|
|
|
|
jnz no_longmode
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GDT tables in non default location kernel can be beyond 16MB and
|
|
|
|
* lgdt will not be able to load the address as in real mode default
|
|
|
|
* operand size is 16bit. Use lgdtl instead to force operand size
|
|
|
|
* to 32 bit.
|
|
|
|
*/
|
|
|
|
|
2012-05-09 02:22:46 +08:00
|
|
|
lidtl tr_idt # load idt with 0, 0
|
|
|
|
lgdtl tr_gdt # load gdt with whatever is appropriate
|
2012-05-09 02:22:28 +08:00
|
|
|
|
2012-05-09 02:22:40 +08:00
|
|
|
movw $__KERNEL_DS, %dx # Data segment descriptor
|
|
|
|
|
|
|
|
# Enable protected mode
|
|
|
|
movl $X86_CR0_PE, %eax # protected mode (PE) bit
|
|
|
|
movl %eax, %cr0 # into protected mode
|
2012-05-09 02:22:28 +08:00
|
|
|
|
|
|
|
# flush prefetch and jump to startup_32
|
2012-05-09 02:22:35 +08:00
|
|
|
ljmpl $__KERNEL32_CS, $pa_startup_32
|
2012-05-09 02:22:28 +08:00
|
|
|
|
|
|
|
no_longmode:
|
|
|
|
hlt
|
|
|
|
jmp no_longmode
|
2019-10-11 19:51:02 +08:00
|
|
|
SYM_CODE_END(trampoline_start)
|
|
|
|
|
2012-05-09 02:22:28 +08:00
|
|
|
#include "../kernel/verify_cpu.S"
|
|
|
|
|
2012-05-09 02:22:33 +08:00
|
|
|
.section ".text32","ax"
|
2012-05-09 02:22:28 +08:00
|
|
|
.code32
|
|
|
|
.balign 4
|
2019-10-11 19:51:02 +08:00
|
|
|
SYM_CODE_START(startup_32)
|
2012-05-09 02:22:40 +08:00
|
|
|
movl %edx, %ss
|
|
|
|
addl $pa_real_mode_base, %esp
|
|
|
|
movl %edx, %ds
|
|
|
|
movl %edx, %es
|
|
|
|
movl %edx, %fs
|
|
|
|
movl %edx, %gs
|
2012-05-09 02:22:28 +08:00
|
|
|
|
2017-07-18 05:10:25 +08:00
|
|
|
/*
|
|
|
|
* Check for memory encryption support. This is a safety net in
|
|
|
|
* case BIOS hasn't done the necessary step of setting the bit in
|
|
|
|
* the MSR for this AP. If SME is active and we've gotten this far
|
|
|
|
* then it is safe for us to set the MSR bit and continue. If we
|
|
|
|
* don't we'll eventually crash trying to execute encrypted
|
|
|
|
* instructions.
|
|
|
|
*/
|
2018-02-19 23:06:14 +08:00
|
|
|
btl $TH_FLAGS_SME_ACTIVE_BIT, pa_tr_flags
|
2017-07-18 05:10:25 +08:00
|
|
|
jnc .Ldone
|
|
|
|
movl $MSR_K8_SYSCFG, %ecx
|
|
|
|
rdmsr
|
|
|
|
bts $MSR_K8_SYSCFG_MEM_ENCRYPT_BIT, %eax
|
|
|
|
jc .Ldone
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Memory encryption is enabled but the SME enable bit for this
|
|
|
|
* CPU has has not been set. It is safe to set it, so do so.
|
|
|
|
*/
|
|
|
|
wrmsr
|
|
|
|
.Ldone:
|
|
|
|
|
2012-05-09 02:22:46 +08:00
|
|
|
movl pa_tr_cr4, %eax
|
2012-05-09 02:22:28 +08:00
|
|
|
movl %eax, %cr4 # Enable PAE mode
|
|
|
|
|
2012-05-09 02:22:40 +08:00
|
|
|
# Setup trampoline 4 level pagetables
|
2012-05-09 02:22:43 +08:00
|
|
|
movl $pa_trampoline_pgd, %eax
|
2012-05-09 02:22:28 +08:00
|
|
|
movl %eax, %cr3
|
|
|
|
|
2012-05-09 02:22:46 +08:00
|
|
|
# Set up EFER
|
|
|
|
movl pa_tr_efer, %eax
|
|
|
|
movl pa_tr_efer + 4, %edx
|
2012-05-09 02:22:28 +08:00
|
|
|
movl $MSR_EFER, %ecx
|
|
|
|
wrmsr
|
|
|
|
|
|
|
|
# Enable paging and in turn activate Long Mode
|
2012-05-09 02:22:40 +08:00
|
|
|
movl $(X86_CR0_PG | X86_CR0_WP | X86_CR0_PE), %eax
|
2012-05-09 02:22:28 +08:00
|
|
|
movl %eax, %cr0
|
|
|
|
|
|
|
|
/*
|
|
|
|
* At this point we're in long mode but in 32bit compatibility mode
|
|
|
|
* with EFER.LME = 1, CS.L = 0, CS.D = 1 (and in turn
|
|
|
|
* EFER.LMA = 1). Now we want to jump in 64bit mode, to do that we use
|
|
|
|
* the new gdt/idt that has __KERNEL_CS with CS.L = 1.
|
|
|
|
*/
|
2012-05-09 02:22:35 +08:00
|
|
|
ljmpl $__KERNEL_CS, $pa_startup_64
|
2019-10-11 19:51:02 +08:00
|
|
|
SYM_CODE_END(startup_32)
|
2012-05-09 02:22:28 +08:00
|
|
|
|
2012-05-09 02:22:33 +08:00
|
|
|
.section ".text64","ax"
|
2012-05-09 02:22:28 +08:00
|
|
|
.code64
|
|
|
|
.balign 4
|
2019-10-11 19:51:02 +08:00
|
|
|
SYM_CODE_START(startup_64)
|
2012-05-09 02:22:28 +08:00
|
|
|
# Now jump into the kernel using virtual addresses
|
2012-05-09 02:22:43 +08:00
|
|
|
jmpq *tr_start(%rip)
|
2019-10-11 19:51:02 +08:00
|
|
|
SYM_CODE_END(startup_64)
|
2012-05-09 02:22:28 +08:00
|
|
|
|
2012-05-17 04:44:10 +08:00
|
|
|
.section ".rodata","a"
|
|
|
|
# Duplicate the global descriptor table
|
|
|
|
# so the kernel can live anywhere
|
|
|
|
.balign 16
|
2019-10-11 19:50:58 +08:00
|
|
|
SYM_DATA_START(tr_gdt)
|
2012-05-17 04:44:10 +08:00
|
|
|
.short tr_gdt_end - tr_gdt - 1 # gdt limit
|
|
|
|
.long pa_tr_gdt
|
|
|
|
.short 0
|
|
|
|
.quad 0x00cf9b000000ffff # __KERNEL32_CS
|
|
|
|
.quad 0x00af9b000000ffff # __KERNEL_CS
|
|
|
|
.quad 0x00cf93000000ffff # __KERNEL_DS
|
2019-10-11 19:50:58 +08:00
|
|
|
SYM_DATA_END_LABEL(tr_gdt, SYM_L_LOCAL, tr_gdt_end)
|
2012-05-17 04:44:10 +08:00
|
|
|
|
|
|
|
.bss
|
|
|
|
.balign PAGE_SIZE
|
2019-10-11 19:50:58 +08:00
|
|
|
SYM_DATA(trampoline_pgd, .space PAGE_SIZE)
|
2012-05-17 04:44:10 +08:00
|
|
|
|
|
|
|
.balign 8
|
2019-10-11 19:50:58 +08:00
|
|
|
SYM_DATA_START(trampoline_header)
|
|
|
|
SYM_DATA_LOCAL(tr_start, .space 8)
|
|
|
|
SYM_DATA(tr_efer, .space 8)
|
|
|
|
SYM_DATA(tr_cr4, .space 4)
|
|
|
|
SYM_DATA(tr_flags, .space 4)
|
|
|
|
SYM_DATA_END(trampoline_header)
|
2012-05-17 04:44:10 +08:00
|
|
|
|
2012-05-09 02:22:43 +08:00
|
|
|
#include "trampoline_common.S"
|