Skip to content

Commit bf849b3

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 790829d commit bf849b3

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
@@ -105,7 +105,7 @@ ENTRY(startup_32)
105105
notl %eax
106106
andl %eax, %ebx
107107
cmpl $LOAD_PHYSICAL_ADDR, %ebx
108-
jge 1f
108+
jae 1f
109109
#endif
110110
movl $LOAD_PHYSICAL_ADDR, %ebx
111111
1:
@@ -280,7 +280,7 @@ ENTRY(startup_64)
280280
notq %rax
281281
andq %rax, %rbp
282282
cmpq $LOAD_PHYSICAL_ADDR, %rbp
283-
jge 1f
283+
jae 1f
284284
#endif
285285
movq $LOAD_PHYSICAL_ADDR, %rbp
286286
1:

0 commit comments

Comments
 (0)