Skip to contentSkip to conversation

x86-32: Fix alignment of alternative instruction entries

PATCH In review Ben Hutchings 2 participants 2 messages Sep 21, 2011 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86-32: Fix alignment of alternative instruction entries

The altinstruction_entry macro was originally used only on x86-64, and assumed 64-bit pointers and alignment.

Commit b4ca46e4e82a0a5976fe5eab85be585d75f8202f ("x86-32: Fix boot with CONFIG_X86_INVD_BUG") introduced a use of the macro on x86-32. Before this, the 64-bit pointers had been replaced by 32-bit offsets, so it worked - in at least one case. However, the alignment is still wrong for x86-32, which can result in zero-padding between entries and a BUG in apply_alternatives.

References: http://bugs.debian.org/640964

---
 arch/x86/include/asm/alternative-asm.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/alternative-asm.h +1 -1
index 4554cc6..d00dc2a 100644
@@ -16,7 +16,7 @@
 #endif
 
 .macro altinstruction_entry orig alt feature orig_len alt_len
-	.align 8
+	_ASM_ALIGN
 	.long \orig - .
 	.long \alt - .
 	.word \feature
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 9 lines · Ben Hutchings

The altinstruction_entry macro was originally used only on x86-64, and assumed 64-bit pointers and alignment.

Commit b4ca46e4e82a0a5976fe5eab85be585d75f8202f ("x86-32: Fix boot with CONFIG_X86_INVD_BUG") introduced a use of the macro on x86-32. Before this, the 64-bit pointers had been replaced by 32-bit offsets, so it worked - in at least one case. However, the alignment is still wrong for x86-32, which can result in zero-padding between entries and a BUG in apply_alternatives.

Fixed in Linus tree already: commit a7f934d4f16144cb

Thanks,

tglx