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-04-20 21:45:54 +08:00
|
|
|
#
|
|
|
|
# Makefile for the linux kernel.
|
|
|
|
#
|
|
|
|
|
2014-11-18 19:41:27 +08:00
|
|
|
CFLAGS_armv8_deprecated.o := -I$(src)
|
2012-04-20 21:45:54 +08:00
|
|
|
|
2019-02-08 23:10:07 +08:00
|
|
|
CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE)
|
|
|
|
CFLAGS_REMOVE_insn.o = $(CC_FLAGS_FTRACE)
|
|
|
|
CFLAGS_REMOVE_return_address.o = $(CC_FLAGS_FTRACE)
|
2014-04-30 17:54:33 +08:00
|
|
|
|
2021-04-02 07:23:46 +08:00
|
|
|
# Remove stack protector to avoid triggering unneeded stack canary
|
|
|
|
# checks due to randomize_kstack_offset.
|
|
|
|
CFLAGS_REMOVE_syscall.o = -fstack-protector -fstack-protector-strong
|
|
|
|
CFLAGS_syscall.o += -fno-stack-protector
|
|
|
|
|
2022-05-23 22:51:51 +08:00
|
|
|
# When KASAN is enabled, a stack trace is recorded for every alloc/free, which
|
|
|
|
# can significantly impact performance. Avoid instrumenting the stack trace
|
|
|
|
# collection code to minimize this impact.
|
|
|
|
KASAN_SANITIZE_stacktrace.o := n
|
|
|
|
|
2021-06-07 17:46:23 +08:00
|
|
|
# It's not safe to invoke KCOV when portions of the kernel environment aren't
|
|
|
|
# available or are out-of-sync with HW state. Since `noinstr` doesn't always
|
|
|
|
# inhibit KCOV instrumentation, disable it for the entire compilation unit.
|
2021-07-15 20:30:49 +08:00
|
|
|
KCOV_INSTRUMENT_entry-common.o := n
|
2021-06-07 17:46:24 +08:00
|
|
|
KCOV_INSTRUMENT_idle.o := n
|
2021-06-07 17:46:23 +08:00
|
|
|
|
2012-04-20 21:45:54 +08:00
|
|
|
# Object file lists.
|
2019-01-04 08:18:41 +08:00
|
|
|
obj-y := debug-monitors.o entry.o irq.o fpsimd.o \
|
2019-10-26 00:42:13 +08:00
|
|
|
entry-common.o entry-fpsimd.o process.o ptrace.o \
|
|
|
|
setup.o signal.o sys.o stacktrace.o time.o traps.o \
|
2021-03-04 01:05:32 +08:00
|
|
|
io.o vdso.o hyp-stub.o psci.o cpu_ops.o \
|
2015-02-25 20:10:35 +08:00
|
|
|
return_address.o cpuinfo.o cpu_errata.o \
|
2015-05-30 01:28:44 +08:00
|
|
|
cpufeature.o alternative.o cacheinfo.o \
|
2018-07-11 21:56:43 +08:00
|
|
|
smp.o smp_spin_table.o topology.o smccc-call.o \
|
2021-06-24 21:03:24 +08:00
|
|
|
syscall.o proton-pack.o idreg-override.o idle.o \
|
|
|
|
patching.o
|
2012-04-20 21:45:54 +08:00
|
|
|
|
2020-03-05 13:20:52 +08:00
|
|
|
targets += efi-entry.o
|
2015-10-09 03:02:04 +08:00
|
|
|
|
|
|
|
OBJCOPYFLAGS := --prefix-symbols=__efistub_
|
|
|
|
$(obj)/%.stub.o: $(obj)/%.o FORCE
|
|
|
|
$(call if_changed,objcopy)
|
|
|
|
|
2019-04-15 17:49:37 +08:00
|
|
|
obj-$(CONFIG_COMPAT) += sys32.o signal32.o \
|
2019-06-21 17:52:42 +08:00
|
|
|
sys_compat.o
|
|
|
|
obj-$(CONFIG_COMPAT) += sigreturn32.o
|
2019-04-15 17:49:37 +08:00
|
|
|
obj-$(CONFIG_KUSER_HELPERS) += kuser32.o
|
2019-01-04 08:18:41 +08:00
|
|
|
obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o
|
|
|
|
obj-$(CONFIG_MODULES) += module.o
|
|
|
|
obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o
|
|
|
|
obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o
|
|
|
|
obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
|
|
|
|
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
|
|
|
|
obj-$(CONFIG_CPU_PM) += sleep.o suspend.o
|
|
|
|
obj-$(CONFIG_CPU_IDLE) += cpuidle.o
|
|
|
|
obj-$(CONFIG_JUMP_LABEL) += jump_label.o
|
|
|
|
obj-$(CONFIG_KGDB) += kgdb.o
|
|
|
|
obj-$(CONFIG_EFI) += efi.o efi-entry.stub.o \
|
2018-03-08 16:00:13 +08:00
|
|
|
efi-rt-wrapper.o
|
2019-01-04 08:18:41 +08:00
|
|
|
obj-$(CONFIG_PCI) += pci.o
|
|
|
|
obj-$(CONFIG_ARMV8_DEPRECATED) += armv8_deprecated.o
|
|
|
|
obj-$(CONFIG_ACPI) += acpi.o
|
|
|
|
obj-$(CONFIG_ACPI_NUMA) += acpi_numa.o
|
|
|
|
obj-$(CONFIG_ARM64_ACPI_PARKING_PROTOCOL) += acpi_parking_protocol.o
|
|
|
|
obj-$(CONFIG_PARAVIRT) += paravirt.o
|
arm64: head: avoid relocating the kernel twice for KASLR
Currently, when KASLR is in effect, we set up the kernel virtual address
space twice: the first time, the KASLR seed is looked up in the device
tree, and the kernel virtual mapping is torn down and recreated again,
after which the relocations are applied a second time. The latter step
means that statically initialized global pointer variables will be reset
to their initial values, and to ensure that BSS variables are not set to
values based on the initial translation, they are cleared again as well.
All of this is needed because we need the command line (taken from the
DT) to tell us whether or not to randomize the virtual address space
before entering the kernel proper. However, this code has expanded
little by little and now creates global state unrelated to the virtual
randomization of the kernel before the mapping is torn down and set up
again, and the BSS cleared for a second time. This has created some
issues in the past, and it would be better to avoid this little dance if
possible.
So instead, let's use the temporary mapping of the device tree, and
execute the bare minimum of code to decide whether or not KASLR should
be enabled, and what the seed is. Only then, create the virtual kernel
mapping, clear BSS, etc and proceed as normal. This avoids the issues
around inconsistent global state due to BSS being cleared twice, and is
generally more maintainable, as it permits us to defer all the remaining
DT parsing and KASLR initialization to a later time.
This means the relocation fixup code runs only a single time as well,
allowing us to simplify the RELR handling code too, which is not
idempotent and was therefore required to keep track of the offset that
was applied the first time around.
Note that this means we have to clone a pair of FDT library objects, so
that we can control how they are built - we need the stack protector
and other instrumentation disabled so that the code can tolerate being
called this early. Note that only the kernel page tables and the
temporary stack are mapped read-write at this point, which ensures that
the early code does not modify any global state inadvertently.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20220624150651.1358849-21-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
2022-06-24 23:06:50 +08:00
|
|
|
obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o pi/
|
2019-01-04 08:18:41 +08:00
|
|
|
obj-$(CONFIG_HIBERNATION) += hibernate.o hibernate-asm.o
|
2022-02-01 00:54:55 +08:00
|
|
|
obj-$(CONFIG_ELF_CORE) += elfcore.o
|
2019-01-04 08:18:41 +08:00
|
|
|
obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o \
|
2016-06-24 01:54:48 +08:00
|
|
|
cpu-reset.o
|
2019-01-04 08:18:41 +08:00
|
|
|
obj-$(CONFIG_KEXEC_FILE) += machine_kexec_file.o kexec_image.o
|
|
|
|
obj-$(CONFIG_ARM64_RELOC_TEST) += arm64-reloc-test.o
|
2017-03-31 15:55:33 +08:00
|
|
|
arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o
|
2019-01-04 08:18:41 +08:00
|
|
|
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
|
|
|
|
obj-$(CONFIG_CRASH_CORE) += crash_core.o
|
|
|
|
obj-$(CONFIG_ARM_SDE_INTERFACE) += sdei.o
|
|
|
|
obj-$(CONFIG_ARM64_PTR_AUTH) += pointer_auth.o
|
2019-09-16 18:51:17 +08:00
|
|
|
obj-$(CONFIG_ARM64_MTE) += mte.o
|
2020-12-18 10:45:40 +08:00
|
|
|
obj-y += vdso-wrap.o
|
|
|
|
obj-$(CONFIG_COMPAT_VDSO) += vdso32-wrap.o
|
2012-04-20 21:45:54 +08:00
|
|
|
|
2022-05-10 18:27:21 +08:00
|
|
|
# Force dependency (vdso*-wrap.S includes vdso.so through incbin)
|
|
|
|
$(obj)/vdso-wrap.o: $(obj)/vdso/vdso.so
|
|
|
|
$(obj)/vdso32-wrap.o: $(obj)/vdso32/vdso.so
|
|
|
|
|
2020-12-18 10:45:40 +08:00
|
|
|
obj-y += probes/
|
2012-04-20 21:45:54 +08:00
|
|
|
head-y := head.o
|
2015-10-09 03:02:04 +08:00
|
|
|
extra-y += $(head-y) vmlinux.lds
|
2017-02-03 01:33:19 +08:00
|
|
|
|
|
|
|
ifeq ($(CONFIG_DEBUG_EFI),y)
|
|
|
|
AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(objtree)/vmlinux)\""
|
|
|
|
endif
|
2021-10-13 14:36:22 +08:00
|
|
|
|
|
|
|
# for cleaning
|
|
|
|
subdir- += vdso vdso32
|