[lkml]   [2011]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] x86-64, vsyscalls: Rename UNSAFE_VSYSCALLS to COMPAT_VSYSCALLS

* Linus Torvalds <> wrote:

> On Mon, Jun 6, 2011 at 2:50 AM, Andy Lutomirski <> wrote:
> > CONFIG_UNSAFE_VSYSCALLS was added in the previous patch as a
> > temporary hack to avoid penalizing users who don't build glibc from
> > git.
> I really hate that name.
> Do you have *any* reason to call this "unsafe"?

No, there's no reason at all for that. That naming is borderline
security FUD and last time i saw the series i considered renaming
it but got distracted :-)

How about the patch below? COMPAT_VSYSCALLS looks like a good logical
extension to the COMPAT_VDSO we already have.

CONFIG_FIXED_VSYSCALLS seemed a bit awkward to me nor does it carry
the compat nature of them.



From 1593843e2ada6d6832d0de4d633aacd997dc3a45 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <>
Date: Mon, 6 Jun 2011 12:13:40 +0200
Subject: [PATCH] x86-64, vsyscalls: Rename UNSAFE_VSYSCALLS to COMPAT_VSYSCALLS

Linus pointed out that the UNSAFE_VSYSCALL naming was inherently
bad: it suggests that there's something unsafe about enabling them,
while in reality they only have any security effect in the presence
of some *other* security hole.

So rename it to CONFIG_COMPAT_VSYSCALL and fix the documentation
and Kconfig text to correctly explain the purpose of this change.

Reported-by: Linus Torvalds <>
Cc: Andy Lutomirski <>
Cc: Jesper Juhl <>
Cc: Borislav Petkov <>
Cc: Arjan van de Ven <>
Cc: Jan Beulich <>
Cc: richard -rw- weinberger <>
Cc: Mikael Pettersson <>
Cc: Andi Kleen <>
Cc: Brian Gerst <>
Cc: Louis Rilling <>
Signed-off-by: Ingo Molnar <>
Documentation/feature-removal-schedule.txt | 7 ++++---
arch/x86/Kconfig | 17 ++++++++++-------
arch/x86/kernel/vsyscall_64.c | 8 ++++----
arch/x86/kernel/vsyscall_emu_64.S | 2 +-
4 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 94b4470..4282ab2 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -601,10 +601,11 @@ Who: Laurent Pinchart <>


When: When glibc 2.14 or newer is ubitquitous. Perhaps mid-2012.
-Why: Having user-executable code at a fixed address is a security problem.
- Turning off CONFIG_UNSAFE_VSYSCALLS mostly removes the risk but will
+Why: Having user-executable syscall invoking code at a fixed addresses makes
+ it easier for attackers to exploit security holes.
+ Turning off CONFIG_COMPAT_VSYSCALLS mostly removes the risk but will
make the time() function slower on glibc versions 2.13 and below.
Who: Andy Lutomirski <>

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 79e5d8a..30041d8 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1646,20 +1646,23 @@ config COMPAT_VDSO

If unsure, say Y.

def_bool y
- prompt "Unsafe fast legacy vsyscalls"
+ prompt "Fixed address legacy vsyscalls"
depends on X86_64
Legacy user code expects to be able to issue three syscalls
- by calling fixed addresses in kernel space. If you say N,
- then the kernel traps and emulates these calls. If you say
- Y, then there is actual executable code at a fixed address
- to implement time() efficiently.
+ by calling a fixed addresses. If you say N, then the kernel
+ traps and emulates these calls. If you say Y, then there is
+ actual executable code at a fixed address to implement time()
+ efficiently.

On a system with recent enough glibc (probably 2.14 or
newer) and no static binaries, you can say N without a
- performance penalty to improve security
+ performance penalty to improve security: having no fixed
+ address userspace-executable syscall invoking code makes
+ it harder for both remote and local attackers to exploit
+ security holes.

If unsure, say Y.

diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 285af7a..27d49b7 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -116,7 +116,7 @@ static int al_to_vsyscall_nr(u8 al)
return -1;


/* This will break when the xtime seconds get inaccurate, but that is
* unlikely */
@@ -138,9 +138,9 @@ vtime(time_t *t)
return result;


-/* If CONFIG_UNSAFE_VSYSCALLS=y, then this is incorrect for vsyscall_nr == 1. */
+/* If CONFIG_COMPAT_VSYSCALLS=y, then this is incorrect for vsyscall_nr == 1. */
static inline unsigned long vsyscall_intcc_addr(int vsyscall_nr)
return VSYSCALL_START + 1024*vsyscall_nr + 2;
@@ -202,7 +202,7 @@ void dotraplinkage do_emulate_vsyscall(struct pt_regs *regs, long error_code)

case 1:
warn_bad_vsyscall(KERN_WARNING, regs, "bogus time() vsyscall "
"emulation (exploit attempt?)");
goto sigsegv;
diff --git a/arch/x86/kernel/vsyscall_emu_64.S b/arch/x86/kernel/vsyscall_emu_64.S
index 7ebde61..2d53e26 100644
--- a/arch/x86/kernel/vsyscall_emu_64.S
+++ b/arch/x86/kernel/vsyscall_emu_64.S
@@ -25,7 +25,7 @@ ENTRY(vsyscall_0)

.section .vsyscall_1, "a"
movb $0xce, %al

 \ /
  Last update: 2011-06-06 12:27    [W:0.275 / U:27.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site