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-04-16 22:20:36 +00:00
|
|
|
/*
|
2015-06-05 11:02:28 +00:00
|
|
|
* Compatibility mode system call entry point for x86-64.
|
|
|
|
*
|
2005-04-16 22:20:36 +00:00
|
|
|
* Copyright 2000-2002 Andi Kleen, SuSE Labs.
|
2015-06-05 11:02:28 +00:00
|
|
|
*/
|
2015-06-03 16:29:26 +00:00
|
|
|
#include "calling.h"
|
2005-09-09 19:28:48 +00:00
|
|
|
#include <asm/asm-offsets.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/current.h>
|
|
|
|
#include <asm/errno.h>
|
2015-06-05 11:02:28 +00:00
|
|
|
#include <asm/ia32_unistd.h>
|
|
|
|
#include <asm/thread_info.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/segment.h>
|
2006-07-03 07:24:45 +00:00
|
|
|
#include <asm/irqflags.h>
|
2012-04-20 19:19:50 +00:00
|
|
|
#include <asm/asm.h>
|
2012-09-21 19:43:12 +00:00
|
|
|
#include <asm/smap.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/linkage.h>
|
2012-01-03 19:23:06 +00:00
|
|
|
#include <linux/err.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2011-03-07 18:10:39 +00:00
|
|
|
.section .entry.text, "ax"
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2016-03-10 03:00:35 +00:00
|
|
|
* 32-bit SYSENTER entry.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
2016-03-10 03:00:35 +00:00
|
|
|
* 32-bit system calls through the vDSO's __kernel_vsyscall enter here
|
|
|
|
* on 64-bit kernels running on Intel CPUs.
|
|
|
|
*
|
|
|
|
* The SYSENTER instruction, in principle, should *only* occur in the
|
|
|
|
* vDSO. In practice, a small number of Android devices were shipped
|
|
|
|
* with a copy of Bionic that inlined a SYSENTER instruction. This
|
|
|
|
* never happened in any of Google's Bionic versions -- it only happened
|
|
|
|
* in a narrow range of Intel-provided versions.
|
|
|
|
*
|
|
|
|
* SYSENTER loads SS, RSP, CS, and RIP from previously programmed MSRs.
|
|
|
|
* IF and VM in RFLAGS are cleared (IOW: interrupts are off).
|
2015-02-26 22:40:32 +00:00
|
|
|
* SYSENTER does not save anything on the stack,
|
2016-03-10 03:00:35 +00:00
|
|
|
* and does not save old RIP (!!!), RSP, or RFLAGS.
|
2015-02-26 22:40:32 +00:00
|
|
|
*
|
2005-04-16 22:20:36 +00:00
|
|
|
* Arguments:
|
2015-02-26 22:40:32 +00:00
|
|
|
* eax system call number
|
|
|
|
* ebx arg1
|
|
|
|
* ecx arg2
|
|
|
|
* edx arg3
|
|
|
|
* esi arg4
|
|
|
|
* edi arg5
|
|
|
|
* ebp user stack
|
|
|
|
* 0(%ebp) arg6
|
|
|
|
*/
|
2019-10-11 11:51:04 +00:00
|
|
|
SYM_FUNC_START(entry_SYSENTER_compat)
|
2015-10-06 00:47:55 +00:00
|
|
|
/* Interrupts are off on entry. */
|
2017-12-04 14:07:12 +00:00
|
|
|
SWAPGS
|
2017-12-04 14:07:35 +00:00
|
|
|
|
|
|
|
/* We are about to clobber %rsp anyway, clobbering here is OK */
|
|
|
|
SWITCH_TO_KERNEL_CR3 scratch_reg=%rsp
|
|
|
|
|
2015-04-24 15:31:35 +00:00
|
|
|
movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
|
2015-03-27 10:36:20 +00:00
|
|
|
|
2015-10-06 00:48:11 +00:00
|
|
|
/*
|
|
|
|
* User tracing code (ptrace or signal handlers) might assume that
|
|
|
|
* the saved RAX contains a 32-bit number when we're invoking a 32-bit
|
|
|
|
* syscall. Just in case the high bits are nonzero, zero-extend
|
|
|
|
* the syscall number. (This could almost certainly be deleted
|
|
|
|
* with no ill effects.)
|
|
|
|
*/
|
2015-03-27 10:36:21 +00:00
|
|
|
movl %eax, %eax
|
|
|
|
|
2015-03-31 17:00:04 +00:00
|
|
|
/* Construct struct pt_regs on stack */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq $__USER32_DS /* pt_regs->ss */
|
2015-12-17 07:18:48 +00:00
|
|
|
pushq %rbp /* pt_regs->sp (stashed in bp) */
|
2015-10-06 00:47:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Push flags. This is nasty. First, interrupts are currently
|
|
|
|
* off, but we need pt_regs->flags to have IF set. Second, even
|
|
|
|
* if TF was set when SYSENTER started, it's clear by now. We fix
|
|
|
|
* that later using TIF_SINGLESTEP.
|
|
|
|
*/
|
|
|
|
pushfq /* pt_regs->flags (except IF = 0) */
|
|
|
|
orl $X86_EFLAGS_IF, (%rsp) /* Fix saved flags */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq $__USER32_CS /* pt_regs->cs */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->ip = 0 (placeholder) */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq %rax /* pt_regs->orig_ax */
|
|
|
|
pushq %rdi /* pt_regs->di */
|
|
|
|
pushq %rsi /* pt_regs->si */
|
|
|
|
pushq %rdx /* pt_regs->dx */
|
2015-12-17 07:18:48 +00:00
|
|
|
pushq %rcx /* pt_regs->cx */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq $-ENOSYS /* pt_regs->ax */
|
2018-06-27 05:45:52 +00:00
|
|
|
pushq $0 /* pt_regs->r8 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r8d, %r8d /* nospec r8 */
|
2018-06-27 05:45:52 +00:00
|
|
|
pushq $0 /* pt_regs->r9 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r9d, %r9d /* nospec r9 */
|
2018-06-27 05:45:52 +00:00
|
|
|
pushq $0 /* pt_regs->r10 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r10d, %r10d /* nospec r10 */
|
2018-06-27 05:45:52 +00:00
|
|
|
pushq $0 /* pt_regs->r11 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r11d, %r11d /* nospec r11 */
|
2015-10-06 00:48:11 +00:00
|
|
|
pushq %rbx /* pt_regs->rbx */
|
2018-02-06 01:18:17 +00:00
|
|
|
xorl %ebx, %ebx /* nospec rbx */
|
2015-12-17 07:18:48 +00:00
|
|
|
pushq %rbp /* pt_regs->rbp (will be overwritten) */
|
2018-02-06 01:18:17 +00:00
|
|
|
xorl %ebp, %ebp /* nospec rbp */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r12 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r12d, %r12d /* nospec r12 */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r13 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r13d, %r13d /* nospec r13 */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r14 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r14d, %r14d /* nospec r14 */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r15 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r15d, %r15d /* nospec r15 */
|
2005-04-16 22:20:36 +00:00
|
|
|
cld
|
2015-03-31 17:00:04 +00:00
|
|
|
|
x86_64, entry: Filter RFLAGS.NT on entry from userspace
The NT flag doesn't do anything in long mode other than causing IRET
to #GP. Oddly, CPL3 code can still set NT using popf.
Entry via hardware or software interrupt clears NT automatically, so
the only relevant entries are fast syscalls.
If user code causes kernel code to run with NT set, then there's at
least some (small) chance that it could cause trouble. For example,
user code could cause a call to EFI code with NT set, and who knows
what would happen? Apparently some games on Wine sometimes do
this (!), and, if an IRET return happens, they will segfault. That
segfault cannot be handled, because signal delivery fails, too.
This patch programs the CPU to clear NT on entry via SYSCALL (both
32-bit and 64-bit, by my reading of the AMD APM), and it clears NT
in software on entry via SYSENTER.
To save a few cycles, this borrows a trick from Jan Beulich in Xen:
it checks whether NT is set before trying to clear it. As a result,
it seems to have very little effect on SYSENTER performance on my
machine.
There's another minor bug fix in here: it looks like the CFI
annotations were wrong if CONFIG_AUDITSYSCALL=n.
Testers beware: on Xen, SYSENTER with NT set turns into a GPF.
I haven't touched anything on 32-bit kernels.
The syscall mask change comes from a variant of this patch by Anish
Bhatt.
Note to stable maintainers: there is no known security issue here.
A misguided program can set NT and cause the kernel to try and fail
to deliver SIGSEGV, crashing the program. This patch fixes Far Cry
on Wine: https://bugs.winehq.org/show_bug.cgi?id=33275
Cc: <stable@vger.kernel.org>
Reported-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/395749a5d39a29bd3e4b35899cf3a3c1340e5595.1412189265.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-10-01 18:49:04 +00:00
|
|
|
/*
|
2016-03-10 03:00:25 +00:00
|
|
|
* SYSENTER doesn't filter flags, so we need to clear NT and AC
|
x86_64, entry: Filter RFLAGS.NT on entry from userspace
The NT flag doesn't do anything in long mode other than causing IRET
to #GP. Oddly, CPL3 code can still set NT using popf.
Entry via hardware or software interrupt clears NT automatically, so
the only relevant entries are fast syscalls.
If user code causes kernel code to run with NT set, then there's at
least some (small) chance that it could cause trouble. For example,
user code could cause a call to EFI code with NT set, and who knows
what would happen? Apparently some games on Wine sometimes do
this (!), and, if an IRET return happens, they will segfault. That
segfault cannot be handled, because signal delivery fails, too.
This patch programs the CPU to clear NT on entry via SYSCALL (both
32-bit and 64-bit, by my reading of the AMD APM), and it clears NT
in software on entry via SYSENTER.
To save a few cycles, this borrows a trick from Jan Beulich in Xen:
it checks whether NT is set before trying to clear it. As a result,
it seems to have very little effect on SYSENTER performance on my
machine.
There's another minor bug fix in here: it looks like the CFI
annotations were wrong if CONFIG_AUDITSYSCALL=n.
Testers beware: on Xen, SYSENTER with NT set turns into a GPF.
I haven't touched anything on 32-bit kernels.
The syscall mask change comes from a variant of this patch by Anish
Bhatt.
Note to stable maintainers: there is no known security issue here.
A misguided program can set NT and cause the kernel to try and fail
to deliver SIGSEGV, crashing the program. This patch fixes Far Cry
on Wine: https://bugs.winehq.org/show_bug.cgi?id=33275
Cc: <stable@vger.kernel.org>
Reported-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/395749a5d39a29bd3e4b35899cf3a3c1340e5595.1412189265.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-10-01 18:49:04 +00:00
|
|
|
* ourselves. To save a few cycles, we can check whether
|
2016-03-10 03:00:25 +00:00
|
|
|
* either was set instead of doing an unconditional popfq.
|
2015-10-06 00:47:55 +00:00
|
|
|
* This needs to happen before enabling interrupts so that
|
|
|
|
* we don't get preempted with NT set.
|
2015-10-09 17:08:59 +00:00
|
|
|
*
|
2016-03-10 03:00:30 +00:00
|
|
|
* If TF is set, we will single-step all the way to here -- do_debug
|
|
|
|
* will ignore all the traps. (Yes, this is slow, but so is
|
|
|
|
* single-stepping in general. This allows us to avoid having
|
|
|
|
* a more complicated code to handle the case where a user program
|
|
|
|
* forces us to single-step through the SYSENTER entry code.)
|
|
|
|
*
|
2015-12-12 10:27:57 +00:00
|
|
|
* NB.: .Lsysenter_fix_flags is a label with the code under it moved
|
2015-10-09 17:08:59 +00:00
|
|
|
* out-of-line as an optimization: NT is unlikely to be set in the
|
|
|
|
* majority of the cases and instead of polluting the I$ unnecessarily,
|
|
|
|
* we're keeping that code behind a branch which will predict as
|
|
|
|
* not-taken and therefore its instructions won't be fetched.
|
x86_64, entry: Filter RFLAGS.NT on entry from userspace
The NT flag doesn't do anything in long mode other than causing IRET
to #GP. Oddly, CPL3 code can still set NT using popf.
Entry via hardware or software interrupt clears NT automatically, so
the only relevant entries are fast syscalls.
If user code causes kernel code to run with NT set, then there's at
least some (small) chance that it could cause trouble. For example,
user code could cause a call to EFI code with NT set, and who knows
what would happen? Apparently some games on Wine sometimes do
this (!), and, if an IRET return happens, they will segfault. That
segfault cannot be handled, because signal delivery fails, too.
This patch programs the CPU to clear NT on entry via SYSCALL (both
32-bit and 64-bit, by my reading of the AMD APM), and it clears NT
in software on entry via SYSENTER.
To save a few cycles, this borrows a trick from Jan Beulich in Xen:
it checks whether NT is set before trying to clear it. As a result,
it seems to have very little effect on SYSENTER performance on my
machine.
There's another minor bug fix in here: it looks like the CFI
annotations were wrong if CONFIG_AUDITSYSCALL=n.
Testers beware: on Xen, SYSENTER with NT set turns into a GPF.
I haven't touched anything on 32-bit kernels.
The syscall mask change comes from a variant of this patch by Anish
Bhatt.
Note to stable maintainers: there is no known security issue here.
A misguided program can set NT and cause the kernel to try and fail
to deliver SIGSEGV, crashing the program. This patch fixes Far Cry
on Wine: https://bugs.winehq.org/show_bug.cgi?id=33275
Cc: <stable@vger.kernel.org>
Reported-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/395749a5d39a29bd3e4b35899cf3a3c1340e5595.1412189265.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-10-01 18:49:04 +00:00
|
|
|
*/
|
2016-03-10 03:00:30 +00:00
|
|
|
testl $X86_EFLAGS_NT|X86_EFLAGS_AC|X86_EFLAGS_TF, EFLAGS(%rsp)
|
2015-12-12 10:27:57 +00:00
|
|
|
jnz .Lsysenter_fix_flags
|
|
|
|
.Lsysenter_flags_fixed:
|
x86_64, entry: Filter RFLAGS.NT on entry from userspace
The NT flag doesn't do anything in long mode other than causing IRET
to #GP. Oddly, CPL3 code can still set NT using popf.
Entry via hardware or software interrupt clears NT automatically, so
the only relevant entries are fast syscalls.
If user code causes kernel code to run with NT set, then there's at
least some (small) chance that it could cause trouble. For example,
user code could cause a call to EFI code with NT set, and who knows
what would happen? Apparently some games on Wine sometimes do
this (!), and, if an IRET return happens, they will segfault. That
segfault cannot be handled, because signal delivery fails, too.
This patch programs the CPU to clear NT on entry via SYSCALL (both
32-bit and 64-bit, by my reading of the AMD APM), and it clears NT
in software on entry via SYSENTER.
To save a few cycles, this borrows a trick from Jan Beulich in Xen:
it checks whether NT is set before trying to clear it. As a result,
it seems to have very little effect on SYSENTER performance on my
machine.
There's another minor bug fix in here: it looks like the CFI
annotations were wrong if CONFIG_AUDITSYSCALL=n.
Testers beware: on Xen, SYSENTER with NT set turns into a GPF.
I haven't touched anything on 32-bit kernels.
The syscall mask change comes from a variant of this patch by Anish
Bhatt.
Note to stable maintainers: there is no known security issue here.
A misguided program can set NT and cause the kernel to try and fail
to deliver SIGSEGV, crashing the program. This patch fixes Far Cry
on Wine: https://bugs.winehq.org/show_bug.cgi?id=33275
Cc: <stable@vger.kernel.org>
Reported-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/395749a5d39a29bd3e4b35899cf3a3c1340e5595.1412189265.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2014-10-01 18:49:04 +00:00
|
|
|
|
2015-10-06 00:48:11 +00:00
|
|
|
/*
|
|
|
|
* User mode is traced as though IRQs are on, and SYSENTER
|
|
|
|
* turned them off.
|
|
|
|
*/
|
|
|
|
TRACE_IRQS_OFF
|
2015-10-06 00:48:02 +00:00
|
|
|
|
2015-10-06 00:48:11 +00:00
|
|
|
movq %rsp, %rdi
|
|
|
|
call do_fast_syscall_32
|
2015-11-19 21:55:45 +00:00
|
|
|
/* XEN PV guests always use IRET path */
|
|
|
|
ALTERNATIVE "testl %eax, %eax; jz .Lsyscall_32_done", \
|
|
|
|
"jmp .Lsyscall_32_done", X86_FEATURE_XENPV
|
2015-10-06 00:48:12 +00:00
|
|
|
jmp sysret32_from_system_call
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2015-12-12 10:27:57 +00:00
|
|
|
.Lsysenter_fix_flags:
|
2015-10-06 00:47:55 +00:00
|
|
|
pushq $X86_EFLAGS_FIXED
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
popfq
|
2015-12-12 10:27:57 +00:00
|
|
|
jmp .Lsysenter_flags_fixed
|
2019-10-11 11:50:57 +00:00
|
|
|
SYM_INNER_LABEL(__end_entry_SYSENTER_compat, SYM_L_GLOBAL)
|
2019-10-11 11:51:04 +00:00
|
|
|
SYM_FUNC_END(entry_SYSENTER_compat)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
2016-03-10 03:00:35 +00:00
|
|
|
* 32-bit SYSCALL entry.
|
|
|
|
*
|
|
|
|
* 32-bit system calls through the vDSO's __kernel_vsyscall enter here
|
|
|
|
* on 64-bit kernels running on AMD CPUs.
|
|
|
|
*
|
|
|
|
* The SYSCALL instruction, in principle, should *only* occur in the
|
|
|
|
* vDSO. In practice, it appears that this really is the case.
|
|
|
|
* As evidence:
|
|
|
|
*
|
|
|
|
* - The calling convention for SYSCALL has changed several times without
|
|
|
|
* anyone noticing.
|
|
|
|
*
|
|
|
|
* - Prior to the in-kernel X86_BUG_SYSRET_SS_ATTRS fixup, anything
|
|
|
|
* user task that did SYSCALL without immediately reloading SS
|
|
|
|
* would randomly crash.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
2016-03-10 03:00:35 +00:00
|
|
|
* - Most programmers do not directly target AMD CPUs, and the 32-bit
|
|
|
|
* SYSCALL instruction does not exist on Intel CPUs. Even on AMD
|
|
|
|
* CPUs, Linux disables the SYSCALL instruction on 32-bit kernels
|
|
|
|
* because the SYSCALL instruction in legacy/native 32-bit mode (as
|
|
|
|
* opposed to compat mode) is sufficiently poorly designed as to be
|
|
|
|
* essentially unusable.
|
2015-02-26 22:40:32 +00:00
|
|
|
*
|
2016-03-10 03:00:35 +00:00
|
|
|
* 32-bit SYSCALL saves RIP to RCX, clears RFLAGS.RF, then saves
|
|
|
|
* RFLAGS to R11, then loads new SS, CS, and RIP from previously
|
|
|
|
* programmed MSRs. RFLAGS gets masked by a value from another MSR
|
|
|
|
* (so CLD and CLAC are not needed). SYSCALL does not save anything on
|
|
|
|
* the stack and does not change RSP.
|
|
|
|
*
|
|
|
|
* Note: RFLAGS saving+masking-with-MSR happens only in Long mode
|
2015-06-05 11:02:28 +00:00
|
|
|
* (in legacy 32-bit mode, IF, RF and VM bits are cleared and that's it).
|
2016-03-10 03:00:35 +00:00
|
|
|
* Don't get confused: RFLAGS saving+masking depends on Long Mode Active bit
|
2015-02-26 22:40:32 +00:00
|
|
|
* (EFER.LMA=1), NOT on bitness of userspace where SYSCALL executes
|
|
|
|
* or target CS descriptor's L bit (SYSCALL does not read segment descriptors).
|
|
|
|
*
|
2005-04-16 22:20:36 +00:00
|
|
|
* Arguments:
|
2015-02-26 22:40:32 +00:00
|
|
|
* eax system call number
|
|
|
|
* ecx return address
|
|
|
|
* ebx arg1
|
|
|
|
* ebp arg2 (note: not saved in the stack frame, should not be touched)
|
|
|
|
* edx arg3
|
|
|
|
* esi arg4
|
|
|
|
* edi arg5
|
|
|
|
* esp user stack
|
|
|
|
* 0(%esp) arg6
|
|
|
|
*/
|
2019-10-11 11:51:03 +00:00
|
|
|
SYM_CODE_START(entry_SYSCALL_compat)
|
2015-10-06 00:48:11 +00:00
|
|
|
/* Interrupts are off on entry. */
|
2017-08-08 03:59:21 +00:00
|
|
|
swapgs
|
2015-10-06 00:48:02 +00:00
|
|
|
|
2018-01-03 18:52:04 +00:00
|
|
|
/* Stash user ESP */
|
2015-06-05 11:02:28 +00:00
|
|
|
movl %esp, %r8d
|
2018-01-03 18:52:04 +00:00
|
|
|
|
|
|
|
/* Use %rsp as scratch reg. User ESP is stashed in r8 */
|
|
|
|
SWITCH_TO_KERNEL_CR3 scratch_reg=%rsp
|
|
|
|
|
|
|
|
/* Switch to the kernel stack */
|
2015-06-05 11:02:28 +00:00
|
|
|
movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
|
2015-03-27 10:36:20 +00:00
|
|
|
|
2015-03-31 17:00:04 +00:00
|
|
|
/* Construct struct pt_regs on stack */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq $__USER32_DS /* pt_regs->ss */
|
|
|
|
pushq %r8 /* pt_regs->sp */
|
|
|
|
pushq %r11 /* pt_regs->flags */
|
|
|
|
pushq $__USER32_CS /* pt_regs->cs */
|
|
|
|
pushq %rcx /* pt_regs->ip */
|
2019-10-11 11:50:57 +00:00
|
|
|
SYM_INNER_LABEL(entry_SYSCALL_compat_after_hwframe, SYM_L_GLOBAL)
|
2017-08-08 03:59:21 +00:00
|
|
|
movl %eax, %eax /* discard orig_ax high bits */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq %rax /* pt_regs->orig_ax */
|
|
|
|
pushq %rdi /* pt_regs->di */
|
|
|
|
pushq %rsi /* pt_regs->si */
|
2018-04-05 09:53:06 +00:00
|
|
|
xorl %esi, %esi /* nospec si */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq %rdx /* pt_regs->dx */
|
2018-04-05 09:53:06 +00:00
|
|
|
xorl %edx, %edx /* nospec dx */
|
2015-12-17 07:18:48 +00:00
|
|
|
pushq %rbp /* pt_regs->cx (stashed in bp) */
|
2018-04-05 09:53:06 +00:00
|
|
|
xorl %ecx, %ecx /* nospec cx */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq $-ENOSYS /* pt_regs->ax */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r8 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r8d, %r8d /* nospec r8 */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r9 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r9d, %r9d /* nospec r9 */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r10 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r10d, %r10d /* nospec r10 */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r11 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r11d, %r11d /* nospec r11 */
|
2015-10-06 00:48:11 +00:00
|
|
|
pushq %rbx /* pt_regs->rbx */
|
2018-02-06 01:18:17 +00:00
|
|
|
xorl %ebx, %ebx /* nospec rbx */
|
2015-12-17 07:18:48 +00:00
|
|
|
pushq %rbp /* pt_regs->rbp (will be overwritten) */
|
2018-02-06 01:18:17 +00:00
|
|
|
xorl %ebp, %ebp /* nospec rbp */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r12 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r12d, %r12d /* nospec r12 */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r13 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r13d, %r13d /* nospec r13 */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r14 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r14d, %r14d /* nospec r14 */
|
2016-05-02 14:56:50 +00:00
|
|
|
pushq $0 /* pt_regs->r15 = 0 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r15d, %r15d /* nospec r15 */
|
2015-03-31 17:00:04 +00:00
|
|
|
|
2015-10-06 00:48:11 +00:00
|
|
|
/*
|
|
|
|
* User mode is traced as though IRQs are on, and SYSENTER
|
|
|
|
* turned them off.
|
|
|
|
*/
|
|
|
|
TRACE_IRQS_OFF
|
|
|
|
|
|
|
|
movq %rsp, %rdi
|
|
|
|
call do_fast_syscall_32
|
2015-11-19 21:55:45 +00:00
|
|
|
/* XEN PV guests always use IRET path */
|
|
|
|
ALTERNATIVE "testl %eax, %eax; jz .Lsyscall_32_done", \
|
|
|
|
"jmp .Lsyscall_32_done", X86_FEATURE_XENPV
|
2015-10-06 00:48:12 +00:00
|
|
|
|
|
|
|
/* Opportunistic SYSRET */
|
|
|
|
sysret32_from_system_call:
|
2018-08-16 22:16:58 +00:00
|
|
|
/*
|
|
|
|
* We are not going to return to userspace from the trampoline
|
|
|
|
* stack. So let's erase the thread stack right now.
|
|
|
|
*/
|
|
|
|
STACKLEAK_ERASE
|
2015-10-06 00:48:12 +00:00
|
|
|
TRACE_IRQS_ON /* User mode traces as IRQs on. */
|
|
|
|
movq RBX(%rsp), %rbx /* pt_regs->rbx */
|
|
|
|
movq RBP(%rsp), %rbp /* pt_regs->rbp */
|
|
|
|
movq EFLAGS(%rsp), %r11 /* pt_regs->flags (in r11) */
|
|
|
|
movq RIP(%rsp), %rcx /* pt_regs->ip (in rcx) */
|
|
|
|
addq $RAX, %rsp /* Skip r8-r15 */
|
|
|
|
popq %rax /* pt_regs->rax */
|
|
|
|
popq %rdx /* Skip pt_regs->cx */
|
|
|
|
popq %rdx /* pt_regs->dx */
|
|
|
|
popq %rsi /* pt_regs->si */
|
|
|
|
popq %rdi /* pt_regs->di */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* USERGS_SYSRET32 does:
|
|
|
|
* GSBASE = user's GS base
|
|
|
|
* EIP = ECX
|
|
|
|
* RFLAGS = R11
|
|
|
|
* CS = __USER32_CS
|
|
|
|
* SS = __USER_DS
|
|
|
|
*
|
|
|
|
* ECX will not match pt_regs->cx, but we're returning to a vDSO
|
|
|
|
* trampoline that will fix up RCX, so this is okay.
|
|
|
|
*
|
|
|
|
* R12-R15 are callee-saved, so they contain whatever was in them
|
|
|
|
* when the system call started, which is already known to user
|
|
|
|
* code. We zero R8-R10 to avoid info leaks.
|
|
|
|
*/
|
2017-12-04 14:07:35 +00:00
|
|
|
movq RSP-ORIG_RAX(%rsp), %rsp
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The original userspace %rsp (RSP-ORIG_RAX(%rsp)) is stored
|
|
|
|
* on the process stack which is not mapped to userspace and
|
|
|
|
* not readable after we SWITCH_TO_USER_CR3. Delay the CR3
|
|
|
|
* switch until after after the last reference to the process
|
|
|
|
* stack.
|
|
|
|
*
|
2017-12-04 14:07:59 +00:00
|
|
|
* %r8/%r9 are zeroed before the sysret, thus safe to clobber.
|
2017-12-04 14:07:35 +00:00
|
|
|
*/
|
2017-12-04 14:07:59 +00:00
|
|
|
SWITCH_TO_USER_CR3_NOSTACK scratch_reg=%r8 scratch_reg2=%r9
|
2017-12-04 14:07:35 +00:00
|
|
|
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r8d, %r8d
|
|
|
|
xorl %r9d, %r9d
|
|
|
|
xorl %r10d, %r10d
|
2015-11-19 21:55:47 +00:00
|
|
|
swapgs
|
|
|
|
sysretl
|
2019-10-11 11:51:03 +00:00
|
|
|
SYM_CODE_END(entry_SYSCALL_compat)
|
2015-06-05 11:02:28 +00:00
|
|
|
|
2015-02-26 22:40:32 +00:00
|
|
|
/*
|
2016-03-10 03:00:35 +00:00
|
|
|
* 32-bit legacy system call entry.
|
|
|
|
*
|
|
|
|
* 32-bit x86 Linux system calls traditionally used the INT $0x80
|
|
|
|
* instruction. INT $0x80 lands here.
|
|
|
|
*
|
|
|
|
* This entry point can be used by 32-bit and 64-bit programs to perform
|
|
|
|
* 32-bit system calls. Instances of INT $0x80 can be found inline in
|
|
|
|
* various programs and libraries. It is also used by the vDSO's
|
|
|
|
* __kernel_vsyscall fallback for hardware that doesn't support a faster
|
|
|
|
* entry method. Restarted 32-bit system calls also fall back to INT
|
|
|
|
* $0x80 regardless of what instruction was originally used to do the
|
|
|
|
* system call.
|
|
|
|
*
|
|
|
|
* This is considered a slow path. It is not used by most libc
|
|
|
|
* implementations on modern hardware except during process startup.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
2015-02-26 22:40:32 +00:00
|
|
|
* Arguments:
|
|
|
|
* eax system call number
|
|
|
|
* ebx arg1
|
|
|
|
* ecx arg2
|
|
|
|
* edx arg3
|
|
|
|
* esi arg4
|
|
|
|
* edi arg5
|
2016-03-10 03:00:35 +00:00
|
|
|
* ebp arg6
|
2015-02-26 22:40:32 +00:00
|
|
|
*/
|
2019-10-11 11:51:03 +00:00
|
|
|
SYM_CODE_START(entry_INT80_compat)
|
2006-07-03 07:24:45 +00:00
|
|
|
/*
|
2015-03-27 10:36:20 +00:00
|
|
|
* Interrupts are off on entry.
|
2006-07-03 07:24:45 +00:00
|
|
|
*/
|
2016-02-24 20:18:49 +00:00
|
|
|
ASM_CLAC /* Do this early to minimize exposure */
|
2015-03-27 10:36:20 +00:00
|
|
|
SWAPGS
|
|
|
|
|
2015-10-06 00:48:09 +00:00
|
|
|
/*
|
|
|
|
* User tracing code (ptrace or signal handlers) might assume that
|
|
|
|
* the saved RAX contains a 32-bit number when we're invoking a 32-bit
|
|
|
|
* syscall. Just in case the high bits are nonzero, zero-extend
|
|
|
|
* the syscall number. (This could almost certainly be deleted
|
|
|
|
* with no ill effects.)
|
|
|
|
*/
|
2015-06-05 11:02:28 +00:00
|
|
|
movl %eax, %eax
|
2015-03-27 10:36:21 +00:00
|
|
|
|
2018-02-20 21:01:13 +00:00
|
|
|
/* switch to thread stack expects orig_ax and rdi to be pushed */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq %rax /* pt_regs->orig_ax */
|
2018-02-20 21:01:13 +00:00
|
|
|
pushq %rdi /* pt_regs->di */
|
|
|
|
|
|
|
|
/* Need to switch before accessing the thread stack. */
|
|
|
|
SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi
|
2019-01-15 16:58:16 +00:00
|
|
|
/* In the Xen PV case we already run on the thread stack. */
|
|
|
|
ALTERNATIVE "movq %rsp, %rdi", "jmp .Lint80_keep_stack", X86_FEATURE_XENPV
|
2018-02-20 21:01:13 +00:00
|
|
|
movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
|
|
|
|
|
|
|
|
pushq 6*8(%rdi) /* regs->ss */
|
|
|
|
pushq 5*8(%rdi) /* regs->rsp */
|
|
|
|
pushq 4*8(%rdi) /* regs->eflags */
|
|
|
|
pushq 3*8(%rdi) /* regs->cs */
|
|
|
|
pushq 2*8(%rdi) /* regs->ip */
|
|
|
|
pushq 1*8(%rdi) /* regs->orig_ax */
|
2018-03-06 21:18:09 +00:00
|
|
|
pushq (%rdi) /* pt_regs->di */
|
2019-01-15 16:58:16 +00:00
|
|
|
.Lint80_keep_stack:
|
|
|
|
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq %rsi /* pt_regs->si */
|
2018-04-05 09:53:06 +00:00
|
|
|
xorl %esi, %esi /* nospec si */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq %rdx /* pt_regs->dx */
|
2018-04-05 09:53:06 +00:00
|
|
|
xorl %edx, %edx /* nospec dx */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq %rcx /* pt_regs->cx */
|
2018-04-05 09:53:06 +00:00
|
|
|
xorl %ecx, %ecx /* nospec cx */
|
x86/debug: Remove perpetually broken, unmaintainable dwarf annotations
So the dwarf2 annotations in low level assembly code have
become an increasing hindrance: unreadable, messy macros
mixed into some of the most security sensitive code paths
of the Linux kernel.
These debug info annotations don't even buy the upstream
kernel anything: dwarf driven stack unwinding has caused
problems in the past so it's out of tree, and the upstream
kernel only uses the much more robust framepointers based
stack unwinding method.
In addition to that there's a steady, slow bitrot going
on with these annotations, requiring frequent fixups.
There's no tooling and no functionality upstream that
keeps it correct.
So burn down the sick forest, allowing new, healthier growth:
27 files changed, 350 insertions(+), 1101 deletions(-)
Someone who has the willingness and time to do this
properly can attempt to reintroduce dwarf debuginfo in x86
assembly code plus dwarf unwinding from first principles,
with the following conditions:
- it should be maximally readable, and maximally low-key to
'ordinary' code reading and maintenance.
- find a build time method to insert dwarf annotations
automatically in the most common cases, for pop/push
instructions that manipulate the stack pointer. This could
be done for example via a preprocessing step that just
looks for common patterns - plus special annotations for
the few cases where we want to depart from the default.
We have hundreds of CFI annotations, so automating most of
that makes sense.
- it should come with build tooling checks that ensure that
CFI annotations are sensible. We've seen such efforts from
the framepointer side, and there's no reason it couldn't be
done on the dwarf side.
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-05-28 10:21:47 +00:00
|
|
|
pushq $-ENOSYS /* pt_regs->ax */
|
2018-06-27 05:45:52 +00:00
|
|
|
pushq %r8 /* pt_regs->r8 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r8d, %r8d /* nospec r8 */
|
2018-06-27 05:45:52 +00:00
|
|
|
pushq %r9 /* pt_regs->r9 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r9d, %r9d /* nospec r9 */
|
2018-06-27 05:45:52 +00:00
|
|
|
pushq %r10 /* pt_regs->r10*/
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r10d, %r10d /* nospec r10 */
|
2018-06-27 05:45:52 +00:00
|
|
|
pushq %r11 /* pt_regs->r11 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r11d, %r11d /* nospec r11 */
|
2015-10-06 00:48:05 +00:00
|
|
|
pushq %rbx /* pt_regs->rbx */
|
2018-02-06 01:18:17 +00:00
|
|
|
xorl %ebx, %ebx /* nospec rbx */
|
2015-10-06 00:48:05 +00:00
|
|
|
pushq %rbp /* pt_regs->rbp */
|
2018-02-06 01:18:17 +00:00
|
|
|
xorl %ebp, %ebp /* nospec rbp */
|
2015-10-06 00:48:05 +00:00
|
|
|
pushq %r12 /* pt_regs->r12 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r12d, %r12d /* nospec r12 */
|
2015-10-06 00:48:05 +00:00
|
|
|
pushq %r13 /* pt_regs->r13 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r13d, %r13d /* nospec r13 */
|
2015-10-06 00:48:05 +00:00
|
|
|
pushq %r14 /* pt_regs->r14 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r14d, %r14d /* nospec r14 */
|
2015-10-06 00:48:05 +00:00
|
|
|
pushq %r15 /* pt_regs->r15 */
|
2018-02-14 17:59:24 +00:00
|
|
|
xorl %r15d, %r15d /* nospec r15 */
|
2005-04-16 22:20:36 +00:00
|
|
|
cld
|
2015-06-05 11:02:28 +00:00
|
|
|
|
2015-06-02 19:04:02 +00:00
|
|
|
/*
|
2015-10-06 00:48:09 +00:00
|
|
|
* User mode is traced as though IRQs are on, and the interrupt
|
|
|
|
* gate turned them off.
|
2015-06-02 19:04:02 +00:00
|
|
|
*/
|
2015-10-06 00:48:09 +00:00
|
|
|
TRACE_IRQS_OFF
|
|
|
|
|
|
|
|
movq %rsp, %rdi
|
2016-03-09 21:24:32 +00:00
|
|
|
call do_int80_syscall_32
|
2015-10-06 00:48:11 +00:00
|
|
|
.Lsyscall_32_done:
|
2015-10-06 00:48:09 +00:00
|
|
|
|
|
|
|
/* Go back to user mode. */
|
|
|
|
TRACE_IRQS_ON
|
2017-11-02 07:59:00 +00:00
|
|
|
jmp swapgs_restore_regs_and_return_to_usermode
|
2019-10-11 11:51:03 +00:00
|
|
|
SYM_CODE_END(entry_INT80_compat)
|