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 */
|
2005-09-19 22:01:54 +00:00
|
|
|
#ifndef _ASM_POWERPC_BUG_H
|
|
|
|
#define _ASM_POWERPC_BUG_H
|
2005-12-16 21:43:46 +00:00
|
|
|
#ifdef __KERNEL__
|
2005-04-16 22:20:36 +00:00
|
|
|
|
[PATCH] powerpc: Consolidate asm compatibility macros
This patch consolidates macros used to generate assembly for
compatibility across different CPUs or configs. A new header,
asm-powerpc/asm-compat.h contains the main compatibility macros. It
uses some preprocessor magic to make the macros suitable both for use
in .S files, and in inline asm in .c files. Headers (bitops.h,
uaccess.h, atomic.h, bug.h) which had their own such compatibility
macros are changed to use asm-compat.h.
ppc_asm.h is now for use in .S files *only*, and a #error enforces
that. As such, we're a lot more careless about namespace pollution
here than in asm-compat.h.
While we're at it, this patch adds a call to the PPC405_ERR77 macro in
futex.h which should have had it already, but didn't.
Built and booted on pSeries, Maple and iSeries (ARCH=powerpc). Built
for 32-bit powermac (ARCH=powerpc) and Walnut (ARCH=ppc).
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-10 01:56:55 +00:00
|
|
|
#include <asm/asm-compat.h>
|
2008-12-14 19:44:13 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Define an illegal instr to trap on the bug.
|
|
|
|
* We don't use 0 because that marks the end of a function
|
|
|
|
* in the ELF ABI. That's "Boo Boo" in case you wonder...
|
|
|
|
*/
|
|
|
|
#define BUG_OPCODE .long 0x00b00b00 /* For asm */
|
|
|
|
#define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */
|
|
|
|
|
2005-05-01 15:59:01 +00:00
|
|
|
#ifdef CONFIG_BUG
|
|
|
|
|
2007-01-01 18:45:34 +00:00
|
|
|
#ifdef __ASSEMBLY__
|
2008-12-14 19:44:13 +00:00
|
|
|
#include <asm/asm-offsets.h>
|
2007-01-01 18:45:34 +00:00
|
|
|
#ifdef CONFIG_DEBUG_BUGVERBOSE
|
|
|
|
.macro EMIT_BUG_ENTRY addr,file,line,flags
|
2017-07-15 05:10:58 +00:00
|
|
|
.section __bug_table,"aw"
|
2007-01-01 18:45:34 +00:00
|
|
|
5001: PPC_LONG \addr, 5002f
|
|
|
|
.short \line, \flags
|
|
|
|
.org 5001b+BUG_ENTRY_SIZE
|
|
|
|
.previous
|
|
|
|
.section .rodata,"a"
|
|
|
|
5002: .asciz "\file"
|
|
|
|
.previous
|
|
|
|
.endm
|
|
|
|
#else
|
2008-12-14 19:44:13 +00:00
|
|
|
.macro EMIT_BUG_ENTRY addr,file,line,flags
|
2017-07-15 05:10:58 +00:00
|
|
|
.section __bug_table,"aw"
|
2007-01-01 18:45:34 +00:00
|
|
|
5001: PPC_LONG \addr
|
|
|
|
.short \flags
|
|
|
|
.org 5001b+BUG_ENTRY_SIZE
|
|
|
|
.previous
|
|
|
|
.endm
|
|
|
|
#endif /* verbose */
|
|
|
|
|
|
|
|
#else /* !__ASSEMBLY__ */
|
2006-12-08 11:30:41 +00:00
|
|
|
/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
|
|
|
|
sizeof(struct bug_entry), respectively */
|
|
|
|
#ifdef CONFIG_DEBUG_BUGVERBOSE
|
|
|
|
#define _EMIT_BUG_ENTRY \
|
2017-07-15 05:10:58 +00:00
|
|
|
".section __bug_table,\"aw\"\n" \
|
2006-12-08 11:30:41 +00:00
|
|
|
"2:\t" PPC_LONG "1b, %0\n" \
|
|
|
|
"\t.short %1, %2\n" \
|
|
|
|
".org 2b+%3\n" \
|
|
|
|
".previous\n"
|
|
|
|
#else
|
|
|
|
#define _EMIT_BUG_ENTRY \
|
2017-07-15 05:10:58 +00:00
|
|
|
".section __bug_table,\"aw\"\n" \
|
2006-12-08 11:30:41 +00:00
|
|
|
"2:\t" PPC_LONG "1b\n" \
|
|
|
|
"\t.short %2\n" \
|
|
|
|
".org 2b+%3\n" \
|
|
|
|
".previous\n"
|
|
|
|
#endif
|
|
|
|
|
2006-03-23 12:32:24 +00:00
|
|
|
/*
|
|
|
|
* BUG_ON() and WARN_ON() do their best to cooperate with compile-time
|
|
|
|
* optimisations. However depending on the complexity of the condition
|
|
|
|
* some compiler versions may not produce optimal results.
|
|
|
|
*/
|
|
|
|
|
2006-12-08 11:30:41 +00:00
|
|
|
#define BUG() do { \
|
|
|
|
__asm__ __volatile__( \
|
|
|
|
"1: twi 31,0,0\n" \
|
|
|
|
_EMIT_BUG_ENTRY \
|
|
|
|
: : "i" (__FILE__), "i" (__LINE__), \
|
|
|
|
"i" (0), "i" (sizeof(struct bug_entry))); \
|
2009-12-10 07:28:19 +00:00
|
|
|
unreachable(); \
|
2005-04-16 22:20:36 +00:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define BUG_ON(x) do { \
|
2006-03-23 12:32:24 +00:00
|
|
|
if (__builtin_constant_p(x)) { \
|
|
|
|
if (x) \
|
|
|
|
BUG(); \
|
|
|
|
} else { \
|
|
|
|
__asm__ __volatile__( \
|
2006-12-08 11:30:41 +00:00
|
|
|
"1: "PPC_TLNEI" %4,0\n" \
|
|
|
|
_EMIT_BUG_ENTRY \
|
|
|
|
: : "i" (__FILE__), "i" (__LINE__), "i" (0), \
|
|
|
|
"i" (sizeof(struct bug_entry)), \
|
2007-07-26 16:35:49 +00:00
|
|
|
"r" ((__force long)(x))); \
|
2006-03-23 12:32:24 +00:00
|
|
|
} \
|
2005-04-16 22:20:36 +00:00
|
|
|
} while (0)
|
|
|
|
|
2017-02-25 07:56:53 +00:00
|
|
|
#define __WARN_FLAGS(flags) do { \
|
2005-04-16 22:20:36 +00:00
|
|
|
__asm__ __volatile__( \
|
2006-03-23 12:32:24 +00:00
|
|
|
"1: twi 31,0,0\n" \
|
2006-12-08 11:30:41 +00:00
|
|
|
_EMIT_BUG_ENTRY \
|
|
|
|
: : "i" (__FILE__), "i" (__LINE__), \
|
2017-02-25 07:56:53 +00:00
|
|
|
"i" (BUGFLAG_WARNING|(flags)), \
|
2006-12-08 11:30:41 +00:00
|
|
|
"i" (sizeof(struct bug_entry))); \
|
2006-03-23 12:32:24 +00:00
|
|
|
} while (0)
|
|
|
|
|
2006-09-29 08:59:06 +00:00
|
|
|
#define WARN_ON(x) ({ \
|
2007-08-01 04:12:07 +00:00
|
|
|
int __ret_warn_on = !!(x); \
|
2006-09-29 08:59:06 +00:00
|
|
|
if (__builtin_constant_p(__ret_warn_on)) { \
|
|
|
|
if (__ret_warn_on) \
|
2006-03-28 07:42:49 +00:00
|
|
|
__WARN(); \
|
2006-03-23 12:32:24 +00:00
|
|
|
} else { \
|
|
|
|
__asm__ __volatile__( \
|
2006-12-08 11:30:41 +00:00
|
|
|
"1: "PPC_TLNEI" %4,0\n" \
|
|
|
|
_EMIT_BUG_ENTRY \
|
|
|
|
: : "i" (__FILE__), "i" (__LINE__), \
|
2017-06-14 03:01:25 +00:00
|
|
|
"i" (BUGFLAG_WARNING|BUGFLAG_TAINT(TAINT_WARN)),\
|
2006-12-08 11:30:41 +00:00
|
|
|
"i" (sizeof(struct bug_entry)), \
|
|
|
|
"r" (__ret_warn_on)); \
|
2006-03-23 12:32:24 +00:00
|
|
|
} \
|
2006-09-29 08:59:06 +00:00
|
|
|
unlikely(__ret_warn_on); \
|
|
|
|
})
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#define HAVE_ARCH_BUG
|
|
|
|
#define HAVE_ARCH_BUG_ON
|
|
|
|
#define HAVE_ARCH_WARN_ON
|
2005-09-19 22:01:54 +00:00
|
|
|
#endif /* __ASSEMBLY __ */
|
2008-12-14 19:44:13 +00:00
|
|
|
#else
|
|
|
|
#ifdef __ASSEMBLY__
|
|
|
|
.macro EMIT_BUG_ENTRY addr,file,line,flags
|
|
|
|
.endm
|
|
|
|
#else /* !__ASSEMBLY__ */
|
|
|
|
#define _EMIT_BUG_ENTRY
|
|
|
|
#endif
|
2007-01-01 18:45:34 +00:00
|
|
|
#endif /* CONFIG_BUG */
|
2005-05-01 15:59:01 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm-generic/bug.h>
|
|
|
|
|
2012-03-28 17:30:02 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
|
|
|
struct pt_regs;
|
|
|
|
extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long);
|
|
|
|
extern void bad_page_fault(struct pt_regs *, unsigned long, int);
|
|
|
|
extern void _exception(int, struct pt_regs *, int, unsigned long);
|
2018-09-18 08:56:25 +00:00
|
|
|
extern void _exception_pkey(struct pt_regs *, unsigned long, int);
|
2012-03-28 17:30:02 +00:00
|
|
|
extern void die(const char *, struct pt_regs *, long);
|
powerpc/powernv: Use kernel crash path for machine checks
There are quite a few machine check exceptions that can be caused by
kernel bugs. To make debugging easier, use the kernel crash path in
cases of synchronous machine checks that occur in kernel mode, if that
would not result in the machine going straight to panic or crash dump.
There is a downside here that die()ing the process in kernel mode can
still leave the system unstable. panic_on_oops will always force the
system to fail-stop, so systems where that behaviour is important will
still do the right thing.
As a test, when triggering an i-side 0111b error (ifetch from foreign
address) in kernel mode process context on POWER9, the kernel currently
dies quickly like this:
Severe Machine check interrupt [Not recovered]
NIP [ffff000000000000]: 0xffff000000000000
Initiator: CPU
Error type: Real address [Instruction fetch (foreign)]
[ 127.426651616,0] OPAL: Reboot requested due to Platform error.
Effective[ 127.426693712,3] OPAL: Reboot requested due to Platform error. address: ffff000000000000
opal: Reboot type 1 not supported
Kernel panic - not syncing: PowerNV Unrecovered Machine Check
CPU: 56 PID: 4425 Comm: syscall Tainted: G M 4.12.0-rc1-13857-ga4700a261072-dirty #35
Call Trace:
[ 128.017988928,4] IPMI: BUG: Dropping ESEL on the floor due to
buggy/mising code in OPAL for this BMC
Rebooting in 10 seconds..
Trying to free IRQ 496 from IRQ context!
After this patch, the process is killed and the kernel continues with
this message, which gives enough information to identify the offending
branch (i.e., with CFAR):
Severe Machine check interrupt [Not recovered]
NIP [ffff000000000000]: 0xffff000000000000
Initiator: CPU
Error type: Real address [Instruction fetch (foreign)]
Effective address: ffff000000000000
Oops: Machine check, sig: 7 [#1]
SMP NR_CPUS=2048
NUMA
PowerNV
Modules linked in: iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 ...
CPU: 22 PID: 4436 Comm: syscall Tainted: G M 4.12.0-rc1-13857-ga4700a261072-dirty #36
task: c000000932300000 task.stack: c000000932380000
NIP: ffff000000000000 LR: 00000000217706a4 CTR: ffff000000000000
REGS: c00000000fc8fd80 TRAP: 0200 Tainted: G M (4.12.0-rc1-13857-ga4700a261072-dirty)
MSR: 90000000001c1003 <SF,HV,ME,RI,LE>
CR: 24000484 XER: 20000000
CFAR: c000000000004c80 DAR: 0000000021770a90 DSISR: 0a000000 SOFTE: 1
GPR00: 0000000000001ebe 00007fffce4818b0 0000000021797f00 0000000000000000
GPR04: 00007fff8007ac24 0000000044000484 0000000000004000 00007fff801405e8
GPR08: 900000000280f033 0000000024000484 0000000000000000 0000000000000030
GPR12: 9000000000001003 00007fff801bc370 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR24: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR28: 00007fff801b0000 0000000000000000 00000000217707a0 00007fffce481918
NIP [ffff000000000000] 0xffff000000000000
LR [00000000217706a4] 0x217706a4
Call Trace:
Instruction dump:
XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-07-19 06:59:11 +00:00
|
|
|
extern bool die_will_crash(void);
|
powerpc/pseries, ps3: panic flush kernel messages before halting system
Platforms with a panic handler that halts the system can have problems
getting kernel messages out, because the panic notifiers are called
before kernel/panic.c does its flushing of printk buffers an console
etc.
This was attempted to be solved with commit a3b2cb30f252 ("powerpc: Do
not call ppc_md.panic in fadump panic notifier"), but that wasn't the
right approach and caused other problems, and was reverted by commit
ab9dbf771ff9.
Instead, the powernv shutdown paths have already had a similar
problem, fixed by taking the message flushing sequence from
kernel/panic.c. That's a little bit ugly, but while we have the code
duplicated, it will work for this case as well. So have ppc panic
handlers do the same flushing before they terminate.
Without this patch, a qemu pseries_le_defconfig guest stops silently
when issued the nmi command when xmon is off and no crash dumpers
enabled. Afterwards, an oops is printed by each CPU as expected.
Fixes: ab9dbf771ff9 ("Revert "powerpc: Do not call ppc_md.panic in fadump panic notifier"")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-12-23 16:49:23 +00:00
|
|
|
extern void panic_flush_kmsg_start(void);
|
|
|
|
extern void panic_flush_kmsg_end(void);
|
2012-03-28 17:30:02 +00:00
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
|
2005-12-16 21:43:46 +00:00
|
|
|
#endif /* __KERNEL__ */
|
2005-09-19 22:01:54 +00:00
|
|
|
#endif /* _ASM_POWERPC_BUG_H */
|