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
|
|
|
/*
|
|
|
|
* S390 version
|
2012-07-20 17:15:04 +08:00
|
|
|
* Copyright IBM Corp. 1999, 2000
|
2005-04-17 06:20:36 +08:00
|
|
|
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
|
|
|
|
* Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
|
|
|
|
*
|
|
|
|
* Derived from "arch/i386/kernel/traps.c"
|
|
|
|
* Copyright (C) 1991, 1992 Linus Torvalds
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 'Traps.c' handles hardware traps and faults after we have saved some
|
|
|
|
* state in 'asm.s'.
|
|
|
|
*/
|
2013-03-14 20:44:25 +08:00
|
|
|
#include <linux/kprobes.h>
|
|
|
|
#include <linux/kdebug.h>
|
2016-09-20 05:54:56 +08:00
|
|
|
#include <linux/extable.h>
|
2011-07-24 16:48:33 +08:00
|
|
|
#include <linux/ptrace.h>
|
2013-03-14 20:44:25 +08:00
|
|
|
#include <linux/sched.h>
|
2017-02-09 01:51:35 +08:00
|
|
|
#include <linux/sched/debug.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/mm.h>
|
2014-10-06 23:53:53 +08:00
|
|
|
#include <linux/slab.h>
|
2016-12-25 03:46:01 +08:00
|
|
|
#include <linux/uaccess.h>
|
2017-05-09 17:01:26 +08:00
|
|
|
#include <linux/cpu.h>
|
2015-10-06 18:25:59 +08:00
|
|
|
#include <asm/fpu/api.h>
|
2008-04-17 13:46:26 +08:00
|
|
|
#include "entry.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-07-31 17:03:04 +08:00
|
|
|
static inline void __user *get_trap_ip(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
unsigned long address;
|
|
|
|
|
|
|
|
if (regs->int_code & 0x200)
|
|
|
|
address = *(unsigned long *)(current->thread.trap_tdb + 24);
|
|
|
|
else
|
|
|
|
address = regs->psw.addr;
|
2016-01-18 20:12:19 +08:00
|
|
|
return (void __user *) (address - (regs->int_code >> 16));
|
2012-07-31 17:03:04 +08:00
|
|
|
}
|
|
|
|
|
2007-04-27 22:01:42 +08:00
|
|
|
int is_valid_bugaddr(unsigned long addr)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-09-22 22:39:06 +08:00
|
|
|
void do_report_trap(struct pt_regs *regs, int si_signo, int si_code, char *str)
|
2011-12-27 18:27:18 +08:00
|
|
|
{
|
|
|
|
siginfo_t info;
|
|
|
|
|
2012-07-27 16:31:12 +08:00
|
|
|
if (user_mode(regs)) {
|
2011-12-27 18:27:18 +08:00
|
|
|
info.si_signo = si_signo;
|
|
|
|
info.si_errno = 0;
|
|
|
|
info.si_code = si_code;
|
2012-07-31 17:03:04 +08:00
|
|
|
info.si_addr = get_trap_ip(regs);
|
2011-12-27 18:27:18 +08:00
|
|
|
force_sig_info(si_signo, &info, current);
|
2016-02-24 21:27:46 +08:00
|
|
|
report_user_fault(regs, si_signo, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
} else {
|
|
|
|
const struct exception_table_entry *fixup;
|
2016-01-18 20:12:19 +08:00
|
|
|
fixup = search_exception_tables(regs->psw.addr);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (fixup)
|
2016-01-18 19:49:44 +08:00
|
|
|
regs->psw.addr = extable_fixup(fixup);
|
2007-04-27 22:01:42 +08:00
|
|
|
else {
|
|
|
|
enum bug_trap_type btt;
|
|
|
|
|
2016-01-18 20:12:19 +08:00
|
|
|
btt = report_bug(regs->psw.addr, regs);
|
2007-04-27 22:01:42 +08:00
|
|
|
if (btt == BUG_TRAP_TYPE_WARN)
|
|
|
|
return;
|
2011-12-27 18:27:18 +08:00
|
|
|
die(regs, str);
|
2007-04-27 22:01:42 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-22 18:42:38 +08:00
|
|
|
static void do_trap(struct pt_regs *regs, int si_signo, int si_code, char *str)
|
2014-09-22 22:39:06 +08:00
|
|
|
{
|
|
|
|
if (notify_die(DIE_TRAP, str, regs, 0,
|
|
|
|
regs->int_code, si_signo) == NOTIFY_STOP)
|
|
|
|
return;
|
|
|
|
do_report_trap(regs, si_signo, si_code, str);
|
|
|
|
}
|
2014-10-22 18:42:38 +08:00
|
|
|
NOKPROBE_SYMBOL(do_trap);
|
2014-09-22 22:39:06 +08:00
|
|
|
|
2014-10-22 18:42:38 +08:00
|
|
|
void do_per_trap(struct pt_regs *regs)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-07-24 16:48:33 +08:00
|
|
|
siginfo_t info;
|
|
|
|
|
2011-01-05 19:48:10 +08:00
|
|
|
if (notify_die(DIE_SSTEP, "sstep", regs, 0, 0, SIGTRAP) == NOTIFY_STOP)
|
2006-09-20 21:58:39 +08:00
|
|
|
return;
|
2011-07-24 16:48:33 +08:00
|
|
|
if (!current->ptrace)
|
|
|
|
return;
|
|
|
|
info.si_signo = SIGTRAP;
|
|
|
|
info.si_errno = 0;
|
|
|
|
info.si_code = TRAP_HWBKPT;
|
2011-10-30 22:17:15 +08:00
|
|
|
info.si_addr =
|
|
|
|
(void __force __user *) current->thread.per_event.address;
|
2011-07-24 16:48:33 +08:00
|
|
|
force_sig_info(SIGTRAP, &info, current);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2014-10-22 18:42:38 +08:00
|
|
|
NOKPROBE_SYMBOL(do_per_trap);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-10-19 00:10:06 +08:00
|
|
|
void default_trap_handler(struct pt_regs *regs)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2012-07-27 16:31:12 +08:00
|
|
|
if (user_mode(regs)) {
|
2016-02-24 21:27:46 +08:00
|
|
|
report_user_fault(regs, SIGSEGV, 0);
|
2010-05-17 16:00:13 +08:00
|
|
|
do_exit(SIGSEGV);
|
2005-04-17 06:20:36 +08:00
|
|
|
} else
|
2011-12-27 18:27:18 +08:00
|
|
|
die(regs, "Unknown program exception");
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2010-10-25 22:10:37 +08:00
|
|
|
#define DO_ERROR_INFO(name, signr, sicode, str) \
|
2012-10-19 00:10:06 +08:00
|
|
|
void name(struct pt_regs *regs) \
|
|
|
|
{ \
|
|
|
|
do_trap(regs, signr, sicode, str); \
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2010-10-25 22:10:37 +08:00
|
|
|
DO_ERROR_INFO(addressing_exception, SIGILL, ILL_ILLADR,
|
|
|
|
"addressing exception")
|
|
|
|
DO_ERROR_INFO(execute_exception, SIGILL, ILL_ILLOPN,
|
|
|
|
"execute exception")
|
|
|
|
DO_ERROR_INFO(divide_exception, SIGFPE, FPE_INTDIV,
|
|
|
|
"fixpoint divide exception")
|
|
|
|
DO_ERROR_INFO(overflow_exception, SIGFPE, FPE_INTOVF,
|
|
|
|
"fixpoint overflow exception")
|
|
|
|
DO_ERROR_INFO(hfp_overflow_exception, SIGFPE, FPE_FLTOVF,
|
|
|
|
"HFP overflow exception")
|
|
|
|
DO_ERROR_INFO(hfp_underflow_exception, SIGFPE, FPE_FLTUND,
|
|
|
|
"HFP underflow exception")
|
|
|
|
DO_ERROR_INFO(hfp_significance_exception, SIGFPE, FPE_FLTRES,
|
|
|
|
"HFP significance exception")
|
|
|
|
DO_ERROR_INFO(hfp_divide_exception, SIGFPE, FPE_FLTDIV,
|
|
|
|
"HFP divide exception")
|
|
|
|
DO_ERROR_INFO(hfp_sqrt_exception, SIGFPE, FPE_FLTINV,
|
|
|
|
"HFP square root exception")
|
|
|
|
DO_ERROR_INFO(operand_exception, SIGILL, ILL_ILLOPN,
|
|
|
|
"operand exception")
|
|
|
|
DO_ERROR_INFO(privileged_op, SIGILL, ILL_PRVOPC,
|
|
|
|
"privileged operation")
|
|
|
|
DO_ERROR_INFO(special_op_exception, SIGILL, ILL_ILLOPN,
|
|
|
|
"special operation exception")
|
2012-07-31 17:03:04 +08:00
|
|
|
DO_ERROR_INFO(transaction_exception, SIGILL, ILL_ILLOPN,
|
|
|
|
"transaction constraint exception")
|
|
|
|
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 18:53:42 +08:00
|
|
|
static inline void do_fp_trap(struct pt_regs *regs, __u32 fpc)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-12-27 18:27:18 +08:00
|
|
|
int si_code = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
/* FPC[2] is Data Exception Code */
|
|
|
|
if ((fpc & 0x00000300) == 0) {
|
|
|
|
/* bits 6 and 7 of DXC are 0 iff IEEE exception */
|
|
|
|
if (fpc & 0x8000) /* invalid fp operation */
|
2011-12-27 18:27:18 +08:00
|
|
|
si_code = FPE_FLTINV;
|
2005-04-17 06:20:36 +08:00
|
|
|
else if (fpc & 0x4000) /* div by 0 */
|
2011-12-27 18:27:18 +08:00
|
|
|
si_code = FPE_FLTDIV;
|
2005-04-17 06:20:36 +08:00
|
|
|
else if (fpc & 0x2000) /* overflow */
|
2011-12-27 18:27:18 +08:00
|
|
|
si_code = FPE_FLTOVF;
|
2005-04-17 06:20:36 +08:00
|
|
|
else if (fpc & 0x1000) /* underflow */
|
2011-12-27 18:27:18 +08:00
|
|
|
si_code = FPE_FLTUND;
|
2005-04-17 06:20:36 +08:00
|
|
|
else if (fpc & 0x0800) /* inexact */
|
2011-12-27 18:27:18 +08:00
|
|
|
si_code = FPE_FLTRES;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2011-12-27 18:27:18 +08:00
|
|
|
do_trap(regs, SIGFPE, si_code, "floating point exception");
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2014-11-19 21:05:52 +08:00
|
|
|
void translation_exception(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
/* May never happen. */
|
2015-02-18 21:17:14 +08:00
|
|
|
panic("Translation exception");
|
2014-11-19 21:05:52 +08:00
|
|
|
}
|
|
|
|
|
2014-10-22 18:42:38 +08:00
|
|
|
void illegal_op(struct pt_regs *regs)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
siginfo_t info;
|
|
|
|
__u8 opcode[6];
|
2006-07-12 22:41:55 +08:00
|
|
|
__u16 __user *location;
|
2014-09-22 22:39:06 +08:00
|
|
|
int is_uprobe_insn = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
int signal = 0;
|
|
|
|
|
2012-07-31 17:03:04 +08:00
|
|
|
location = get_trap_ip(regs);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-07-27 16:31:12 +08:00
|
|
|
if (user_mode(regs)) {
|
2006-10-27 18:39:22 +08:00
|
|
|
if (get_user(*((__u16 *) opcode), (__u16 __user *) location))
|
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
|
2011-07-24 16:48:33 +08:00
|
|
|
if (current->ptrace) {
|
|
|
|
info.si_signo = SIGTRAP;
|
|
|
|
info.si_errno = 0;
|
|
|
|
info.si_code = TRAP_BRKPT;
|
|
|
|
info.si_addr = location;
|
|
|
|
force_sig_info(SIGTRAP, &info, current);
|
|
|
|
} else
|
2005-04-17 06:20:36 +08:00
|
|
|
signal = SIGILL;
|
2014-09-22 22:39:06 +08:00
|
|
|
#ifdef CONFIG_UPROBES
|
|
|
|
} else if (*((__u16 *) opcode) == UPROBE_SWBP_INSN) {
|
|
|
|
is_uprobe_insn = 1;
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
|
|
|
} else
|
|
|
|
signal = SIGILL;
|
2014-09-22 22:39:06 +08:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* We got either an illegal op in kernel mode, or user space trapped
|
|
|
|
* on a uprobes illegal instruction. See if kprobes or uprobes picks
|
|
|
|
* it up. If not, SIGILL.
|
|
|
|
*/
|
|
|
|
if (is_uprobe_insn || !user_mode(regs)) {
|
2011-12-27 18:27:18 +08:00
|
|
|
if (notify_die(DIE_BPT, "bpt", regs, 0,
|
2007-02-06 04:17:29 +08:00
|
|
|
3, SIGTRAP) != NOTIFY_STOP)
|
|
|
|
signal = SIGILL;
|
|
|
|
}
|
2011-12-27 18:27:18 +08:00
|
|
|
if (signal)
|
|
|
|
do_trap(regs, signal, ILL_ILLOPC, "illegal operation");
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2014-10-22 18:42:38 +08:00
|
|
|
NOKPROBE_SYMBOL(illegal_op);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-10-25 22:10:37 +08:00
|
|
|
DO_ERROR_INFO(specification_exception, SIGILL, ILL_ILLOPN,
|
|
|
|
"specification exception");
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-10-06 23:53:53 +08:00
|
|
|
void vector_exception(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
int si_code, vic;
|
|
|
|
|
|
|
|
if (!MACHINE_HAS_VX) {
|
|
|
|
do_trap(regs, SIGILL, ILL_ILLOPN, "illegal operation");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get vector interrupt code from fpc */
|
2015-06-29 22:43:06 +08:00
|
|
|
save_fpu_regs();
|
2015-06-11 21:33:54 +08:00
|
|
|
vic = (current->thread.fpu.fpc & 0xf00) >> 8;
|
2014-10-06 23:53:53 +08:00
|
|
|
switch (vic) {
|
|
|
|
case 1: /* invalid vector operation */
|
|
|
|
si_code = FPE_FLTINV;
|
|
|
|
break;
|
|
|
|
case 2: /* division by zero */
|
|
|
|
si_code = FPE_FLTDIV;
|
|
|
|
break;
|
|
|
|
case 3: /* overflow */
|
|
|
|
si_code = FPE_FLTOVF;
|
|
|
|
break;
|
|
|
|
case 4: /* underflow */
|
|
|
|
si_code = FPE_FLTUND;
|
|
|
|
break;
|
|
|
|
case 5: /* inexact */
|
|
|
|
si_code = FPE_FLTRES;
|
|
|
|
break;
|
|
|
|
default: /* unknown cause */
|
|
|
|
si_code = 0;
|
|
|
|
}
|
|
|
|
do_trap(regs, SIGFPE, si_code, "vector exception");
|
|
|
|
}
|
|
|
|
|
2012-10-19 00:10:06 +08:00
|
|
|
void data_exception(struct pt_regs *regs)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
int signal = 0;
|
|
|
|
|
2015-06-29 22:43:06 +08:00
|
|
|
save_fpu_regs();
|
2015-06-11 21:33:54 +08:00
|
|
|
if (current->thread.fpu.fpc & FPC_DXC_MASK)
|
2005-04-17 06:20:36 +08:00
|
|
|
signal = SIGFPE;
|
|
|
|
else
|
|
|
|
signal = SIGILL;
|
2015-02-12 20:08:27 +08:00
|
|
|
if (signal == SIGFPE)
|
2015-06-11 21:33:54 +08:00
|
|
|
do_fp_trap(regs, current->thread.fpu.fpc);
|
2011-12-27 18:27:18 +08:00
|
|
|
else if (signal)
|
|
|
|
do_trap(regs, signal, ILL_ILLOPN, "data exception");
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-10-19 00:10:06 +08:00
|
|
|
void space_switch_exception(struct pt_regs *regs)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
/* Set user psw back to home space mode. */
|
2012-07-27 16:31:12 +08:00
|
|
|
if (user_mode(regs))
|
2005-04-17 06:20:36 +08:00
|
|
|
regs->psw.mask |= PSW_ASC_HOME;
|
|
|
|
/* Send SIGILL. */
|
2011-12-27 18:27:18 +08:00
|
|
|
do_trap(regs, SIGILL, ILL_PRVOPC, "space switch event");
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2014-10-22 18:42:38 +08:00
|
|
|
void kernel_stack_overflow(struct pt_regs *regs)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-06-22 08:16:28 +08:00
|
|
|
bust_spinlocks(1);
|
|
|
|
printk("Kernel stack overflow.\n");
|
|
|
|
show_regs(regs);
|
|
|
|
bust_spinlocks(0);
|
2005-04-17 06:20:36 +08:00
|
|
|
panic("Corrupt kernel stack, can't continue.");
|
|
|
|
}
|
2014-10-22 18:42:38 +08:00
|
|
|
NOKPROBE_SYMBOL(kernel_stack_overflow);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
void __init trap_init(void)
|
|
|
|
{
|
2011-01-05 19:48:00 +08:00
|
|
|
local_mcck_enable();
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|