diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/vsyscall_64.c | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c index 2d912629c96e..7d9eb4bc10ac 100644 --- a/arch/x86/kernel/vsyscall_64.c +++ b/arch/x86/kernel/vsyscall_64.c | |||
@@ -1,52 +1,38 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012-2014 Andy Lutomirski <luto@amacapital.net> | ||
3 | * | ||
4 | * Based on the original implementation which is: | ||
2 | * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE | 5 | * Copyright (C) 2001 Andrea Arcangeli <andrea@suse.de> SuSE |
3 | * Copyright 2003 Andi Kleen, SuSE Labs. | 6 | * Copyright 2003 Andi Kleen, SuSE Labs. |
4 | * | 7 | * |
5 | * [ NOTE: this mechanism is now deprecated in favor of the vDSO. ] | 8 | * Parts of the original code have been moved to arch/x86/vdso/vma.c |
9 | * | ||
10 | * This file implements vsyscall emulation. vsyscalls are a legacy ABI: | ||
11 | * Userspace can request certain kernel services by calling fixed | ||
12 | * addresses. This concept is problematic: | ||
6 | * | 13 | * |
7 | * Thanks to hpa@transmeta.com for some useful hint. | 14 | * - It interferes with ASLR. |
8 | * Special thanks to Ingo Molnar for his early experience with | 15 | * - It's awkward to write code that lives in kernel addresses but is |
9 | * a different vsyscall implementation for Linux/IA32 and for the name. | 16 | * callable by userspace at fixed addresses. |
17 | * - The whole concept is impossible for 32-bit compat userspace. | ||
18 | * - UML cannot easily virtualize a vsyscall. | ||
10 | * | 19 | * |
11 | * vsyscall 1 is located at -10Mbyte, vsyscall 2 is located | 20 | * As of mid-2014, I believe that there is no new userspace code that |
12 | * at virtual address -10Mbyte+1024bytes etc... There are at max 4 | 21 | * will use a vsyscall if the vDSO is present. I hope that there will |
13 | * vsyscalls. One vsyscall can reserve more than 1 slot to avoid | 22 | * soon be no new userspace code that will ever use a vsyscall. |
14 | * jumping out of line if necessary. We cannot add more with this | ||
15 | * mechanism because older kernels won't return -ENOSYS. | ||
16 | * | 23 | * |
17 | * Note: the concept clashes with user mode linux. UML users should | 24 | * The code in this file emulates vsyscalls when notified of a page |
18 | * use the vDSO. | 25 | * fault to a vsyscall address. |
19 | */ | 26 | */ |
20 | 27 | ||
21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
22 | |||
23 | #include <linux/time.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
26 | #include <linux/timer.h> | 29 | #include <linux/timer.h> |
27 | #include <linux/seqlock.h> | ||
28 | #include <linux/jiffies.h> | ||
29 | #include <linux/sysctl.h> | ||
30 | #include <linux/topology.h> | ||
31 | #include <linux/timekeeper_internal.h> | ||
32 | #include <linux/getcpu.h> | ||
33 | #include <linux/cpu.h> | ||
34 | #include <linux/smp.h> | ||
35 | #include <linux/notifier.h> | ||
36 | #include <linux/syscalls.h> | 30 | #include <linux/syscalls.h> |
37 | #include <linux/ratelimit.h> | 31 | #include <linux/ratelimit.h> |
38 | 32 | ||
39 | #include <asm/vsyscall.h> | 33 | #include <asm/vsyscall.h> |
40 | #include <asm/pgtable.h> | ||
41 | #include <asm/compat.h> | ||
42 | #include <asm/page.h> | ||
43 | #include <asm/unistd.h> | 34 | #include <asm/unistd.h> |
44 | #include <asm/fixmap.h> | 35 | #include <asm/fixmap.h> |
45 | #include <asm/errno.h> | ||
46 | #include <asm/io.h> | ||
47 | #include <asm/segment.h> | ||
48 | #include <asm/desc.h> | ||
49 | #include <asm/topology.h> | ||
50 | #include <asm/traps.h> | 36 | #include <asm/traps.h> |
51 | 37 | ||
52 | #define CREATE_TRACE_POINTS | 38 | #define CREATE_TRACE_POINTS |