lkml.org 
[lkml]   [2011]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/3] vsyscall emulation compatibility fixes
Date
This is the latest attempt to make vsyscall emulation compatible with
dynamic insrumentation tools like DynamoRIO and pin
(http://pintool.org). They make assumptions about how the int
instruction works that were false with the original vsyscall emulation
code.

There is now a vsyscall boot parameter. In "native" mode, vsyscalls are
just syscall instructions. Emulation works fine. In "emulate" mode
(default), vsyscalls appear to be syscall instructions, but attempts to
execute them are trapped by the NX bit and the instructions are emulated
instead. This is slower than the old interrupt-based code (because I
hooked a slow path in the page fault code) but it means that nothing too
sneaky goes on behind the backs of the tools. In "none" mode, vsyscalls
send SIGSEGV just like any other attempt to execute from an NX page.

This still has corner cases. For example, single-stepping through a
vsyscall will step across the whole thing instead of across just one
instruction. I suspect that nothing cares. Somewhat more
significantly, if an exploit (or exploit-like program) jumps to a
syscall instruction in the vsyscall page under pin, then it will work,
whereas without pin in vsyscall=emulate mode, it would receive SIGSEGV.
Pin is welcome to fix this corner case if it cares.

If this still causes problems, we can just default the vsyscall
parameter to native for 3.1

The first patch is pure cleanup and is not required. The second patch
wires up the getcpu syscall and is required for the native code to work.
The third patch is the meat.

For extra points, if you ignore the documentation in
kernel-parameters.txt, this patch set removes more lines than it adds.

Andy Lutomirski (3):
x86: Remove unnecessary compile flag tweaks for vsyscall code
x86-64: Wire up getcpu syscall
x86-64: Rework vsyscall emulation and add vsyscall= parameter

Documentation/kernel-parameters.txt | 21 +++++++++
arch/x86/include/asm/irq_vectors.h | 4 --
arch/x86/include/asm/traps.h | 2 -
arch/x86/include/asm/unistd_64.h | 2 +
arch/x86/include/asm/vsyscall.h | 6 +++
arch/x86/kernel/Makefile | 13 ------
arch/x86/kernel/entry_64.S | 1 -
arch/x86/kernel/traps.c | 6 ---
arch/x86/kernel/vmlinux.lds.S | 33 --------------
arch/x86/kernel/vsyscall_64.c | 82 +++++++++++++++++++++--------------
arch/x86/kernel/vsyscall_emu_64.S | 36 ++++++++++------
arch/x86/mm/fault.c | 12 +++++
12 files changed, 113 insertions(+), 105 deletions(-)

--
1.7.6



\
 
 \ /
  Last update: 2011-08-10 17:19    [W:0.068 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site