mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [MINIMAL BACKPORT] x86-64: Fix garbage at the end of the vdso mapping
@ 2011-08-11  0:44 Andy Lutomirski
  0 siblings, 0 replies; only message in thread
From: Andy Lutomirski @ 2011-08-11  0:44 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: x86, linux-kernel, Andy Lutomirski

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@mit.edu>
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@MIT.EDU>
Date:   Wed Aug 3 09:31:49 2011 -0400

    x86-64: Pad vDSO to a page boundary

Signed-off-by: Andy Lutomirski <luto@mit.edu>
---

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-11  0:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-11  0:44 [MINIMAL BACKPORT] x86-64: Fix garbage at the end of the vdso mapping Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®