All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] vsyscall emulation compatibility fixes
@ 2011-08-10 15:15 Andy Lutomirski
  2011-08-10 15:15 ` [PATCH 1/3] x86: Remove unnecessary compile flag tweaks for vsyscall code Andy Lutomirski
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Andy Lutomirski @ 2011-08-10 15:15 UTC (permalink / raw)
  To: x86
  Cc: H. Peter Anvin, Andi Kleen, linux-kernel, torvalds, lueckintel,
	kimwooyoung, Ingo Molnar, Borislav Petkov, Andy Lutomirski

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-08-11  0:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-10 15:15 [PATCH 0/3] vsyscall emulation compatibility fixes Andy Lutomirski
2011-08-10 15:15 ` [PATCH 1/3] x86: Remove unnecessary compile flag tweaks for vsyscall code Andy Lutomirski
2011-08-11  0:01   ` [tip:x86/vdso] " tip-bot for Andy Lutomirski
2011-08-10 15:15 ` [PATCH 2/3] x86-64: Wire up getcpu syscall Andy Lutomirski
2011-08-11  0:01   ` [tip:x86/vdso] " tip-bot for Andy Lutomirski
2011-08-11  0:31   ` tip-bot for Andy Lutomirski
2011-08-10 15:15 ` [PATCH 3/3] x86-64: Rework vsyscall emulation and add vsyscall= parameter Andy Lutomirski
2011-08-10 17:21   ` H. Peter Anvin
2011-08-10 17:47     ` Andrew Lutomirski
2011-08-10 21:14       ` H. Peter Anvin
2011-08-10 21:18         ` Andrew Lutomirski
2011-08-10 22:20           ` H. Peter Anvin
2011-08-10 22:56             ` Andrew Lutomirski
2011-08-11  0:02   ` [tip:x86/vdso] " tip-bot for Andy Lutomirski
2011-08-11  0:31   ` tip-bot for Andy Lutomirski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.