mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 01:51:39 +00:00
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>
This commit is contained in:
parent
91c5f0de64
commit
076ca272a1
4 changed files with 10 additions and 30 deletions
|
@ -450,7 +450,7 @@ static void sigtrap(int sig, siginfo_t *info, void *ctx_void)
|
|||
num_vsyscall_traps++;
|
||||
}
|
||||
|
||||
static int test_native_vsyscall(void)
|
||||
static int test_emulation(void)
|
||||
{
|
||||
time_t tmp;
|
||||
bool is_native;
|
||||
|
@ -458,7 +458,7 @@ static int test_native_vsyscall(void)
|
|||
if (!vtime)
|
||||
return 0;
|
||||
|
||||
printf("[RUN]\tchecking for native vsyscall\n");
|
||||
printf("[RUN]\tchecking that vsyscalls are emulated\n");
|
||||
sethandler(SIGTRAP, sigtrap, 0);
|
||||
set_eflags(get_eflags() | X86_EFLAGS_TF);
|
||||
vtime(&tmp);
|
||||
|
@ -474,11 +474,12 @@ static int test_native_vsyscall(void)
|
|||
*/
|
||||
is_native = (num_vsyscall_traps > 1);
|
||||
|
||||
printf("\tvsyscalls are %s (%d instructions in vsyscall page)\n",
|
||||
printf("[%s]\tvsyscalls are %s (%d instructions in vsyscall page)\n",
|
||||
(is_native ? "FAIL" : "OK"),
|
||||
(is_native ? "native" : "emulated"),
|
||||
(int)num_vsyscall_traps);
|
||||
|
||||
return 0;
|
||||
return is_native;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -498,7 +499,7 @@ int main(int argc, char **argv)
|
|||
nerrs += test_vsys_r();
|
||||
|
||||
#ifdef __x86_64__
|
||||
nerrs += test_native_vsyscall();
|
||||
nerrs += test_emulation();
|
||||
#endif
|
||||
|
||||
return nerrs ? 1 : 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue