mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Popov <alpopov@ptsecurity.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Andrey Ryabinin <a.ryabinin@samsung.com>,
	Andrey Konovalov <adech.fo@gmail.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Alexander Kuleshov <kuleshovmail@gmail.com>,
	Alexander Popov <alpopov@ptsecurity.com>,
	"Sergey Kovalev" <SKovalev@ptsecurity.com>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH 1/1] x86_64: fix KASan shadow region page tables
Date: Fri, 22 May 2015 19:03:01 +0300	[thread overview]
Message-ID: <1432310581-11965-1-git-send-email-alpopov@ptsecurity.com> (raw)

Physical addresses in KASan shadow region page tables need fixup:
kernel halts without it if phys_base is not zero.

Signed-off-by: Alexander Popov <alpopov@ptsecurity.com>
---
 arch/x86/kernel/head_64.S | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index ae6588b..f7711bb 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -95,6 +95,20 @@ startup_64:
 
 	addq	%rbp, level2_fixmap_pgt + (506*8)(%rip)
 
+#ifdef CONFIG_KASAN
+	xor	%rax, %rax
+	leaq	kasan_zero_pud(%rip), %rbx
+	leaq	kasan_zero_pmd(%rip), %rcx
+	leaq	kasan_zero_pte(%rip), %rdx
+1:
+	addq	%rbp, (%rbx,%rax,8)
+	addq	%rbp, (%rcx,%rax,8)
+	addq	%rbp, (%rdx,%rax,8)
+	inc	%rax
+	cmp	$512, %rax
+	jne	1b
+#endif
+
 	/*
 	 * Set up the identity mapping for the switchover.  These
 	 * entries should *NOT* have the global bit set!  This also
-- 
1.9.1


             reply	other threads:[~2015-05-22 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22 16:03 Alexander Popov [this message]
2015-05-25  8:12 ` Andrey Ryabinin
2015-05-25 13:43   ` Alexander Popov
2015-05-26  8:52     ` Andrey Ryabinin
2015-05-28  8:56       ` Alexander Popov

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=1432310581-11965-1-git-send-email-alpopov@ptsecurity.com \
    --to=alpopov@ptsecurity.com \
    --cc=SKovalev@ptsecurity.com \
    --cc=a.ryabinin@samsung.com \
    --cc=adech.fo@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kuleshovmail@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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®