[PATCH 0/4] vsyscall tweaks

From: Andy Lutomirski
Date: Tue Aug 09 2011 - 10:28:14 EST

With the new vsyscall emulation code, int 0xcc's behavior depends on
where it is called from. A few dynamic instrumentation tools cleverly
copy the instruction out of the vsyscall page and execute it, resulting
in a segfault. This is nothing new: sysenter would die in a similar way
(unless the code got lucky). The only examples I know of are pin and
DynamoRIO -- valgrind is already smart enough not to recompile vsyscalls
0 and 1 and "smart" enough to crash unconditionally on vsyscall 2. I
can't test pin because it refuses to run on newfangled things like Linux
3.0+ (and I don't want to muck with my kernel version to run a program
that's broken anyway). Patch 1 in this series fixes DynamoRIO in
limited testing.

Bug reports against valgrind and DynamoRIO exist, and I haven't managed
to get permission to post to pin's message board yet.

The other three patches are minor. Patch 2 removes compile flags that
are now unnecessary because vsyscall_64.c does not get called in user
mode. Patch 3 wires up the getcpu syscall on x86-64 as further
encouragement to stop using the vsyscall. Patch 4 adds a
feature-removal-schedule.txt entry suggesting that vsyscalls might be
disabled in some configurations some day.

x86 maintainers / Linus: feel free to drop any of patches 2-4. I think
the getcpu syscall should be added, though, since it's rather odd to
have a "syscall" in the vdso and the vsyscall page that can't be called
the old-fashioned way.

Changes from RFC v2:
- Fix some more int 0xcc references.
- Add patches 2-4.

Andy Lutomirski (4):
x86-64: Allow emulated vsyscalls from user addresses
x86: Remove unnecessary compile flag tweaks for vsyscall code
x86-64: Wire up getcpu syscall
Add vsyscalls to feature-removal-schedule.txt

Documentation/feature-removal-schedule.txt | 14 +++
arch/x86/include/asm/irq_vectors.h | 11 ++-
arch/x86/include/asm/traps.h | 8 ++-
arch/x86/include/asm/unistd_64.h | 2 +
arch/x86/kernel/Makefile | 13 ---
arch/x86/kernel/entry_64.S | 4 +-
arch/x86/kernel/traps.c | 14 +++-
arch/x86/kernel/vsyscall_64.c | 131 ++++++++++++++--------------
arch/x86/kernel/vsyscall_emu_64.S | 6 +-
9 files changed, 111 insertions(+), 92 deletions(-)


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/