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 */
|
2008-12-25 20:38:56 +08:00
|
|
|
#ifndef _ASM_S390_FTRACE_H
|
|
|
|
#define _ASM_S390_FTRACE_H
|
|
|
|
|
2020-11-12 22:54:47 +08:00
|
|
|
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
2014-10-15 18:17:38 +08:00
|
|
|
#define ARCH_SUPPORTS_FTRACE_OPS 1
|
2015-01-09 20:08:28 +08:00
|
|
|
#define MCOUNT_INSN_SIZE 6
|
2019-02-18 23:51:28 +08:00
|
|
|
|
2008-12-25 20:38:56 +08:00
|
|
|
#ifndef __ASSEMBLY__
|
2009-06-12 16:26:44 +08:00
|
|
|
|
2019-04-09 05:26:23 +08:00
|
|
|
#ifdef CONFIG_CC_IS_CLANG
|
|
|
|
/* https://bugs.llvm.org/show_bug.cgi?id=41424 */
|
|
|
|
#define ftrace_return_address(n) 0UL
|
|
|
|
#else
|
2016-10-17 19:07:46 +08:00
|
|
|
#define ftrace_return_address(n) __builtin_return_address(n)
|
2019-04-09 05:26:23 +08:00
|
|
|
#endif
|
2014-11-24 21:30:32 +08:00
|
|
|
|
2014-10-15 18:17:38 +08:00
|
|
|
void ftrace_caller(void);
|
|
|
|
|
2021-06-26 05:50:07 +08:00
|
|
|
extern void *ftrace_func;
|
2009-06-12 16:26:44 +08:00
|
|
|
|
|
|
|
struct dyn_arch_ftrace { };
|
|
|
|
|
2020-11-12 22:54:47 +08:00
|
|
|
#define MCOUNT_ADDR 0
|
2014-10-15 18:17:38 +08:00
|
|
|
#define FTRACE_ADDR ((unsigned long)ftrace_caller)
|
2009-06-12 16:26:44 +08:00
|
|
|
|
2014-10-15 18:17:38 +08:00
|
|
|
#define KPROBE_ON_FTRACE_NOP 0
|
|
|
|
#define KPROBE_ON_FTRACE_CALL 1
|
2008-12-25 20:38:56 +08:00
|
|
|
|
2020-11-12 22:54:47 +08:00
|
|
|
struct module;
|
|
|
|
struct dyn_ftrace;
|
s390/ftrace: implement hotpatching
s390 allows hotpatching the mask of a conditional jump instruction.
Make use of this feature in order to avoid the expensive stop_machine()
call.
The new trampolines are split in 3 stages:
- A first stage is a 6-byte relative conditional long branch located at
each function's entry point. Its offset always points to the second
stage for the corresponding function, and its mask is either all 0s
(ftrace off) or all 1s (ftrace on). The code for flipping the mask is
borrowed from ftrace_{enable,disable}_ftrace_graph_caller. After
flipping, ftrace_arch_code_modify_post_process() syncs with all the
other CPUs by sending SIGPs.
- Second stages for vmlinux are stored in a separate part of the .text
section reserved by the linker script, and in dynamically allocated
memory for modules. This prevents the icache pollution. The total
size of second stages is about 1.5% of that of the kernel image.
Putting second stages in the .bss section is possible and decreases
the size of the non-compressed vmlinux, but splits the kernel 1:1
mapping, which is a bad tradeoff.
Each second stage contains a call to the third stage, a pointer to
the part of the intercepted function right after the first stage, and
a pointer to an interceptor function (e.g. ftrace_caller).
Second stages are 8-byte aligned for the future direct calls
implementation.
- There are only two copies of the third stage: in the .text section
for vmlinux and in dynamically allocated memory for modules. It can be
an expoline, which is relatively large, so inlining it into each
second stage is prohibitively expensive.
As a result of this organization, phoronix-test-suite with ftrace off
does not show any performance degradation.
Suggested-by: Sven Schnelle <svens@linux.ibm.com>
Suggested-by: Vasily Gorbik <gor@linux.ibm.com>
Co-developed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/r/20210728212546.128248-3-iii@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2021-07-29 05:25:46 +08:00
|
|
|
|
|
|
|
bool ftrace_need_init_nop(void);
|
|
|
|
#define ftrace_need_init_nop ftrace_need_init_nop
|
|
|
|
|
|
|
|
int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
|
2020-11-12 22:54:47 +08:00
|
|
|
#define ftrace_init_nop ftrace_init_nop
|
|
|
|
|
2009-06-12 16:26:44 +08:00
|
|
|
static inline unsigned long ftrace_call_adjust(unsigned long addr)
|
|
|
|
{
|
2011-05-10 16:10:43 +08:00
|
|
|
return addr;
|
2009-06-12 16:26:44 +08:00
|
|
|
}
|
|
|
|
|
2021-10-04 22:10:24 +08:00
|
|
|
struct ftrace_regs {
|
|
|
|
struct pt_regs regs;
|
|
|
|
};
|
|
|
|
|
|
|
|
static __always_inline struct pt_regs *arch_ftrace_get_regs(struct ftrace_regs *fregs)
|
|
|
|
{
|
|
|
|
return &fregs->regs;
|
|
|
|
}
|
|
|
|
|
2021-10-04 22:16:45 +08:00
|
|
|
static __always_inline void ftrace_instruction_pointer_set(struct ftrace_regs *fregs,
|
|
|
|
unsigned long ip)
|
|
|
|
{
|
|
|
|
struct pt_regs *regs = arch_ftrace_get_regs(fregs);
|
|
|
|
|
|
|
|
regs->psw.addr = ip;
|
|
|
|
}
|
|
|
|
|
2021-10-12 21:37:59 +08:00
|
|
|
/*
|
|
|
|
* When an ftrace registered caller is tracing a function that is
|
|
|
|
* also set by a register_ftrace_direct() call, it needs to be
|
|
|
|
* differentiated in the ftrace_caller trampoline. To do this,
|
|
|
|
* place the direct caller in the ORIG_GPR2 part of pt_regs. This
|
|
|
|
* tells the ftrace_caller that there's a direct caller.
|
|
|
|
*/
|
|
|
|
static inline void arch_ftrace_set_direct_caller(struct pt_regs *regs, unsigned long addr)
|
|
|
|
{
|
|
|
|
regs->orig_gpr2 = addr;
|
|
|
|
}
|
|
|
|
|
2019-01-21 17:30:44 +08:00
|
|
|
/*
|
|
|
|
* Even though the system call numbers are identical for s390/s390x a
|
|
|
|
* different system call table is used for compat tasks. This may lead
|
|
|
|
* to e.g. incorrect or missing trace event sysfs files.
|
|
|
|
* Therefore simply do not trace compat system calls at all.
|
|
|
|
* See kernel/trace/trace_syscalls.c.
|
|
|
|
*/
|
|
|
|
#define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS
|
|
|
|
static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
return is_compat_task();
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
|
|
|
|
static inline bool arch_syscall_match_sym_name(const char *sym,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Skip __s390_ and __s390x_ prefix - due to compat wrappers
|
|
|
|
* and aliasing some symbols of 64 bit system call functions
|
|
|
|
* may get the __s390_ prefix instead of the __s390x_ prefix.
|
|
|
|
*/
|
|
|
|
return !strcmp(sym + 7, name) || !strcmp(sym + 8, name);
|
|
|
|
}
|
|
|
|
|
2014-10-15 18:17:38 +08:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2021-09-24 21:03:07 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_FUNCTION_TRACER
|
|
|
|
|
|
|
|
#define FTRACE_NOP_INSN .word 0xc004, 0x0000, 0x0000 /* brcl 0,0 */
|
|
|
|
|
|
|
|
#ifndef CC_USING_HOTPATCH
|
|
|
|
|
|
|
|
#define FTRACE_GEN_MCOUNT_RECORD(name) \
|
|
|
|
.section __mcount_loc, "a", @progbits; \
|
|
|
|
.quad name; \
|
|
|
|
.previous;
|
|
|
|
|
|
|
|
#else /* !CC_USING_HOTPATCH */
|
|
|
|
|
|
|
|
#define FTRACE_GEN_MCOUNT_RECORD(name)
|
|
|
|
|
|
|
|
#endif /* !CC_USING_HOTPATCH */
|
|
|
|
|
|
|
|
#define FTRACE_GEN_NOP_ASM(name) \
|
|
|
|
FTRACE_GEN_MCOUNT_RECORD(name) \
|
|
|
|
FTRACE_NOP_INSN
|
|
|
|
|
|
|
|
#else /* CONFIG_FUNCTION_TRACER */
|
|
|
|
|
|
|
|
#define FTRACE_GEN_NOP_ASM(name)
|
|
|
|
|
|
|
|
#endif /* CONFIG_FUNCTION_TRACER */
|
|
|
|
|
2008-12-25 20:38:56 +08:00
|
|
|
#endif /* _ASM_S390_FTRACE_H */
|