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 14:07:57 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2008-02-23 08:58:20 +00:00
|
|
|
/*
|
|
|
|
* linux/arch/i386/kernel/head32.c -- prepare to run common code
|
|
|
|
*
|
|
|
|
* Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE
|
|
|
|
* Copyright (C) 2007 Eric Biederman <ebiederm@xmission.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/start_kernel.h>
|
x86: Make sure free_init_pages() frees pages on page boundary
When CONFIG_NO_BOOTMEM=y, it could use memory more effiently, or
in a more compact fashion.
Example:
Allocated new RAMDISK: 00ec2000 - 0248ce57
Move RAMDISK from 000000002ea04000 - 000000002ffcee56 to 00ec2000 - 0248ce56
The new RAMDISK's end is not page aligned.
Last page could be shared with other users.
When free_init_pages are called for initrd or .init, the page
could be freed and we could corrupt other data.
code segment in free_init_pages():
| for (; addr < end; addr += PAGE_SIZE) {
| ClearPageReserved(virt_to_page(addr));
| init_page_count(virt_to_page(addr));
| memset((void *)(addr & ~(PAGE_SIZE-1)),
| POISON_FREE_INITMEM, PAGE_SIZE);
| free_page(addr);
| totalram_pages++;
| }
last half page could be used as one whole free page.
So page align the boundaries.
-v2: make the original initramdisk to be aligned, according to
Johannes, otherwise we have the chance to lose one page.
we still need to keep initrd_end not aligned, otherwise it could
confuse decompressor.
-v3: change to WARN_ON instead, suggested by Johannes.
-v4: use PAGE_ALIGN, suggested by Johannes.
We may fix that macro name later to PAGE_ALIGN_UP, and PAGE_ALIGN_DOWN
Add comments about assuming ramdisk start is aligned
in relocate_initrd(), change to re get ramdisk_image instead of save it
to make diff smaller. Add warning for wrong range, suggested by Johannes.
-v6: remove one WARN()
We need to align beginning in free_init_pages()
do not copy more than ramdisk_size, noticed by Johannes
Reported-by: Stanislaw Gruszka <sgruszka@redhat.com>
Tested-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: David Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <1269830604-26214-3-git-send-email-yinghai@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-03-29 02:42:55 +00:00
|
|
|
#include <linux/mm.h>
|
2010-08-25 20:39:17 +00:00
|
|
|
#include <linux/memblock.h>
|
2008-02-23 08:58:20 +00:00
|
|
|
|
2017-08-28 06:47:48 +00:00
|
|
|
#include <asm/desc.h>
|
2008-05-18 08:18:57 +00:00
|
|
|
#include <asm/setup.h>
|
|
|
|
#include <asm/sections.h>
|
2017-01-27 09:27:10 +00:00
|
|
|
#include <asm/e820/api.h>
|
2009-08-19 12:36:27 +00:00
|
|
|
#include <asm/page.h>
|
2009-08-20 07:27:29 +00:00
|
|
|
#include <asm/apic.h>
|
|
|
|
#include <asm/io_apic.h>
|
2009-08-29 13:03:59 +00:00
|
|
|
#include <asm/bios_ebda.h>
|
2010-08-28 13:58:33 +00:00
|
|
|
#include <asm/tlbflush.h>
|
2013-01-29 09:05:24 +00:00
|
|
|
#include <asm/bootparam_utils.h>
|
2009-08-29 13:03:59 +00:00
|
|
|
|
|
|
|
static void __init i386_default_early_setup(void)
|
|
|
|
{
|
2010-06-11 10:17:00 +00:00
|
|
|
/* Initialize 32bit specific setup functions */
|
2009-08-29 13:03:59 +00:00
|
|
|
x86_init.resources.reserve_resources = i386_reserve_resources;
|
|
|
|
x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc;
|
|
|
|
}
|
2008-05-18 08:18:57 +00:00
|
|
|
|
2014-05-01 22:44:37 +00:00
|
|
|
asmlinkage __visible void __init i386_start_kernel(void)
|
2008-02-23 08:58:20 +00:00
|
|
|
{
|
2017-10-16 10:12:16 +00:00
|
|
|
/* Make sure IDT is set up before any exception happens */
|
2017-08-28 06:47:48 +00:00
|
|
|
idt_setup_early_handler();
|
|
|
|
|
2017-10-16 10:12:16 +00:00
|
|
|
cr4_init_shadow();
|
|
|
|
|
2013-01-29 09:05:24 +00:00
|
|
|
sanitize_boot_params(&boot_params);
|
|
|
|
|
2016-04-14 00:04:34 +00:00
|
|
|
x86_early_init_platform_quirks();
|
|
|
|
|
2009-08-29 13:03:59 +00:00
|
|
|
/* Call the subarch specific early setup function */
|
|
|
|
switch (boot_params.hdr.hardware_subarch) {
|
2013-10-17 22:35:29 +00:00
|
|
|
case X86_SUBARCH_INTEL_MID:
|
|
|
|
x86_intel_mid_early_setup();
|
2009-08-29 12:54:20 +00:00
|
|
|
break;
|
2010-11-09 20:08:04 +00:00
|
|
|
case X86_SUBARCH_CE4100:
|
|
|
|
x86_ce4100_early_setup();
|
|
|
|
break;
|
2009-08-29 13:03:59 +00:00
|
|
|
default:
|
|
|
|
i386_default_early_setup();
|
|
|
|
break;
|
|
|
|
}
|
2008-05-18 08:18:57 +00:00
|
|
|
|
2008-02-23 08:58:20 +00:00
|
|
|
start_kernel();
|
|
|
|
}
|
2016-12-08 16:44:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize page tables. This creates a PDE and a set of page
|
|
|
|
* tables, which are located immediately beyond __brk_base. The variable
|
|
|
|
* _brk_end is set up to point to the first "safe" location.
|
|
|
|
* Mappings are created both at virtual address 0 (identity mapping)
|
|
|
|
* and PAGE_OFFSET for up to _end.
|
|
|
|
*
|
|
|
|
* In PAE mode initial_page_table is statically defined to contain
|
|
|
|
* enough entries to cover the VMSPLIT option (that is the top 1, 2 or 3
|
|
|
|
* entries). The identity mapping is handled by pointing two PGD entries
|
|
|
|
* to the first kernel PMD. Note the upper half of each PMD or PTE are
|
|
|
|
* always zero at this stage.
|
|
|
|
*/
|
|
|
|
void __init mk_early_pgtbl_32(void)
|
|
|
|
{
|
|
|
|
#ifdef __pa
|
|
|
|
#undef __pa
|
|
|
|
#endif
|
|
|
|
#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
|
|
|
|
pte_t pte, *ptep;
|
|
|
|
int i;
|
|
|
|
unsigned long *ptr;
|
|
|
|
/* Enough space to fit pagetables for the low memory linear map */
|
|
|
|
const unsigned long limit = __pa(_end) +
|
|
|
|
(PAGE_TABLE_SIZE(LOWMEM_PAGES) << PAGE_SHIFT);
|
|
|
|
#ifdef CONFIG_X86_PAE
|
|
|
|
pmd_t pl2, *pl2p = (pmd_t *)__pa(initial_pg_pmd);
|
|
|
|
#define SET_PL2(pl2, val) { (pl2).pmd = (val); }
|
|
|
|
#else
|
|
|
|
pgd_t pl2, *pl2p = (pgd_t *)__pa(initial_page_table);
|
|
|
|
#define SET_PL2(pl2, val) { (pl2).pgd = (val); }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ptep = (pte_t *)__pa(__brk_base);
|
|
|
|
pte.pte = PTE_IDENT_ATTR;
|
|
|
|
|
|
|
|
while ((pte.pte & PTE_PFN_MASK) < limit) {
|
|
|
|
|
|
|
|
SET_PL2(pl2, (unsigned long)ptep | PDE_IDENT_ATTR);
|
|
|
|
*pl2p = pl2;
|
|
|
|
#ifndef CONFIG_X86_PAE
|
|
|
|
/* Kernel PDE entry */
|
|
|
|
*(pl2p + ((PAGE_OFFSET >> PGDIR_SHIFT))) = pl2;
|
|
|
|
#endif
|
|
|
|
for (i = 0; i < PTRS_PER_PTE; i++) {
|
|
|
|
*ptep = pte;
|
|
|
|
pte.pte += PAGE_SIZE;
|
|
|
|
ptep++;
|
|
|
|
}
|
|
|
|
|
|
|
|
pl2p++;
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr = (unsigned long *)__pa(&max_pfn_mapped);
|
|
|
|
/* Can't use pte_pfn() since it's a call with CONFIG_PARAVIRT */
|
|
|
|
*ptr = (pte.pte & PTE_PFN_MASK) >> PAGE_SHIFT;
|
|
|
|
|
|
|
|
ptr = (unsigned long *)__pa(&_brk_end);
|
|
|
|
*ptr = (unsigned long)ptep + PAGE_OFFSET;
|
|
|
|
}
|
|
|
|
|