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 17:07:57 +03:00
/* SPDX-License-Identifier: GPL-2.0 */
2005-04-17 02:20:36 +04:00
/*
* S390 version
2012-07-20 13:15:04 +04:00
* Copyright IBM Corp . 1999 , 2000
2005-04-17 02:20:36 +04:00
* Author ( s ) : Denis Joseph Barrow ( djbarrow @ de . ibm . com , barrow_dj @ yahoo . com )
*/
# ifndef _S390_PTRACE_H
# define _S390_PTRACE_H
2015-10-06 17:23:39 +03:00
# include <linux/const.h>
2012-10-09 12:47:31 +04:00
# include <uapi/asm/ptrace.h>
2005-04-17 02:20:36 +04:00
2014-04-15 14:55:07 +04:00
# define PIF_SYSCALL 0 /* inside a system call */
# define PIF_PER_TRAP 1 /* deliver sigtrap on return to user */
2017-06-07 15:10:24 +03:00
# define PIF_SYSCALL_RESTART 2 /* restart the current system call */
2017-10-05 09:44:26 +03:00
# define PIF_GUEST_FAULT 3 /* indicates program check in sie64a */
2014-04-15 14:55:07 +04:00
2015-10-06 17:23:39 +03:00
# define _PIF_SYSCALL _BITUL(PIF_SYSCALL)
# define _PIF_PER_TRAP _BITUL(PIF_PER_TRAP)
2017-06-07 15:10:24 +03:00
# define _PIF_SYSCALL_RESTART _BITUL(PIF_SYSCALL_RESTART)
2017-10-05 09:44:26 +03:00
# define _PIF_GUEST_FAULT _BITUL(PIF_GUEST_FAULT)
2014-04-15 14:55:07 +04:00
2005-04-17 02:20:36 +04:00
# ifndef __ASSEMBLY__
2013-04-20 16:07:29 +04:00
2013-09-24 11:14:56 +04:00
# define PSW_KERNEL_BITS (PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_ASC_HOME | \
PSW_MASK_EA | PSW_MASK_BA )
# define PSW_USER_BITS (PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | \
PSW_DEFAULT_KEY | PSW_MASK_BASE | PSW_MASK_MCHECK | \
PSW_MASK_PSTATE | PSW_ASC_PRIMARY )
2006-04-27 07:47:10 +04:00
2014-01-01 19:08:06 +04:00
struct psw_bits {
2017-06-03 11:56:07 +03:00
unsigned long : 1 ;
unsigned long per : 1 ; /* PER-Mask */
unsigned long : 3 ;
unsigned long dat : 1 ; /* DAT Mode */
unsigned long io : 1 ; /* Input/Output Mask */
unsigned long ext : 1 ; /* External Mask */
unsigned long key : 4 ; /* PSW Key */
unsigned long : 1 ;
unsigned long mcheck : 1 ; /* Machine-Check Mask */
unsigned long wait : 1 ; /* Wait State */
unsigned long pstate : 1 ; /* Problem State */
unsigned long as : 2 ; /* Address Space Control */
unsigned long cc : 2 ; /* Condition Code */
unsigned long pm : 4 ; /* Program Mask */
unsigned long ri : 1 ; /* Runtime Instrumentation */
unsigned long : 6 ;
unsigned long eaba : 2 ; /* Addressing Mode */
unsigned long : 31 ;
unsigned long ia : 64 ; /* Instruction Address */
2014-01-01 19:08:06 +04:00
} ;
enum {
2017-06-03 11:19:55 +03:00
PSW_BITS_AMODE_24BIT = 0 ,
PSW_BITS_AMODE_31BIT = 1 ,
PSW_BITS_AMODE_64BIT = 3
2014-01-01 19:08:06 +04:00
} ;
enum {
2017-06-03 11:19:55 +03:00
PSW_BITS_AS_PRIMARY = 0 ,
PSW_BITS_AS_ACCREG = 1 ,
PSW_BITS_AS_SECONDARY = 2 ,
PSW_BITS_AS_HOME = 3
2014-01-01 19:08:06 +04:00
} ;
# define psw_bits(__psw) (*({ \
typecheck ( psw_t , __psw ) ; \
& ( * ( struct psw_bits * ) ( & ( __psw ) ) ) ; \
} ) )
2005-04-17 02:20:36 +04:00
/*
* The pt_regs struct defines the way the registers are stored on
* the stack during a system call .
*/
struct pt_regs
{
2017-12-04 12:56:45 +03:00
union {
user_pt_regs user_regs ;
struct {
unsigned long args [ 1 ] ;
psw_t psw ;
unsigned long gprs [ NUM_GPRS ] ;
} ;
} ;
2005-04-17 02:20:36 +04:00
unsigned long orig_gpr2 ;
2011-12-27 14:27:18 +04:00
unsigned int int_code ;
2013-06-17 16:54:02 +04:00
unsigned int int_parm ;
2011-12-27 14:27:18 +04:00
unsigned long int_parm_long ;
2014-04-15 14:55:07 +04:00
unsigned long flags ;
2005-04-17 02:20:36 +04:00
} ;
2011-01-05 14:48:10 +03:00
/*
* Program event recording ( PER ) register set .
*/
struct per_regs {
unsigned long control ; /* PER control bits */
unsigned long start ; /* PER starting address */
unsigned long end ; /* PER ending address */
} ;
/*
* PER event contains information about the cause of the last PER exception .
*/
struct per_event {
unsigned short cause ; /* PER code, ATMID and AI */
unsigned long address ; /* PER address */
unsigned char paid ; /* PER access identification */
} ;
/*
* Simplified per_info structure used to decode the ptrace user space ABI .
*/
struct per_struct_kernel {
unsigned long cr9 ; /* PER control bits */
unsigned long cr10 ; /* PER starting address */
unsigned long cr11 ; /* PER ending address */
unsigned long bits ; /* Obsolete software bits */
unsigned long starting_addr ; /* User specified start address */
unsigned long ending_addr ; /* User specified end address */
unsigned short perc_atmid ; /* PER trap ATMID */
unsigned long address ; /* PER trap instruction address */
unsigned char access_id ; /* PER trap access identification */
} ;
2012-07-31 13:03:04 +04:00
# define PER_EVENT_MASK 0xEB000000UL
2011-01-05 14:48:10 +03:00
# define PER_EVENT_BRANCH 0x80000000UL
# define PER_EVENT_IFETCH 0x40000000UL
# define PER_EVENT_STORE 0x20000000UL
# define PER_EVENT_STORE_REAL 0x08000000UL
2012-07-31 13:03:04 +04:00
# define PER_EVENT_TRANSACTION_END 0x02000000UL
2011-01-05 14:48:10 +03:00
# define PER_EVENT_NULLIFICATION 0x01000000UL
2012-07-31 13:03:04 +04:00
# define PER_CONTROL_MASK 0x00e00000UL
2011-01-05 14:48:10 +03:00
# define PER_CONTROL_BRANCH_ADDRESS 0x00800000UL
2012-07-31 13:03:04 +04:00
# define PER_CONTROL_SUSPENSION 0x00400000UL
2011-01-05 14:48:10 +03:00
# define PER_CONTROL_ALTERATION 0x00200000UL
2014-04-15 14:55:07 +04:00
static inline void set_pt_regs_flag ( struct pt_regs * regs , int flag )
{
2015-10-06 17:23:29 +03:00
regs - > flags | = ( 1UL < < flag ) ;
2014-04-15 14:55:07 +04:00
}
static inline void clear_pt_regs_flag ( struct pt_regs * regs , int flag )
{
2015-10-06 17:23:29 +03:00
regs - > flags & = ~ ( 1UL < < flag ) ;
2014-04-15 14:55:07 +04:00
}
static inline int test_pt_regs_flag ( struct pt_regs * regs , int flag )
{
2015-10-06 17:23:29 +03:00
return ! ! ( regs - > flags & ( 1UL < < flag ) ) ;
2014-04-15 14:55:07 +04:00
}
2008-01-26 16:11:22 +03:00
/*
* These are defined as per linux / ptrace . h , which see .
*/
# define arch_has_single_step() (1)
2014-03-14 15:01:08 +04:00
# define arch_has_block_step() (1)
2008-01-26 16:11:22 +03:00
2005-04-17 02:20:36 +04:00
# define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
2016-01-18 15:12:19 +03:00
# define instruction_pointer(regs) ((regs)->psw.addr)
2008-10-10 23:33:20 +04:00
# define user_stack_pointer(regs)((regs)->gprs[15])
2005-04-17 02:20:36 +04:00
# define profile_pc(regs) instruction_pointer(regs)
2010-02-12 15:38:40 +03:00
2012-01-03 23:23:06 +04:00
static inline long regs_return_value ( struct pt_regs * regs )
{
return regs - > gprs [ 2 ] ;
}
2014-09-22 18:39:06 +04:00
static inline void instruction_pointer_set ( struct pt_regs * regs ,
unsigned long val )
{
2016-01-18 14:49:44 +03:00
regs - > psw . addr = val ;
2014-09-22 18:39:06 +04:00
}
2010-02-12 15:38:40 +03:00
int regs_query_register_offset ( const char * name ) ;
const char * regs_query_register_name ( unsigned int offset ) ;
unsigned long regs_get_register ( struct pt_regs * regs , unsigned int offset ) ;
unsigned long regs_get_kernel_stack_nth ( struct pt_regs * regs , unsigned int n ) ;
static inline unsigned long kernel_stack_pointer ( struct pt_regs * regs )
{
2016-01-18 15:12:19 +03:00
return regs - > gprs [ 15 ] ;
2010-02-12 15:38:40 +03:00
}
2005-04-17 02:20:36 +04:00
# endif /* __ASSEMBLY__ */
# endif /* _S390_PTRACE_H */