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 */
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2000, 2002-2003 Hewlett-Packard Co
|
|
|
|
* David Mosberger-Tang <davidm@hpl.hp.com>
|
|
|
|
*
|
|
|
|
* Kernel unwind support.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define UNW_VER(x) ((x) >> 48)
|
|
|
|
#define UNW_FLAG_MASK 0x0000ffff00000000
|
|
|
|
#define UNW_FLAG_OSMASK 0x0000f00000000000
|
|
|
|
#define UNW_FLAG_EHANDLER(x) ((x) & 0x0000000100000000L)
|
|
|
|
#define UNW_FLAG_UHANDLER(x) ((x) & 0x0000000200000000L)
|
|
|
|
#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffL)
|
|
|
|
|
|
|
|
enum unw_register_index {
|
|
|
|
/* primary unat: */
|
|
|
|
UNW_REG_PRI_UNAT_GR,
|
|
|
|
UNW_REG_PRI_UNAT_MEM,
|
|
|
|
|
|
|
|
/* register stack */
|
|
|
|
UNW_REG_BSP, /* register stack pointer */
|
|
|
|
UNW_REG_BSPSTORE,
|
|
|
|
UNW_REG_PFS, /* previous function state */
|
|
|
|
UNW_REG_RNAT,
|
|
|
|
/* memory stack */
|
|
|
|
UNW_REG_PSP, /* previous memory stack pointer */
|
|
|
|
/* return pointer: */
|
|
|
|
UNW_REG_RP,
|
|
|
|
|
|
|
|
/* preserved registers: */
|
|
|
|
UNW_REG_R4, UNW_REG_R5, UNW_REG_R6, UNW_REG_R7,
|
|
|
|
UNW_REG_UNAT, UNW_REG_PR, UNW_REG_LC, UNW_REG_FPSR,
|
|
|
|
UNW_REG_B1, UNW_REG_B2, UNW_REG_B3, UNW_REG_B4, UNW_REG_B5,
|
|
|
|
UNW_REG_F2, UNW_REG_F3, UNW_REG_F4, UNW_REG_F5,
|
|
|
|
UNW_REG_F16, UNW_REG_F17, UNW_REG_F18, UNW_REG_F19,
|
|
|
|
UNW_REG_F20, UNW_REG_F21, UNW_REG_F22, UNW_REG_F23,
|
|
|
|
UNW_REG_F24, UNW_REG_F25, UNW_REG_F26, UNW_REG_F27,
|
|
|
|
UNW_REG_F28, UNW_REG_F29, UNW_REG_F30, UNW_REG_F31,
|
|
|
|
UNW_NUM_REGS
|
|
|
|
};
|
|
|
|
|
|
|
|
struct unw_info_block {
|
|
|
|
u64 header;
|
|
|
|
u64 desc[0]; /* unwind descriptors */
|
|
|
|
/* personality routine and language-specific data follow behind descriptors */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct unw_table {
|
|
|
|
struct unw_table *next; /* must be first member! */
|
|
|
|
const char *name;
|
|
|
|
unsigned long gp; /* global pointer for this load-module */
|
|
|
|
unsigned long segment_base; /* base for offsets in the unwind table entries */
|
|
|
|
unsigned long start;
|
|
|
|
unsigned long end;
|
|
|
|
const struct unw_table_entry *array;
|
|
|
|
unsigned long length;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum unw_where {
|
|
|
|
UNW_WHERE_NONE, /* register isn't saved at all */
|
|
|
|
UNW_WHERE_GR, /* register is saved in a general register */
|
|
|
|
UNW_WHERE_FR, /* register is saved in a floating-point register */
|
|
|
|
UNW_WHERE_BR, /* register is saved in a branch register */
|
|
|
|
UNW_WHERE_SPREL, /* register is saved on memstack (sp-relative) */
|
|
|
|
UNW_WHERE_PSPREL, /* register is saved on memstack (psp-relative) */
|
|
|
|
/*
|
|
|
|
* At the end of each prologue these locations get resolved to
|
|
|
|
* UNW_WHERE_PSPREL and UNW_WHERE_GR, respectively:
|
|
|
|
*/
|
|
|
|
UNW_WHERE_SPILL_HOME, /* register is saved in its spill home */
|
|
|
|
UNW_WHERE_GR_SAVE /* register is saved in next general register */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define UNW_WHEN_NEVER 0x7fffffff
|
|
|
|
|
|
|
|
struct unw_reg_info {
|
|
|
|
unsigned long val; /* save location: register number or offset */
|
|
|
|
enum unw_where where; /* where the register gets saved */
|
|
|
|
int when; /* when the register gets saved */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct unw_reg_state {
|
|
|
|
struct unw_reg_state *next; /* next (outer) element on state stack */
|
|
|
|
struct unw_reg_info reg[UNW_NUM_REGS]; /* register save locations */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct unw_labeled_state {
|
|
|
|
struct unw_labeled_state *next; /* next labeled state (or NULL) */
|
|
|
|
unsigned long label; /* label for this state */
|
|
|
|
struct unw_reg_state saved_state;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct unw_state_record {
|
|
|
|
unsigned int first_region : 1; /* is this the first region? */
|
|
|
|
unsigned int done : 1; /* are we done scanning descriptors? */
|
|
|
|
unsigned int any_spills : 1; /* got any register spills? */
|
|
|
|
unsigned int in_body : 1; /* are we inside a body (as opposed to a prologue)? */
|
|
|
|
unsigned long flags; /* see UNW_FLAG_* in unwind.h */
|
|
|
|
|
|
|
|
u8 *imask; /* imask of spill_mask record or NULL */
|
|
|
|
unsigned long pr_val; /* predicate values */
|
|
|
|
unsigned long pr_mask; /* predicate mask */
|
|
|
|
long spill_offset; /* psp-relative offset for spill base */
|
|
|
|
int region_start;
|
|
|
|
int region_len;
|
|
|
|
int epilogue_start;
|
|
|
|
int epilogue_count;
|
|
|
|
int when_target;
|
|
|
|
|
|
|
|
u8 gr_save_loc; /* next general register to use for saving a register */
|
|
|
|
u8 return_link_reg; /* branch register in which the return link is passed */
|
|
|
|
|
|
|
|
struct unw_labeled_state *labeled_states; /* list of all labeled states */
|
|
|
|
struct unw_reg_state curr; /* current state */
|
|
|
|
};
|
|
|
|
|
|
|
|
enum unw_nat_type {
|
|
|
|
UNW_NAT_NONE, /* NaT not represented */
|
|
|
|
UNW_NAT_VAL, /* NaT represented by NaT value (fp reg) */
|
|
|
|
UNW_NAT_MEMSTK, /* NaT value is in unat word at offset OFF */
|
|
|
|
UNW_NAT_REGSTK /* NaT is in rnat */
|
|
|
|
};
|
|
|
|
|
|
|
|
enum unw_insn_opcode {
|
|
|
|
UNW_INSN_ADD, /* s[dst] += val */
|
|
|
|
UNW_INSN_ADD_PSP, /* s[dst] = (s.psp + val) */
|
|
|
|
UNW_INSN_ADD_SP, /* s[dst] = (s.sp + val) */
|
|
|
|
UNW_INSN_MOVE, /* s[dst] = s[val] */
|
|
|
|
UNW_INSN_MOVE2, /* s[dst] = s[val]; s[dst+1] = s[val+1] */
|
|
|
|
UNW_INSN_MOVE_STACKED, /* s[dst] = ia64_rse_skip(*s.bsp, val) */
|
|
|
|
UNW_INSN_SETNAT_MEMSTK, /* s[dst+1].nat.type = MEMSTK;
|
|
|
|
s[dst+1].nat.off = *s.pri_unat - s[dst] */
|
|
|
|
UNW_INSN_SETNAT_TYPE, /* s[dst+1].nat.type = val */
|
|
|
|
UNW_INSN_LOAD, /* s[dst] = *s[val] */
|
|
|
|
UNW_INSN_MOVE_SCRATCH, /* s[dst] = scratch reg "val" */
|
|
|
|
UNW_INSN_MOVE_CONST, /* s[dst] = constant reg "val" */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct unw_insn {
|
|
|
|
unsigned int opc : 4;
|
|
|
|
unsigned int dst : 9;
|
|
|
|
signed int val : 19;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Preserved general static registers (r4-r7) give rise to two script
|
|
|
|
* instructions; everything else yields at most one instruction; at
|
|
|
|
* the end of the script, the psp gets popped, accounting for one more
|
|
|
|
* instruction.
|
|
|
|
*/
|
|
|
|
#define UNW_MAX_SCRIPT_LEN (UNW_NUM_REGS + 5)
|
|
|
|
|
|
|
|
struct unw_script {
|
|
|
|
unsigned long ip; /* ip this script is for */
|
|
|
|
unsigned long pr_mask; /* mask of predicates script depends on */
|
|
|
|
unsigned long pr_val; /* predicate values this script is for */
|
|
|
|
rwlock_t lock;
|
|
|
|
unsigned int flags; /* see UNW_FLAG_* in unwind.h */
|
|
|
|
unsigned short lru_chain; /* used for least-recently-used chain */
|
|
|
|
unsigned short coll_chain; /* used for hash collisions */
|
|
|
|
unsigned short hint; /* hint for next script to try (or -1) */
|
|
|
|
unsigned short count; /* number of instructions in script */
|
|
|
|
struct unw_insn insn[UNW_MAX_SCRIPT_LEN];
|
|
|
|
};
|