lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri,  8 May 2015 15:42:33 +0200
From:	Rasmus Villemoes <linux@...musvillemoes.dk>
To:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org
Cc:	Rasmus Villemoes <linux@...musvillemoes.dk>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] x86: tell the world boot_params is 16-byte aligned

It doesn't matter much, but this disassembly makes me cry a little bit:

ffffffff81f21223 <copy_bootdata>:
ffffffff81f21223:       55                      push   %rbp
ffffffff81f21224:       48 c7 c0 40 c2 02 82    mov    $0xffffffff8202c240,%rax
ffffffff81f2122b:       48 89 fe                mov    %rdi,%rsi
ffffffff81f2122e:       a8 01                   test   $0x1,%al

The reason is that boot_params is defined with
__attribute__((aligned(16))) in boot/main.c, but other translation
units only see the packed attribute on the definition of struct
boot_params, so assume the worst. Making the de facto alignment public
has this effect:

$ scripts/bloat-o-meter /tmp/vmlinux.{defconfig,align}
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-230 (-230)
function                                     old     new   delta
copy_bootdata                                444     214    -230

Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
---
 arch/x86/include/asm/setup.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index f69e06b283fb..dcd6d5fc2f12 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -64,7 +64,7 @@ static inline void x86_ce4100_early_setup(void) { }
 /*
  * This is set up by the setup-routine at boot-time
  */
-extern struct boot_params boot_params;
+extern struct boot_params boot_params __attribute__((aligned(16)));
 
 static inline bool kaslr_enabled(void)
 {
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ