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 21:07:57 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2008-10-23 12:26:29 +07:00
|
|
|
#ifndef _ASM_X86_PGTABLE_2LEVEL_H
|
|
|
|
#define _ASM_X86_PGTABLE_2LEVEL_H
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#define pte_ERROR(e) \
|
2012-05-22 09:50:07 +07:00
|
|
|
pr_err("%s:%d: bad pte %08lx\n", __FILE__, __LINE__, (e).pte_low)
|
2005-04-17 05:20:36 +07:00
|
|
|
#define pgd_ERROR(e) \
|
2012-05-22 09:50:07 +07:00
|
|
|
pr_err("%s:%d: bad pgd %08lx\n", __FILE__, __LINE__, pgd_val(e))
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Certain architectures need to do special things when PTEs
|
|
|
|
* within a page table are directly modified. Thus, the following
|
|
|
|
* hook is made available.
|
|
|
|
*/
|
2007-05-03 00:27:13 +07:00
|
|
|
static inline void native_set_pte(pte_t *ptep , pte_t pte)
|
|
|
|
{
|
|
|
|
*ptep = pte;
|
|
|
|
}
|
2008-01-30 19:32:58 +07:00
|
|
|
|
2007-05-03 00:27:13 +07:00
|
|
|
static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
|
|
|
|
{
|
|
|
|
*pmdp = pmd;
|
|
|
|
}
|
2006-12-07 08:14:08 +07:00
|
|
|
|
2017-02-25 05:57:02 +07:00
|
|
|
static inline void native_set_pud(pud_t *pudp, pud_t pud)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-01-30 19:32:58 +07:00
|
|
|
static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
|
|
|
|
{
|
|
|
|
native_set_pte(ptep, pte);
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-01-30 19:32:58 +07:00
|
|
|
static inline void native_pmd_clear(pmd_t *pmdp)
|
|
|
|
{
|
|
|
|
native_set_pmd(pmdp, __pmd(0));
|
|
|
|
}
|
[PATCH] x86/PAE: Fix pte_clear for the >4GB RAM case
Proposed fix for ptep_get_and_clear_full PAE bug. Pte_clear had the same bug,
so use the same fix for both. Turns out pmd_clear had it as well, but pgds
are not affected.
The problem is rather intricate. Page table entries in PAE mode are 64-bits
wide, but the only atomic 8-byte write operation available in 32-bit mode is
cmpxchg8b, which is expensive (at least on P4), and thus avoided. But it can
happen that the processor may prefetch entries into the TLB in the middle of an
operation which clears a page table entry. So one must always clear the P-bit
in the low word of the page table entry first when clearing it.
Since the sequence *ptep = __pte(0) leaves the order of the write dependent on
the compiler, it must be coded explicitly as a clear of the low word followed
by a clear of the high word. Further, there must be a write memory barrier
here to enforce proper ordering by the compiler (and, in the future, by the
processor as well).
On > 4GB memory machines, the implementation of pte_clear for PAE was clearly
deficient, as it could leave virtual mappings of physical memory above 4GB
aliased to memory below 4GB in the TLB. The implementation of
ptep_get_and_clear_full has a similar bug, although not nearly as likely to
occur, since the mappings being cleared are in the process of being destroyed,
and should never be dereferenced again.
But, as luck would have it, it is possible to trigger bugs even without ever
dereferencing these bogus TLB mappings, even if the clear is followed fairly
soon after with a TLB flush or invalidation. The problem is that memory above
4GB may now be aliased into the first 4GB of memory, and in fact, may hit a
region of memory with non-memory semantics. These regions include AGP and PCI
space. As such, these memory regions are not cached by the processor. This
introduces the bug.
The processor can speculate memory operations, including memory writes, as long
as they are committed with the proper ordering. Speculating a memory write to
a linear address that has a bogus TLB mapping is possible. Normally, the
speculation is harmless. But for cached memory, it does leave the falsely
speculated cacheline unmodified, but in a dirty state. This cache line will be
eventually written back. If this cacheline happens to intersect a region of
memory that is not protected by the cache coherency protocol, it can corrupt
data in I/O memory, which is generally a very bad thing to do, and can cause
total system failure or just plain undefined behavior.
These bugs are extremely unlikely, but the severity is of such magnitude, and
the fix so simple that I think fixing them immediately is justified. Also,
they are nearly impossible to debug.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-28 01:32:29 +07:00
|
|
|
|
2017-02-25 05:57:02 +07:00
|
|
|
static inline void native_pud_clear(pud_t *pudp)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-03-23 15:03:08 +07:00
|
|
|
static inline void native_pte_clear(struct mm_struct *mm,
|
|
|
|
unsigned long addr, pte_t *xp)
|
2007-05-03 00:27:19 +07:00
|
|
|
{
|
2008-01-30 19:32:58 +07:00
|
|
|
*xp = native_make_pte(0);
|
2007-05-03 00:27:19 +07:00
|
|
|
}
|
|
|
|
|
2007-05-03 00:27:19 +07:00
|
|
|
#ifdef CONFIG_SMP
|
2007-05-03 00:27:13 +07:00
|
|
|
static inline pte_t native_ptep_get_and_clear(pte_t *xp)
|
|
|
|
{
|
|
|
|
return __pte(xchg(&xp->pte_low, 0));
|
|
|
|
}
|
2007-05-03 00:27:19 +07:00
|
|
|
#else
|
|
|
|
#define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)
|
|
|
|
#endif
|
2006-09-26 13:32:30 +07:00
|
|
|
|
2011-01-14 06:47:01 +07:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp)
|
|
|
|
{
|
|
|
|
return __pmd(xchg((pmdval_t *)xp, 0));
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define native_pmdp_get_and_clear(xp) native_local_pmdp_get_and_clear(xp)
|
|
|
|
#endif
|
|
|
|
|
2017-02-25 05:57:02 +07:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
static inline pud_t native_pudp_get_and_clear(pud_t *xp)
|
|
|
|
{
|
|
|
|
return __pud(xchg((pudval_t *)xp, 0));
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define native_pudp_get_and_clear(xp) native_local_pudp_get_and_clear(xp)
|
|
|
|
#endif
|
|
|
|
|
2013-11-16 05:14:00 +07:00
|
|
|
/* Bit manipulation helper on pte/pgoff entry */
|
|
|
|
static inline unsigned long pte_bitop(unsigned long value, unsigned int rightshift,
|
|
|
|
unsigned long mask, unsigned int leftshift)
|
|
|
|
{
|
|
|
|
return ((value >> rightshift) & mask) << leftshift;
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/* Encode and de-code a swap entry */
|
2015-02-11 05:11:22 +07:00
|
|
|
#define SWP_TYPE_BITS 5
|
2008-12-16 18:35:24 +07:00
|
|
|
#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1)
|
|
|
|
|
|
|
|
#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS)
|
|
|
|
|
|
|
|
#define __swp_type(x) (((x).val >> (_PAGE_BIT_PRESENT + 1)) \
|
|
|
|
& ((1U << SWP_TYPE_BITS) - 1))
|
|
|
|
#define __swp_offset(x) ((x).val >> SWP_OFFSET_SHIFT)
|
|
|
|
#define __swp_entry(type, offset) ((swp_entry_t) { \
|
|
|
|
((type) << (_PAGE_BIT_PRESENT + 1)) \
|
|
|
|
| ((offset) << SWP_OFFSET_SHIFT) })
|
2005-04-17 05:20:36 +07:00
|
|
|
#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low })
|
2008-01-30 19:32:57 +07:00
|
|
|
#define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val })
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2018-06-14 05:48:24 +07:00
|
|
|
/* No inverted PFNs on 2 level page tables */
|
|
|
|
|
|
|
|
static inline u64 protnone_mask(u64 val)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u64 flip_protnone_guard(u64 oldval, u64 val, u64 mask)
|
|
|
|
{
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool __pte_needs_invert(u64 val)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-10-23 12:26:29 +07:00
|
|
|
#endif /* _ASM_X86_PGTABLE_2LEVEL_H */
|