[MINIMAL BACKPORT] x86-64: Fix garbage at the end of the vdso mapping

From: Andy Lutomirski
Date: Wed Aug 10 2011 - 20:44:33 EST


The vdso mapping has a bunch of random garbage at the end of it,
because the code that copies the vdso from the kernel image uses
copy_page to copy unaligned data that isn't actually one page long.

This is a trivial fix that just aligns and pags the source data.
The same bug is fixed in 3.1 by:

commit aafade242ff24fac3aabf61c7861dfa44a3c2445
Author: Andy Lutomirski <luto@xxxxxxx>
Date: Thu Jul 21 15:47:10 2011 -0400

x86-64, vdso: Do not allocate memory for the vDSO

commit 1bdfac19b3ecfca545281c15c7aea7ebc2eaef31
Author: Andy Lutomirski <luto@xxxxxxx>
Date: Wed Aug 3 09:31:49 2011 -0400

x86-64: Pad vDSO to a page boundary

Signed-off-by: Andy Lutomirski <luto@xxxxxxx>
---

aafade2 upstream made the bug worse (the information disclosed
became something non-constant), but the bug exists in 3.0 (and
presumably even much older kernels) even without that change.

hpa, feel free to send to stable if you like. If anyone has an x86
machine that dies when copy_page isn't page-aligned, then this fix
is critical, but I'm pretty sure we would have noticed that by now.

This applies to and is tested on 3.0.

arch/x86/vdso/vdso.S | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/x86/vdso/vdso.S b/arch/x86/vdso/vdso.S
index 1d3aa6b..3ace53b 100644
--- a/arch/x86/vdso/vdso.S
+++ b/arch/x86/vdso/vdso.S
@@ -1,10 +1,13 @@
#include <linux/init.h>
+#include <asm/page_types.h>

__INITDATA

.globl vdso_start, vdso_end
+ .balign PAGE_SIZE
vdso_start:
.incbin "arch/x86/vdso/vdso.so"
+ .balign PAGE_SIZE
vdso_end:

__FINIT
--
1.7.6

--
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/