Commit a9d72e63 authored by Venkatesh Pallipadi's avatar Venkatesh Pallipadi Committed by Linus Torvalds

[PATCH] x86: remove data-header and code overlap in boot/setup.S

The setup.S data and code is not cleanly separated.  The current space
reserved for setup header is not enough to fit the complete header.  As a
result, part of the header (EDDBUF) will overwrite the initial code.

I haven't seen any negative impact of this bug.  As, by the time the setup
code is overwritten, we would have finished executing it anyway.  But, I
think it is better to separate the header and code and prevent this
data_overwriting_the_code condition.

The atatched patch adds some space in the header to fit all the data listed
in Documentation/i386/zero-page.txt for both i386 and x86_64 (and updates
zero-page.txt).
Signed-off-by: default avatar: "Venkatesh Pallipadi" <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5b1aa762
...@@ -74,6 +74,10 @@ Offset Type Description ...@@ -74,6 +74,10 @@ Offset Type Description
0x21c unsigned long INITRD_SIZE, size in bytes of ramdisk image 0x21c unsigned long INITRD_SIZE, size in bytes of ramdisk image
0x220 4 bytes (setup.S) 0x220 4 bytes (setup.S)
0x224 unsigned short setup.S heap end pointer 0x224 unsigned short setup.S heap end pointer
0x226 unsigned short zero_pad
0x228 unsigned long cmd_line_ptr
0x22c unsigned long ramdisk_max
0x230 16 bytes trampoline
0x290 - 0x2cf EDD_MBR_SIG_BUFFER (edd.S) 0x290 - 0x2cf EDD_MBR_SIG_BUFFER (edd.S)
0x2d0 - 0x600 E820MAP 0x2d0 - 0x600 E820MAP
0x600 - 0x7ff EDDBUF (edd.S) for disk signature read sector 0x600 - 0x7ff EDDBUF (edd.S) for disk signature read sector
......
...@@ -162,7 +162,9 @@ ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff ...@@ -162,7 +162,9 @@ ramdisk_max: .long (-__PAGE_OFFSET-(512 << 20)-1) & 0x7fffffff
# the contents of an initrd # the contents of an initrd
trampoline: call start_of_setup trampoline: call start_of_setup
.space 1024 .align 16
# The offset at this point is 0x240
.space (0x7ff-0x240+1) # E820 & EDD space (ending at 0x7ff)
# End of setup header ##################################################### # End of setup header #####################################################
start_of_setup: start_of_setup:
......
...@@ -158,7 +158,9 @@ cmd_line_ptr: .long 0 # (Header version 0x0202 or later) ...@@ -158,7 +158,9 @@ cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
ramdisk_max: .long 0xffffffff ramdisk_max: .long 0xffffffff
trampoline: call start_of_setup trampoline: call start_of_setup
.space 1024 .align 16
# The offset at this point is 0x240
.space (0x7ff-0x240+1) # E820 & EDD space (ending at 0x7ff)
# End of setup header ##################################################### # End of setup header #####################################################
start_of_setup: start_of_setup:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment