]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
x86/boot: Use unsigned comparison for addresses
authorArvind Sankar <nivedita@alum.mit.edu>
Sun, 8 Mar 2020 08:08:44 +0000 (09:08 +0100)
committerIngo Molnar <mingo@kernel.org>
Sun, 8 Mar 2020 08:58:17 +0000 (09:58 +0100)
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: Arvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo 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
arch/x86/boot/compressed/head_32.S
arch/x86/boot/compressed/head_64.S

index e013bdc1237bdd65aa7c425b8d87e89c0fea0e77..46bbe7ab4adf29ed5445214da1e3f37eac39c929 100644 (file)
@@ -105,7 +105,7 @@ SYM_FUNC_START(startup_32)
        notl    %eax
        andl    %eax, %ebx
        cmpl    $LOAD_PHYSICAL_ADDR, %ebx
-       jge     1f
+       jae     1f
 #endif
        movl    $LOAD_PHYSICAL_ADDR, %ebx
 1:
index 6a4ff919008c5e44951dc0bc53109c0ba31faf7c..5d8338a693cebaeb517bf5627116011336554108 100644 (file)
@@ -105,7 +105,7 @@ SYM_FUNC_START(startup_32)
        notl    %eax
        andl    %eax, %ebx
        cmpl    $LOAD_PHYSICAL_ADDR, %ebx
-       jge     1f
+       jae     1f
 #endif
        movl    $LOAD_PHYSICAL_ADDR, %ebx
 1:
@@ -305,7 +305,7 @@ SYM_CODE_START(startup_64)
        notq    %rax
        andq    %rax, %rbp
        cmpq    $LOAD_PHYSICAL_ADDR, %rbp
-       jge     1f
+       jae     1f
 #endif
        movq    $LOAD_PHYSICAL_ADDR, %rbp
 1: