Commit a50d447d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] x86 vsyscall alignment fix

From: Andy Whitcroft <andyw@uk.ibm.com>

The vsyscall implementation for ia32 provides two different vsyscall pages;
one to use int80 and the other to use sysenter.  Each includes a common
signal trailer.  The kernel requires the alignment of routines in this
trailer be consistent in both copies.  However this is not enforced at
compile time.  Failure to maintain this alignment typically leads to an
obscure SIGSEGV in init during boot.  This critical alignment requirement
is not well documented.

Below is a patch to better document the alignment requirements and to
enforce the requirement.
parent 9797ead5
/*
* Code for the vsyscall page. This version uses the old int $0x80 method.
*
* NOTE:
* 1) __kernel_vsyscall _must_ be first in this page.
* 2) there are alignment constraints on this stub, see vsyscall-sigreturn.S
* for details.
*/
.text
......
......@@ -2,8 +2,8 @@
* Common code for the sigreturn entry points on the vsyscall page.
* So far this code is the same for both int80 and sysenter versions.
* This file is #include'd by vsyscall-*.S to define them after the
* vsyscall entry point. The addresses we get for these entry points
* by doing ".balign 32" must match in both versions of the page.
* vsyscall entry point. The kernel assumes that the addresses of these
* routines are constant for all vsyscall implementations.
*/
#include <asm/unistd.h>
......@@ -15,7 +15,7 @@
*/
.text
.balign 32
.org __kernel_vsyscall+32
.globl __kernel_sigreturn
.type __kernel_sigreturn,@function
__kernel_sigreturn:
......
/*
* Code for the vsyscall page. This version uses the sysenter instruction.
*
* NOTE:
* 1) __kernel_vsyscall _must_ be first in this page.
* 2) there are alignment constraints on this stub, see vsyscall-sigreturn.S
* for details.
*/
.text
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment