Skip to content

Commit

Permalink
x86-64: Fill unused parts of the vsyscall page with 0xcc
Browse files Browse the repository at this point in the history
Jumping to 0x00 might do something depending on the following
bytes. Jumping to 0xcc is a trap.  So fill the unused parts of
the vsyscall page with 0xcc to make it useless for exploits to
jump there.

Signed-off-by: Andy Lutomirski <[email protected]>
Cc: Jesper Juhl <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Arjan van de Ven <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: richard -rw- weinberger <[email protected]>
Cc: Mikael Pettersson <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Louis Rilling <[email protected]>
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/ed54bfcfbe50a9070d20ec1edbe0d149e22a4568.1307292171.git.luto@mit.edu
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
amluto authored and Ingo Molnar committed Jun 6, 2011
1 parent bb5fe2f commit 5dfcea6
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions arch/x86/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -166,22 +166,20 @@ SECTIONS
__vsyscall_0 = .;

. = VSYSCALL_ADDR;
.vsyscall_0 : AT(VLOAD(.vsyscall_0)) {
.vsyscall : AT(VLOAD(.vsyscall)) {
*(.vsyscall_0)
} :user

. = ALIGN(L1_CACHE_BYTES);
.vsyscall_fn : AT(VLOAD(.vsyscall_fn)) {
. = ALIGN(L1_CACHE_BYTES);
*(.vsyscall_fn)
}

.vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) {
. = 1024;
*(.vsyscall_1)
}
.vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) {

. = 2048;
*(.vsyscall_2)
}

. = 4096; /* Pad the whole page. */
} :user =0xcc
. = ALIGN(__vsyscall_0 + PAGE_SIZE, PAGE_SIZE);

#undef VSYSCALL_ADDR
Expand Down

0 comments on commit 5dfcea6

Please sign in to comment.