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
|
|
|
/*
|
2014-10-30 05:33:46 +08:00
|
|
|
* Copyright (c) 2012-2014 Andy Lutomirski <luto@amacapital.net>
|
|
|
|
*
|
|
|
|
* Based on the original implementation which is:
|
2005-04-17 06:20:36 +08:00
|
|
|
* Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE
|
|
|
|
* Copyright 2003 Andi Kleen, SuSE Labs.
|
|
|
|
*
|
2014-10-30 05:33:46 +08:00
|
|
|
* Parts of the original code have been moved to arch/x86/vdso/vma.c
|
|
|
|
*
|
|
|
|
* This file implements vsyscall emulation. vsyscalls are a legacy ABI:
|
|
|
|
* Userspace can request certain kernel services by calling fixed
|
|
|
|
* addresses. This concept is problematic:
|
2011-06-06 01:50:24 +08:00
|
|
|
*
|
2014-10-30 05:33:46 +08:00
|
|
|
* - It interferes with ASLR.
|
|
|
|
* - It's awkward to write code that lives in kernel addresses but is
|
|
|
|
* callable by userspace at fixed addresses.
|
|
|
|
* - The whole concept is impossible for 32-bit compat userspace.
|
|
|
|
* - UML cannot easily virtualize a vsyscall.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2014-10-30 05:33:46 +08:00
|
|
|
* As of mid-2014, I believe that there is no new userspace code that
|
|
|
|
* will use a vsyscall if the vDSO is present. I hope that there will
|
|
|
|
* soon be no new userspace code that will ever use a vsyscall.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2014-10-30 05:33:46 +08:00
|
|
|
* The code in this file emulates vsyscalls when notified of a page
|
|
|
|
* fault to a vsyscall address.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/timer.h>
|
2017-02-09 01:51:30 +08:00
|
|
|
#include <linux/sched/signal.h>
|
2017-02-04 07:16:44 +08:00
|
|
|
#include <linux/mm_types.h>
|
2011-06-06 01:50:24 +08:00
|
|
|
#include <linux/syscalls.h>
|
|
|
|
#include <linux/ratelimit.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/vsyscall.h>
|
2007-02-16 17:28:21 +08:00
|
|
|
#include <asm/unistd.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/fixmap.h>
|
2011-06-06 01:50:24 +08:00
|
|
|
#include <asm/traps.h>
|
2017-12-11 14:47:19 +08:00
|
|
|
#include <asm/paravirt.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-08-03 21:31:54 +08:00
|
|
|
#define CREATE_TRACE_POINTS
|
|
|
|
#include "vsyscall_trace.h"
|
|
|
|
|
2019-06-27 12:45:08 +08:00
|
|
|
static enum { EMULATE, XONLY, NONE } vsyscall_mode __ro_after_init =
|
x86/vsyscall/64: Drop "native" vsyscalls
Since Linux v3.2, vsyscalls have been deprecated and slow. From v3.2
on, Linux had three vsyscall modes: "native", "emulate", and "none".
"emulate" is the default. All known user programs work correctly in
emulate mode, but vsyscalls turn into page faults and are emulated.
This is very slow. In "native" mode, the vsyscall page is easily
usable as an exploit gadget, but vsyscalls are a bit faster -- they
turn into normal syscalls. (This is in contrast to vDSO functions,
which can be much faster than syscalls.) In "none" mode, there are
no vsyscalls.
For all practical purposes, "native" was really just a chicken bit
in case something went wrong with the emulation. It's been over six
years, and nothing has gone wrong. Delete it.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Kernel Hardening <kernel-hardening@lists.openwall.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/519fee5268faea09ae550776ce969fa6e88668b0.1520449896.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-03-08 03:12:27 +08:00
|
|
|
#ifdef CONFIG_LEGACY_VSYSCALL_NONE
|
2015-08-13 08:55:19 +08:00
|
|
|
NONE;
|
2019-06-27 12:45:03 +08:00
|
|
|
#elif defined(CONFIG_LEGACY_VSYSCALL_XONLY)
|
|
|
|
XONLY;
|
2015-08-13 08:55:19 +08:00
|
|
|
#else
|
|
|
|
EMULATE;
|
|
|
|
#endif
|
2011-08-10 23:15:32 +08:00
|
|
|
|
|
|
|
static int __init vsyscall_setup(char *str)
|
|
|
|
{
|
|
|
|
if (str) {
|
|
|
|
if (!strcmp("emulate", str))
|
|
|
|
vsyscall_mode = EMULATE;
|
2019-06-27 12:45:03 +08:00
|
|
|
else if (!strcmp("xonly", str))
|
|
|
|
vsyscall_mode = XONLY;
|
2011-08-10 23:15:32 +08:00
|
|
|
else if (!strcmp("none", str))
|
|
|
|
vsyscall_mode = NONE;
|
|
|
|
else
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
early_param("vsyscall", vsyscall_setup);
|
|
|
|
|
2011-06-06 01:50:24 +08:00
|
|
|
static void warn_bad_vsyscall(const char *level, struct pt_regs *regs,
|
|
|
|
const char *message)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2012-05-22 10:50:07 +08:00
|
|
|
if (!show_unhandled_signals)
|
2011-06-06 01:50:24 +08:00
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-07-26 07:30:27 +08:00
|
|
|
printk_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n",
|
|
|
|
level, current->comm, task_pid_nr(current),
|
|
|
|
message, regs->ip, regs->cs,
|
|
|
|
regs->sp, regs->ax, regs->si, regs->di);
|
2011-07-13 21:24:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int addr_to_vsyscall_nr(unsigned long addr)
|
|
|
|
{
|
|
|
|
int nr;
|
|
|
|
|
2014-05-06 03:19:36 +08:00
|
|
|
if ((addr & ~0xC00UL) != VSYSCALL_ADDR)
|
2011-07-13 21:24:09 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
nr = (addr & 0xC00UL) >> 10;
|
|
|
|
if (nr >= 3)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
return nr;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2011-11-08 08:33:40 +08:00
|
|
|
static bool write_ok_or_segv(unsigned long ptr, size_t size)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* XXX: if access_ok, get_user, and put_user handled
|
2016-07-15 16:21:11 +08:00
|
|
|
* sig_on_uaccess_err, this could go away.
|
2011-11-08 08:33:40 +08:00
|
|
|
*/
|
|
|
|
|
Remove 'type' argument from access_ok() function
Nobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argument
of the user address range verification function since we got rid of the
old racy i386-only code to walk page tables by hand.
It existed because the original 80386 would not honor the write protect
bit when in kernel mode, so you had to do COW by hand before doing any
user access. But we haven't supported that in a long time, and these
days the 'type' argument is a purely historical artifact.
A discussion about extending 'user_access_begin()' to do the range
checking resulted this patch, because there is no way we're going to
move the old VERIFY_xyz interface to that model. And it's best done at
the end of the merge window when I've done most of my merges, so let's
just get this done once and for all.
This patch was mostly done with a sed-script, with manual fix-ups for
the cases that weren't of the trivial 'access_ok(VERIFY_xyz' form.
There were a couple of notable cases:
- csky still had the old "verify_area()" name as an alias.
- the iter_iov code had magical hardcoded knowledge of the actual
values of VERIFY_{READ,WRITE} (not that they mattered, since nothing
really used it)
- microblaze used the type argument for a debug printout
but other than those oddities this should be a total no-op patch.
I tried to fix up all architectures, did fairly extensive grepping for
access_ok() uses, and the changes are trivial, but I may have missed
something. Any missed conversion should be trivially fixable, though.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-01-04 10:57:57 +08:00
|
|
|
if (!access_ok((void __user *)ptr, size)) {
|
2011-11-08 08:33:40 +08:00
|
|
|
struct thread_struct *thread = ¤t->thread;
|
|
|
|
|
2018-11-22 07:11:26 +08:00
|
|
|
thread->error_code = X86_PF_USER | X86_PF_WRITE;
|
2011-11-08 08:33:40 +08:00
|
|
|
thread->cr2 = ptr;
|
2012-03-12 17:25:55 +08:00
|
|
|
thread->trap_nr = X86_TRAP_PF;
|
2011-11-08 08:33:40 +08:00
|
|
|
|
2019-05-24 00:04:24 +08:00
|
|
|
force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)ptr);
|
2011-11-08 08:33:40 +08:00
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-27 12:45:04 +08:00
|
|
|
bool emulate_vsyscall(unsigned long error_code,
|
|
|
|
struct pt_regs *regs, unsigned long address)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-06-06 01:50:24 +08:00
|
|
|
struct task_struct *tsk;
|
|
|
|
unsigned long caller;
|
2012-10-02 02:40:45 +08:00
|
|
|
int vsyscall_nr, syscall_nr, tmp;
|
2016-07-15 16:21:11 +08:00
|
|
|
int prev_sig_on_uaccess_err;
|
2011-06-06 01:50:24 +08:00
|
|
|
long ret;
|
syscalls/x86: Use 'struct pt_regs' based syscall calling convention for 64-bit syscalls
Let's make use of ARCH_HAS_SYSCALL_WRAPPER=y on pure 64-bit x86-64 systems:
Each syscall defines a stub which takes struct pt_regs as its only
argument. It decodes just those parameters it needs, e.g:
asmlinkage long sys_xyzzy(const struct pt_regs *regs)
{
return SyS_xyzzy(regs->di, regs->si, regs->dx);
}
This approach avoids leaking random user-provided register content down
the call chain.
For example, for sys_recv() which is a 4-parameter syscall, the assembly
now is (in slightly reordered fashion):
<sys_recv>:
callq <__fentry__>
/* decode regs->di, ->si, ->dx and ->r10 */
mov 0x70(%rdi),%rdi
mov 0x68(%rdi),%rsi
mov 0x60(%rdi),%rdx
mov 0x38(%rdi),%rcx
[ SyS_recv() is automatically inlined by the compiler,
as it is not [yet] used anywhere else ]
/* clear %r9 and %r8, the 5th and 6th args */
xor %r9d,%r9d
xor %r8d,%r8d
/* do the actual work */
callq __sys_recvfrom
/* cleanup and return */
cltq
retq
The only valid place in an x86-64 kernel which rightfully calls
a syscall function on its own -- vsyscall -- needs to be modified
to pass struct pt_regs onwards as well.
To keep the syscall table generation working independent of
SYSCALL_PTREGS being enabled, the stubs are named the same as the
"original" syscall stubs, i.e. sys_*().
This patch is based on an original proof-of-concept
| From: Linus Torvalds <torvalds@linux-foundation.org>
| Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
and was split up and heavily modified by me, in particular to base it on
ARCH_HAS_SYSCALL_WRAPPER, to limit it to 64-bit-only for the time being,
and to update the vsyscall to the new calling convention.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20180405095307.3730-4-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-04-05 17:53:02 +08:00
|
|
|
unsigned long orig_dx;
|
2011-06-06 01:50:24 +08:00
|
|
|
|
2019-06-27 12:45:04 +08:00
|
|
|
/* Write faults or kernel-privilege faults never get fixed up. */
|
|
|
|
if ((error_code & (X86_PF_WRITE | X86_PF_USER)) != X86_PF_USER)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!(error_code & X86_PF_INSTR)) {
|
|
|
|
/* Failed vsyscall read */
|
|
|
|
if (vsyscall_mode == EMULATE)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* User code tried and failed to read the vsyscall page.
|
|
|
|
*/
|
|
|
|
warn_bad_vsyscall(KERN_INFO, regs, "vsyscall read attempt denied -- look up the vsyscall kernel parameter if you need a workaround");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-08-10 23:15:32 +08:00
|
|
|
/*
|
|
|
|
* No point in checking CS -- the only way to get here is a user mode
|
|
|
|
* trap to a high address, which means that we're in 64-bit user code.
|
|
|
|
*/
|
2011-06-06 01:50:24 +08:00
|
|
|
|
2011-08-10 23:15:32 +08:00
|
|
|
WARN_ON_ONCE(address != regs->ip);
|
2011-07-13 21:24:09 +08:00
|
|
|
|
2011-08-10 23:15:32 +08:00
|
|
|
if (vsyscall_mode == NONE) {
|
|
|
|
warn_bad_vsyscall(KERN_INFO, regs,
|
|
|
|
"vsyscall attempted with vsyscall=none");
|
|
|
|
return false;
|
2011-07-13 21:24:09 +08:00
|
|
|
}
|
|
|
|
|
2011-08-10 23:15:32 +08:00
|
|
|
vsyscall_nr = addr_to_vsyscall_nr(address);
|
2011-08-03 21:31:54 +08:00
|
|
|
|
|
|
|
trace_emulate_vsyscall(vsyscall_nr);
|
|
|
|
|
2011-07-13 21:24:09 +08:00
|
|
|
if (vsyscall_nr < 0) {
|
|
|
|
warn_bad_vsyscall(KERN_WARNING, regs,
|
2011-08-10 23:15:32 +08:00
|
|
|
"misaligned vsyscall (exploit attempt or buggy program) -- look up the vsyscall kernel parameter if you need a workaround");
|
2011-06-06 01:50:24 +08:00
|
|
|
goto sigsegv;
|
|
|
|
}
|
2007-05-21 20:31:52 +08:00
|
|
|
|
2011-06-06 01:50:24 +08:00
|
|
|
if (get_user(caller, (unsigned long __user *)regs->sp) != 0) {
|
2011-08-10 23:15:32 +08:00
|
|
|
warn_bad_vsyscall(KERN_WARNING, regs,
|
|
|
|
"vsyscall with bad stack (exploit attempt?)");
|
2011-06-06 01:50:24 +08:00
|
|
|
goto sigsegv;
|
|
|
|
}
|
2010-07-14 08:56:18 +08:00
|
|
|
|
2011-06-06 01:50:24 +08:00
|
|
|
tsk = current;
|
2011-11-08 08:33:40 +08:00
|
|
|
|
|
|
|
/*
|
2012-10-02 02:40:45 +08:00
|
|
|
* Check for access_ok violations and find the syscall nr.
|
|
|
|
*
|
2012-04-02 02:48:04 +08:00
|
|
|
* NULL is a valid user pointer (in the access_ok sense) on 32-bit and
|
2011-11-08 08:33:40 +08:00
|
|
|
* 64-bit, so we don't need to special-case it here. For all the
|
2012-04-02 02:48:04 +08:00
|
|
|
* vsyscalls, NULL means "don't write anything" not "write it at
|
2011-11-08 08:33:40 +08:00
|
|
|
* address 0".
|
|
|
|
*/
|
2011-06-06 01:50:24 +08:00
|
|
|
switch (vsyscall_nr) {
|
|
|
|
case 0:
|
2017-11-23 21:29:37 +08:00
|
|
|
if (!write_ok_or_segv(regs->di, sizeof(struct __kernel_old_timeval)) ||
|
2012-10-02 02:40:45 +08:00
|
|
|
!write_ok_or_segv(regs->si, sizeof(struct timezone))) {
|
|
|
|
ret = -EFAULT;
|
|
|
|
goto check_fault;
|
|
|
|
}
|
2011-11-08 08:33:40 +08:00
|
|
|
|
2012-10-02 02:40:45 +08:00
|
|
|
syscall_nr = __NR_gettimeofday;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2019-11-05 18:10:01 +08:00
|
|
|
if (!write_ok_or_segv(regs->di, sizeof(__kernel_old_time_t))) {
|
2012-10-02 02:40:45 +08:00
|
|
|
ret = -EFAULT;
|
|
|
|
goto check_fault;
|
|
|
|
}
|
|
|
|
|
|
|
|
syscall_nr = __NR_time;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
if (!write_ok_or_segv(regs->di, sizeof(unsigned)) ||
|
|
|
|
!write_ok_or_segv(regs->si, sizeof(unsigned))) {
|
|
|
|
ret = -EFAULT;
|
|
|
|
goto check_fault;
|
|
|
|
}
|
|
|
|
|
|
|
|
syscall_nr = __NR_getcpu;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle seccomp. regs->ip must be the original value.
|
2018-05-09 02:14:57 +08:00
|
|
|
* See seccomp_send_sigsys and Documentation/userspace-api/seccomp_filter.rst.
|
2012-10-02 02:40:45 +08:00
|
|
|
*
|
|
|
|
* We could optimize the seccomp disabled case, but performance
|
|
|
|
* here doesn't matter.
|
|
|
|
*/
|
|
|
|
regs->orig_ax = syscall_nr;
|
|
|
|
regs->ax = -ENOSYS;
|
2019-09-24 14:44:20 +08:00
|
|
|
tmp = secure_computing();
|
2012-10-02 02:40:45 +08:00
|
|
|
if ((!tmp && regs->orig_ax != syscall_nr) || regs->ip != address) {
|
|
|
|
warn_bad_vsyscall(KERN_DEBUG, regs,
|
|
|
|
"seccomp tried to change syscall nr or ip");
|
2021-11-19 04:23:21 +08:00
|
|
|
force_exit_sig(SIGSYS);
|
2021-10-21 01:44:03 +08:00
|
|
|
return true;
|
2012-10-02 02:40:45 +08:00
|
|
|
}
|
2014-11-05 07:36:50 +08:00
|
|
|
regs->orig_ax = -1;
|
2012-10-02 02:40:45 +08:00
|
|
|
if (tmp)
|
|
|
|
goto do_ret; /* skip requested */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* With a real vsyscall, page faults cause SIGSEGV. We want to
|
|
|
|
* preserve that behavior to make writing exploits harder.
|
|
|
|
*/
|
2016-07-15 16:21:11 +08:00
|
|
|
prev_sig_on_uaccess_err = current->thread.sig_on_uaccess_err;
|
|
|
|
current->thread.sig_on_uaccess_err = 1;
|
2012-10-02 02:40:45 +08:00
|
|
|
|
|
|
|
ret = -EFAULT;
|
|
|
|
switch (vsyscall_nr) {
|
|
|
|
case 0:
|
syscalls/x86: Use 'struct pt_regs' based syscall calling convention for 64-bit syscalls
Let's make use of ARCH_HAS_SYSCALL_WRAPPER=y on pure 64-bit x86-64 systems:
Each syscall defines a stub which takes struct pt_regs as its only
argument. It decodes just those parameters it needs, e.g:
asmlinkage long sys_xyzzy(const struct pt_regs *regs)
{
return SyS_xyzzy(regs->di, regs->si, regs->dx);
}
This approach avoids leaking random user-provided register content down
the call chain.
For example, for sys_recv() which is a 4-parameter syscall, the assembly
now is (in slightly reordered fashion):
<sys_recv>:
callq <__fentry__>
/* decode regs->di, ->si, ->dx and ->r10 */
mov 0x70(%rdi),%rdi
mov 0x68(%rdi),%rsi
mov 0x60(%rdi),%rdx
mov 0x38(%rdi),%rcx
[ SyS_recv() is automatically inlined by the compiler,
as it is not [yet] used anywhere else ]
/* clear %r9 and %r8, the 5th and 6th args */
xor %r9d,%r9d
xor %r8d,%r8d
/* do the actual work */
callq __sys_recvfrom
/* cleanup and return */
cltq
retq
The only valid place in an x86-64 kernel which rightfully calls
a syscall function on its own -- vsyscall -- needs to be modified
to pass struct pt_regs onwards as well.
To keep the syscall table generation working independent of
SYSCALL_PTREGS being enabled, the stubs are named the same as the
"original" syscall stubs, i.e. sys_*().
This patch is based on an original proof-of-concept
| From: Linus Torvalds <torvalds@linux-foundation.org>
| Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
and was split up and heavily modified by me, in particular to base it on
ARCH_HAS_SYSCALL_WRAPPER, to limit it to 64-bit-only for the time being,
and to update the vsyscall to the new calling convention.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20180405095307.3730-4-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-04-05 17:53:02 +08:00
|
|
|
/* this decodes regs->di and regs->si on its own */
|
2018-04-09 18:51:44 +08:00
|
|
|
ret = __x64_sys_gettimeofday(regs);
|
2011-06-06 01:50:24 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
syscalls/x86: Use 'struct pt_regs' based syscall calling convention for 64-bit syscalls
Let's make use of ARCH_HAS_SYSCALL_WRAPPER=y on pure 64-bit x86-64 systems:
Each syscall defines a stub which takes struct pt_regs as its only
argument. It decodes just those parameters it needs, e.g:
asmlinkage long sys_xyzzy(const struct pt_regs *regs)
{
return SyS_xyzzy(regs->di, regs->si, regs->dx);
}
This approach avoids leaking random user-provided register content down
the call chain.
For example, for sys_recv() which is a 4-parameter syscall, the assembly
now is (in slightly reordered fashion):
<sys_recv>:
callq <__fentry__>
/* decode regs->di, ->si, ->dx and ->r10 */
mov 0x70(%rdi),%rdi
mov 0x68(%rdi),%rsi
mov 0x60(%rdi),%rdx
mov 0x38(%rdi),%rcx
[ SyS_recv() is automatically inlined by the compiler,
as it is not [yet] used anywhere else ]
/* clear %r9 and %r8, the 5th and 6th args */
xor %r9d,%r9d
xor %r8d,%r8d
/* do the actual work */
callq __sys_recvfrom
/* cleanup and return */
cltq
retq
The only valid place in an x86-64 kernel which rightfully calls
a syscall function on its own -- vsyscall -- needs to be modified
to pass struct pt_regs onwards as well.
To keep the syscall table generation working independent of
SYSCALL_PTREGS being enabled, the stubs are named the same as the
"original" syscall stubs, i.e. sys_*().
This patch is based on an original proof-of-concept
| From: Linus Torvalds <torvalds@linux-foundation.org>
| Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
and was split up and heavily modified by me, in particular to base it on
ARCH_HAS_SYSCALL_WRAPPER, to limit it to 64-bit-only for the time being,
and to update the vsyscall to the new calling convention.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20180405095307.3730-4-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-04-05 17:53:02 +08:00
|
|
|
/* this decodes regs->di on its own */
|
2018-04-09 18:51:44 +08:00
|
|
|
ret = __x64_sys_time(regs);
|
2011-06-06 01:50:24 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
syscalls/x86: Use 'struct pt_regs' based syscall calling convention for 64-bit syscalls
Let's make use of ARCH_HAS_SYSCALL_WRAPPER=y on pure 64-bit x86-64 systems:
Each syscall defines a stub which takes struct pt_regs as its only
argument. It decodes just those parameters it needs, e.g:
asmlinkage long sys_xyzzy(const struct pt_regs *regs)
{
return SyS_xyzzy(regs->di, regs->si, regs->dx);
}
This approach avoids leaking random user-provided register content down
the call chain.
For example, for sys_recv() which is a 4-parameter syscall, the assembly
now is (in slightly reordered fashion):
<sys_recv>:
callq <__fentry__>
/* decode regs->di, ->si, ->dx and ->r10 */
mov 0x70(%rdi),%rdi
mov 0x68(%rdi),%rsi
mov 0x60(%rdi),%rdx
mov 0x38(%rdi),%rcx
[ SyS_recv() is automatically inlined by the compiler,
as it is not [yet] used anywhere else ]
/* clear %r9 and %r8, the 5th and 6th args */
xor %r9d,%r9d
xor %r8d,%r8d
/* do the actual work */
callq __sys_recvfrom
/* cleanup and return */
cltq
retq
The only valid place in an x86-64 kernel which rightfully calls
a syscall function on its own -- vsyscall -- needs to be modified
to pass struct pt_regs onwards as well.
To keep the syscall table generation working independent of
SYSCALL_PTREGS being enabled, the stubs are named the same as the
"original" syscall stubs, i.e. sys_*().
This patch is based on an original proof-of-concept
| From: Linus Torvalds <torvalds@linux-foundation.org>
| Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
and was split up and heavily modified by me, in particular to base it on
ARCH_HAS_SYSCALL_WRAPPER, to limit it to 64-bit-only for the time being,
and to update the vsyscall to the new calling convention.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20180405095307.3730-4-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-04-05 17:53:02 +08:00
|
|
|
/* while we could clobber regs->dx, we didn't in the past... */
|
|
|
|
orig_dx = regs->dx;
|
|
|
|
regs->dx = 0;
|
|
|
|
/* this decodes regs->di, regs->si and regs->dx on its own */
|
2018-04-09 18:51:44 +08:00
|
|
|
ret = __x64_sys_getcpu(regs);
|
syscalls/x86: Use 'struct pt_regs' based syscall calling convention for 64-bit syscalls
Let's make use of ARCH_HAS_SYSCALL_WRAPPER=y on pure 64-bit x86-64 systems:
Each syscall defines a stub which takes struct pt_regs as its only
argument. It decodes just those parameters it needs, e.g:
asmlinkage long sys_xyzzy(const struct pt_regs *regs)
{
return SyS_xyzzy(regs->di, regs->si, regs->dx);
}
This approach avoids leaking random user-provided register content down
the call chain.
For example, for sys_recv() which is a 4-parameter syscall, the assembly
now is (in slightly reordered fashion):
<sys_recv>:
callq <__fentry__>
/* decode regs->di, ->si, ->dx and ->r10 */
mov 0x70(%rdi),%rdi
mov 0x68(%rdi),%rsi
mov 0x60(%rdi),%rdx
mov 0x38(%rdi),%rcx
[ SyS_recv() is automatically inlined by the compiler,
as it is not [yet] used anywhere else ]
/* clear %r9 and %r8, the 5th and 6th args */
xor %r9d,%r9d
xor %r8d,%r8d
/* do the actual work */
callq __sys_recvfrom
/* cleanup and return */
cltq
retq
The only valid place in an x86-64 kernel which rightfully calls
a syscall function on its own -- vsyscall -- needs to be modified
to pass struct pt_regs onwards as well.
To keep the syscall table generation working independent of
SYSCALL_PTREGS being enabled, the stubs are named the same as the
"original" syscall stubs, i.e. sys_*().
This patch is based on an original proof-of-concept
| From: Linus Torvalds <torvalds@linux-foundation.org>
| Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
and was split up and heavily modified by me, in particular to base it on
ARCH_HAS_SYSCALL_WRAPPER, to limit it to 64-bit-only for the time being,
and to update the vsyscall to the new calling convention.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20180405095307.3730-4-linux@dominikbrodowski.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-04-05 17:53:02 +08:00
|
|
|
regs->dx = orig_dx;
|
2011-06-06 01:50:24 +08:00
|
|
|
break;
|
|
|
|
}
|
2010-07-14 08:56:18 +08:00
|
|
|
|
2016-07-15 16:21:11 +08:00
|
|
|
current->thread.sig_on_uaccess_err = prev_sig_on_uaccess_err;
|
2011-11-08 08:33:40 +08:00
|
|
|
|
2012-10-02 02:40:45 +08:00
|
|
|
check_fault:
|
2011-06-06 01:50:24 +08:00
|
|
|
if (ret == -EFAULT) {
|
2011-11-08 08:33:40 +08:00
|
|
|
/* Bad news -- userspace fed a bad pointer to a vsyscall. */
|
2011-06-06 01:50:24 +08:00
|
|
|
warn_bad_vsyscall(KERN_INFO, regs,
|
|
|
|
"vsyscall fault (exploit attempt?)");
|
2011-11-08 08:33:40 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we failed to generate a signal for any reason,
|
|
|
|
* generate one here. (This should be impossible.)
|
|
|
|
*/
|
|
|
|
if (WARN_ON_ONCE(!sigismember(&tsk->pending.signal, SIGBUS) &&
|
|
|
|
!sigismember(&tsk->pending.signal, SIGSEGV)))
|
|
|
|
goto sigsegv;
|
|
|
|
|
|
|
|
return true; /* Don't emulate the ret. */
|
2011-06-06 01:50:24 +08:00
|
|
|
}
|
2010-07-14 08:56:18 +08:00
|
|
|
|
2011-06-06 01:50:24 +08:00
|
|
|
regs->ax = ret;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-07-14 01:06:35 +08:00
|
|
|
do_ret:
|
2011-06-06 01:50:24 +08:00
|
|
|
/* Emulate a ret instruction. */
|
|
|
|
regs->ip = caller;
|
|
|
|
regs->sp += 8;
|
2011-08-10 23:15:32 +08:00
|
|
|
return true;
|
2011-06-06 01:50:24 +08:00
|
|
|
|
|
|
|
sigsegv:
|
2019-05-23 23:17:27 +08:00
|
|
|
force_sig(SIGSEGV);
|
2011-08-10 23:15:32 +08:00
|
|
|
return true;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2014-09-24 01:50:51 +08:00
|
|
|
/*
|
|
|
|
* A pseudo VMA to allow ptrace access for the vsyscall page. This only
|
|
|
|
* covers the 64bit vsyscall page now. 32bit has a real VMA now and does
|
|
|
|
* not need special handling anymore:
|
|
|
|
*/
|
|
|
|
static const char *gate_vma_name(struct vm_area_struct *vma)
|
|
|
|
{
|
|
|
|
return "[vsyscall]";
|
|
|
|
}
|
2015-09-10 06:39:26 +08:00
|
|
|
static const struct vm_operations_struct gate_vma_ops = {
|
2014-09-24 01:50:51 +08:00
|
|
|
.name = gate_vma_name,
|
|
|
|
};
|
2019-06-27 12:45:08 +08:00
|
|
|
static struct vm_area_struct gate_vma __ro_after_init = {
|
2014-09-24 01:50:51 +08:00
|
|
|
.vm_start = VSYSCALL_ADDR,
|
|
|
|
.vm_end = VSYSCALL_ADDR + PAGE_SIZE,
|
|
|
|
.vm_page_prot = PAGE_READONLY_EXEC,
|
|
|
|
.vm_flags = VM_READ | VM_EXEC,
|
|
|
|
.vm_ops = &gate_vma_ops,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
|
|
|
|
{
|
2015-06-22 19:55:16 +08:00
|
|
|
#ifdef CONFIG_COMPAT
|
2020-10-04 11:25:35 +08:00
|
|
|
if (!mm || !(mm->context.flags & MM_CONTEXT_HAS_VSYSCALL))
|
2014-09-24 01:50:51 +08:00
|
|
|
return NULL;
|
|
|
|
#endif
|
2014-10-30 05:33:45 +08:00
|
|
|
if (vsyscall_mode == NONE)
|
|
|
|
return NULL;
|
2014-09-24 01:50:51 +08:00
|
|
|
return &gate_vma;
|
|
|
|
}
|
|
|
|
|
|
|
|
int in_gate_area(struct mm_struct *mm, unsigned long addr)
|
|
|
|
{
|
|
|
|
struct vm_area_struct *vma = get_gate_vma(mm);
|
|
|
|
|
|
|
|
if (!vma)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return (addr >= vma->vm_start) && (addr < vma->vm_end);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Use this when you have no reliable mm, typically from interrupt
|
|
|
|
* context. It is less reliable than using a task's mm and may give
|
|
|
|
* false positives.
|
|
|
|
*/
|
|
|
|
int in_gate_area_no_mm(unsigned long addr)
|
|
|
|
{
|
2014-10-30 05:33:45 +08:00
|
|
|
return vsyscall_mode != NONE && (addr & PAGE_MASK) == VSYSCALL_ADDR;
|
2014-09-24 01:50:51 +08:00
|
|
|
}
|
|
|
|
|
2017-12-11 14:47:19 +08:00
|
|
|
/*
|
|
|
|
* The VSYSCALL page is the only user-accessible page in the kernel address
|
|
|
|
* range. Normally, the kernel page tables can have _PAGE_USER clear, but
|
|
|
|
* the tables covering VSYSCALL_ADDR need _PAGE_USER set if vsyscalls
|
|
|
|
* are enabled.
|
|
|
|
*
|
|
|
|
* Some day we may create a "minimal" vsyscall mode in which we emulate
|
|
|
|
* vsyscalls but leave the page not present. If so, we skip calling
|
|
|
|
* this.
|
|
|
|
*/
|
2017-12-12 23:56:42 +08:00
|
|
|
void __init set_vsyscall_pgtable_user_bits(pgd_t *root)
|
2017-12-11 14:47:19 +08:00
|
|
|
{
|
|
|
|
pgd_t *pgd;
|
|
|
|
p4d_t *p4d;
|
|
|
|
pud_t *pud;
|
|
|
|
pmd_t *pmd;
|
|
|
|
|
2017-12-12 23:56:42 +08:00
|
|
|
pgd = pgd_offset_pgd(root, VSYSCALL_ADDR);
|
2017-12-11 14:47:19 +08:00
|
|
|
set_pgd(pgd, __pgd(pgd_val(*pgd) | _PAGE_USER));
|
|
|
|
p4d = p4d_offset(pgd, VSYSCALL_ADDR);
|
|
|
|
#if CONFIG_PGTABLE_LEVELS >= 5
|
2018-03-19 22:31:54 +08:00
|
|
|
set_p4d(p4d, __p4d(p4d_val(*p4d) | _PAGE_USER));
|
2017-12-11 14:47:19 +08:00
|
|
|
#endif
|
|
|
|
pud = pud_offset(p4d, VSYSCALL_ADDR);
|
|
|
|
set_pud(pud, __pud(pud_val(*pud) | _PAGE_USER));
|
|
|
|
pmd = pmd_offset(pud, VSYSCALL_ADDR);
|
|
|
|
set_pmd(pmd, __pmd(pmd_val(*pmd) | _PAGE_USER));
|
|
|
|
}
|
|
|
|
|
2008-01-30 20:32:39 +08:00
|
|
|
void __init map_vsyscall(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-08-10 23:15:32 +08:00
|
|
|
extern char __vsyscall_page;
|
|
|
|
unsigned long physaddr_vsyscall = __pa_symbol(&__vsyscall_page);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2019-06-27 12:45:03 +08:00
|
|
|
/*
|
|
|
|
* For full emulation, the page needs to exist for real. In
|
|
|
|
* execute-only mode, there is no PTE at all backing the vsyscall
|
|
|
|
* page.
|
|
|
|
*/
|
|
|
|
if (vsyscall_mode == EMULATE) {
|
2014-10-30 05:33:45 +08:00
|
|
|
__set_fixmap(VSYSCALL_PAGE, physaddr_vsyscall,
|
x86/vsyscall/64: Drop "native" vsyscalls
Since Linux v3.2, vsyscalls have been deprecated and slow. From v3.2
on, Linux had three vsyscall modes: "native", "emulate", and "none".
"emulate" is the default. All known user programs work correctly in
emulate mode, but vsyscalls turn into page faults and are emulated.
This is very slow. In "native" mode, the vsyscall page is easily
usable as an exploit gadget, but vsyscalls are a bit faster -- they
turn into normal syscalls. (This is in contrast to vDSO functions,
which can be much faster than syscalls.) In "none" mode, there are
no vsyscalls.
For all practical purposes, "native" was really just a chicken bit
in case something went wrong with the emulation. It's been over six
years, and nothing has gone wrong. Delete it.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Kernel Hardening <kernel-hardening@lists.openwall.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/519fee5268faea09ae550776ce969fa6e88668b0.1520449896.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-03-08 03:12:27 +08:00
|
|
|
PAGE_KERNEL_VVAR);
|
2017-12-12 23:56:42 +08:00
|
|
|
set_vsyscall_pgtable_user_bits(swapper_pg_dir);
|
2017-12-11 14:47:19 +08:00
|
|
|
}
|
2014-10-30 05:33:45 +08:00
|
|
|
|
2019-06-27 12:45:03 +08:00
|
|
|
if (vsyscall_mode == XONLY)
|
|
|
|
gate_vma.vm_flags = VM_EXEC;
|
|
|
|
|
2014-05-06 03:19:36 +08:00
|
|
|
BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_PAGE) !=
|
|
|
|
(unsigned long)VSYSCALL_ADDR);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|