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


Groups > linux.kernel > #1626354

[PATCH] Fix BSS corruption/overwrite issue in early x86 kernel startup

From Ashish Kalra <ashish@bluestacks.com>
Newsgroups linux.kernel
Subject [PATCH] Fix BSS corruption/overwrite issue in early x86 kernel startup
Date 2017-04-19 17:30 +0200
Message-ID <txZIm-56L-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Ashish Kalra <ashish@bluestacks.com>

The minimum size for a new stack (512 bytes) setup for arch/x86/boot components
when the bootloader does not setup/provide a stack for the early boot components
is not "enough".

The setup code executing as part of early kernel startup code, uses the stack
beyond 512 bytes and accidentally overwrites and corrupts part of the BSS
section. This is exposed mostly in the early video setup code, where 
it was corrupting BSS variables like force_x, force_y, which in-turn affected
kernel parameters such as screen_info (screen_info.orig_video_cols) and
later caused an exception/panic in console_init().

Most recent boot loaders setup the stack for early boot components, so this
stack overwriting into BSS section issue has not been exposed.

Signed-off-by: Ashish Kalra <ashish@bluestacks.com>
---
 arch/x86/boot/boot.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index bd49ec6..f673f92 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -16,7 +16,7 @@
 #ifndef BOOT_BOOT_H
 #define BOOT_BOOT_H
 
-#define STACK_SIZE	512	/* Minimum number of bytes for stack */
+#define STACK_SIZE	1024	/* Minimum number of bytes for stack */
 
 #ifndef __ASSEMBLY__
 
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] Fix BSS corruption/overwrite issue in early x86 kernel startup Ashish Kalra <ashish@bluestacks.com> - 2017-04-19 17:30 +0200
  [tip:x86/boot] x86/boot: Fix BSS corruption/overwrite bug in early  x86 kernel startup tip-bot for Ashish Kalra <tipbot@zytor.com> - 2017-04-20 13:30 +0200

csiph-web