Skip to content

Commit fc427b7

Browse files
nivedita76gregkh
authored andcommitted
x86/boot: Use unsigned comparison for addresses
[ Upstream commit 81a3489 ] The load address is compared with LOAD_PHYSICAL_ADDR using a signed comparison currently (using jge instruction). When loading a 64-bit kernel using the new efi32_pe_entry() point added by: 97aa276 ("efi/x86: Add true mixed mode entry point into .compat section") using Qemu with -m 3072, the firmware actually loads us above 2Gb, resulting in a very early crash. Use the JAE instruction to perform a unsigned comparison instead, as physical addresses should be considered unsigned. Signed-off-by: Arvind Sankar <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent f6bb3ea commit fc427b7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/x86/boot/compressed/head_32.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ ENTRY(startup_32)
106106
notl %eax
107107
andl %eax, %ebx
108108
cmpl $LOAD_PHYSICAL_ADDR, %ebx
109-
jge 1f
109+
jae 1f
110110
#endif
111111
movl $LOAD_PHYSICAL_ADDR, %ebx
112112
1:

arch/x86/boot/compressed/head_64.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ ENTRY(startup_32)
106106
notl %eax
107107
andl %eax, %ebx
108108
cmpl $LOAD_PHYSICAL_ADDR, %ebx
109-
jge 1f
109+
jae 1f
110110
#endif
111111
movl $LOAD_PHYSICAL_ADDR, %ebx
112112
1:
@@ -297,7 +297,7 @@ ENTRY(startup_64)
297297
notq %rax
298298
andq %rax, %rbp
299299
cmpq $LOAD_PHYSICAL_ADDR, %rbp
300-
jge 1f
300+
jae 1f
301301
#endif
302302
movq $LOAD_PHYSICAL_ADDR, %rbp
303303
1:

0 commit comments

Comments
 (0)