Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 615d0014 authored by Arvind Sankar's avatar Arvind Sankar Committed by Greg Kroah-Hartman
Browse files

x86/boot: Use unsigned comparison for addresses



[ Upstream commit 81a34892c2c7c809f9c4e22c5ac936ae673fb9a2 ]

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:

  97aa276579b2 ("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: default avatarArvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200301230436.2246909-6-nivedita@alum.mit.edu
Link: https://lore.kernel.org/r/20200308080859.21568-14-ardb@kernel.org


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 09f8ac74
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ ENTRY(startup_32)
	notl	%eax
	andl    %eax, %ebx
	cmpl	$LOAD_PHYSICAL_ADDR, %ebx
	jge	1f
	jae	1f
#endif
	movl	$LOAD_PHYSICAL_ADDR, %ebx
1:
+2 −2
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ ENTRY(startup_32)
	notl	%eax
	andl	%eax, %ebx
	cmpl	$LOAD_PHYSICAL_ADDR, %ebx
	jge	1f
	jae	1f
#endif
	movl	$LOAD_PHYSICAL_ADDR, %ebx
1:
@@ -297,7 +297,7 @@ ENTRY(startup_64)
	notq	%rax
	andq	%rax, %rbp
	cmpq	$LOAD_PHYSICAL_ADDR, %rbp
	jge	1f
	jae	1f
#endif
	movq	$LOAD_PHYSICAL_ADDR, %rbp
1: