Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1318392 > unrolled thread

[PATCH 10/10] x86/head_64: Simplify kernel load address alignment check

Started byBorislav Petkov <bp@alien8.de>
First post2016-01-26 22:20 +0100
Last post2016-01-26 22:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 10/10] x86/head_64: Simplify kernel load address alignment check Borislav Petkov <bp@alien8.de> - 2016-01-26 22:20 +0100

#1318392 — [PATCH 10/10] x86/head_64: Simplify kernel load address alignment check

FromBorislav Petkov <bp@alien8.de>
Date2016-01-26 22:20 +0100
Subject[PATCH 10/10] x86/head_64: Simplify kernel load address alignment check
Message-ID<qVjbQ-1GJ-15@gated-at.bofh.it>
From: Alexander Kuleshov <kuleshovmail@gmail.com>

We are using %rax as temporary register to check the kernel address
alignment. We don't really have to since the TEST instruction does not
clobber the destination operand.

Suggested-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Cc: Alexander Popov <alpopov@ptsecurity.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1453531828-19291-1-git-send-email-kuleshovmail@gmail.com
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/head_64.S | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index ffdc0e860390..7c21029cb733 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -76,9 +76,7 @@ startup_64:
 	subq	$_text - __START_KERNEL_map, %rbp
 
 	/* Is the address not 2M aligned? */
-	movq	%rbp, %rax
-	andl	$~PMD_PAGE_MASK, %eax
-	testl	%eax, %eax
+	testl	$~PMD_PAGE_MASK, %ebp
 	jnz	bad_address
 
 	/*
-- 
2.3.5

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web