From: Andy Lutomirski <luto@MIT.EDU>
To: Ingo Molnar <mingo@elte.hu>, x86@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, Jesper Juhl <jj@chaosbits.net>,
Borislav Petkov <bp@alien8.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Arjan van de Ven <arjan@infradead.org>,
Jan Beulich <JBeulich@novell.com>,
richard -rw- weinberger <richard.weinberger@gmail.com>,
Mikael Pettersson <mikpe@it.uu.se>,
Andi Kleen <andi@firstfloor.org>, Andy Lutomirski <luto@MIT.EDU>
Subject: [PATCH v4 00/10] Remove syscall instructions at fixed addresses
Date: Tue, 31 May 2011 10:13:58 -0400 [thread overview]
Message-ID: <cover.1306851090.git.luto@mit.edu> (raw)
Patch 1 is just a bugfix from the last vdso series.
The bug should be harmless but it's pretty dumb. This is almost
certainly 3.0 material.
Patch 2 adds documentation for entry_64.S. A lot of the magic in there is far from obvious.
Patches 3, 4, and 5 remove a bunch of syscall instructions in kernel space
at fixed addresses that user code can execute. Several are data that isn't marked NX. Patch 2 makes vvars NX and
5/10 makes the HPET NX.
The time() vsyscall contains an explicit syscall fallback. Patch 3/10
removes it.
At this point, there is only one explicit syscall left in the vsyscall
page: the fallback case for vgettimeofday. The rest of the series is to
remove it and most of the remaining vsyscall code.
Patch 6 is pure cleanup. venosys (one of the four vsyscalls) has been
broken for years, so patch 6 removes it.
Patch 7 pads the empty parts of the vsyscall page with 0xcc. 0xcc is an
explicit trap.
Patch 8 removes the code implementing the vsyscalls and replaces it with
magic int 0xcc incantations. These incantations are specifically
designed so that jumping into them at funny offsets will either work
fine or generate some kind of fault. This is a significant performance
penalty (~220ns here) for all vsyscall users, but there aren't many
left. Because current glibc still uses the time vsyscall (although it's
fixed in glibc's git), the option CONFIG_UNSAFE_VSYSCALLS (default y)
will leave time() alone.
This patch is also nice because it removes a bunch of duplicated code
from vsyscall_64.s.
Patch 9/10 randomizes the int 0xcc incantation at bootup. It is pretty
much worthless for security (there are only three choices for the random
number and it's easy to figure out which one is in use) but it prevents
overly clever userspace programs from thinking that the incantation is
ABI. One instrumentation tool author offered to hard-code special
handling for int 0xcc; I want to discourage this approach.
Patch 10/10 adds CONFIG_UNSAFE_VSYSCALLS to
feature-removal-schedule.txt. Removing it won't break anything but it
will slow some older code down.
Changes from v3:
- Rebased onto tip/master (1a0c84d)
Changes from v2:
- Reordered the patches.
- Removed the option to leave gettimeofday and getcpu as native code.
- Clean up the int 0xcc handler and registration.
- sched_getcpu works now (thanks, Borislav, for catching my blatant arithmetic error).
- Numerous small fixes from review comments.
- Abandon my plan to spread turbostat to the masses.
Changes from v1:
- Patches 6-10 are new.
- The int 0xcc code is much prettier and has lots of bugs fixed.
- I've decided to let everyone compile turbostat on their own :)
Andy Lutomirski (10):
x86-64: Fix alignment of jiffies variable
x86-64: Document some of entry_64.S
x86-64: Give vvars their own page
x86-64: Remove kernel.vsyscall64 sysctl
x86-64: Map the HPET NX
x86-64: Remove vsyscall number 3 (venosys)
x86-64: Fill unused parts of the vsyscall page with 0xcc
x86-64: Emulate legacy vsyscalls
x86-64: Randomize int 0xcc magic al values at boot
x86-64: Add CONFIG_UNSAFE_VSYSCALLS to feature-removal-schedule
Documentation/feature-removal-schedule.txt | 9 +
Documentation/x86/entry_64.txt | 98 +++++++++
arch/x86/Kconfig | 17 ++
arch/x86/include/asm/fixmap.h | 1 +
arch/x86/include/asm/irq_vectors.h | 6 +-
arch/x86/include/asm/pgtable_types.h | 6 +-
arch/x86/include/asm/traps.h | 4 +
arch/x86/include/asm/vgtod.h | 1 -
arch/x86/include/asm/vsyscall.h | 6 +
arch/x86/include/asm/vvar.h | 24 +-
arch/x86/kernel/Makefile | 1 +
arch/x86/kernel/entry_64.S | 4 +
arch/x86/kernel/hpet.c | 2 +-
arch/x86/kernel/traps.c | 4 +
arch/x86/kernel/vmlinux.lds.S | 47 ++--
arch/x86/kernel/vsyscall_64.c | 327 +++++++++++++++++-----------
arch/x86/kernel/vsyscall_emu_64.S | 42 ++++
arch/x86/vdso/vclock_gettime.c | 55 ++---
18 files changed, 448 insertions(+), 206 deletions(-)
create mode 100644 Documentation/x86/entry_64.txt
create mode 100644 arch/x86/kernel/vsyscall_emu_64.S
--
1.7.5.1
next reply other threads:[~2011-05-31 14:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-31 14:13 Andy Lutomirski [this message]
2011-05-31 14:13 ` [PATCH v4 01/10] x86-64: Fix alignment of jiffies variable Andy Lutomirski
2011-05-31 14:14 ` [PATCH v4 02/10] x86-64: Document some of entry_64.S Andy Lutomirski
2011-05-31 14:14 ` [PATCH v4 03/10] x86-64: Give vvars their own page Andy Lutomirski
2011-05-31 17:17 ` Louis Rilling
2011-05-31 14:14 ` [PATCH v4 04/10] x86-64: Remove kernel.vsyscall64 sysctl Andy Lutomirski
2011-05-31 14:14 ` [PATCH v4 05/10] x86-64: Map the HPET NX Andy Lutomirski
2011-05-31 14:14 ` [PATCH v4 06/10] x86-64: Remove vsyscall number 3 (venosys) Andy Lutomirski
2011-05-31 14:14 ` [PATCH v4 07/10] x86-64: Fill unused parts of the vsyscall page with 0xcc Andy Lutomirski
2011-05-31 14:14 ` [PATCH v4 08/10] x86-64: Emulate legacy vsyscalls Andy Lutomirski
2011-05-31 15:35 ` Ingo Molnar
2011-05-31 14:14 ` [PATCH v4 09/10] x86-64: Randomize int 0xcc magic al values at boot Andy Lutomirski
2011-05-31 15:40 ` Ingo Molnar
2011-05-31 15:56 ` Andrew Lutomirski
2011-05-31 16:10 ` Andrew Lutomirski
2011-05-31 16:43 ` Ingo Molnar
2011-05-31 16:42 ` Ingo Molnar
2011-05-31 18:08 ` Andrew Lutomirski
2011-05-31 14:14 ` [PATCH v4 10/10] x86-64: Add CONFIG_UNSAFE_VSYSCALLS to feature-removal-schedule Andy Lutomirski
2011-05-31 18:34 ` Andi Kleen
2011-05-31 18:57 ` Thomas Gleixner
2011-05-31 18:59 ` Andrew Lutomirski
2011-05-31 19:28 ` Ingo Molnar
2011-05-31 19:36 ` Ingo Molnar
2011-05-31 20:05 ` Andrew Lutomirski
2011-05-31 20:24 ` Ingo Molnar
2011-08-06 20:18 ` [PATCH v3 " Andrew Lutomirski
2011-06-08 8:50 ` [PATCH v4 " Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1306851090.git.luto@mit.edu \
--to=luto@mit.edu \
--cc=JBeulich@novell.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=arjan@infradead.org \
--cc=bp@alien8.de \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mikpe@it.uu.se \
--cc=mingo@elte.hu \
--cc=richard.weinberger@gmail.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox