mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@MIT.EDU>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Andy Lutomirski <luto@MIT.EDU>
Subject: [MINIMAL BACKPORT] x86-64: Fix garbage at the end of the vdso mapping
Date: Wed, 10 Aug 2011 20:44:24 -0400	[thread overview]
Message-ID: <463ff0f1c8f6f1ae4d0d0e26a7e71aea9ff03b9d.1313023219.git.luto@mit.edu> (raw)

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


                 reply	other threads:[~2011-08-11  0:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=463ff0f1c8f6f1ae4d0d0e26a7e71aea9ff03b9d.1313023219.git.luto@mit.edu \
    --to=luto@mit.edu \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®