Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1685710ybz; Thu, 16 Apr 2020 13:40:36 -0700 (PDT) X-Google-Smtp-Source: APiQypLpvzJb/e3+AK33YWgA0kh8icKhQSDGhR785FJgaeTa5LyGZvfRb/zyJgrckLd5RjL3xO+w X-Received: by 2002:a05:6402:1852:: with SMTP id v18mr42690edy.39.1587069636118; Thu, 16 Apr 2020 13:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587069636; cv=none; d=google.com; s=arc-20160816; b=b1ySmQvfpi1sQ95TmB8PGCB1qPRbvs25gURU5rnd/i25FfVh6yWrDQgexxG6CC2ymD nIBWRj7dYmCJrpPhBF5vskX+uncquzGirqk7t75DehKUK45HigAdfUu3YoAaYyjcU+aY GHVyXtmXsvjF5ahwBBuhDH/iPIAczwxoQollKwx4yGvDrLXlivWKM2cPXX2VOSar18Qe cnzy1rToNd8+UlGR/lx4ApV1qLEjg3KbSnYOCThRRYAyrvqWW7nKAvPaa2Non2ilihBm Lg3qjdVft42mRzdYIrggrJYCiVDcaD/X4CCPjypYOt6AsMJbRyKUGtDWZpyi94dtOG6I fcBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+ifWPzZoTOExpPOb7rhG9HEmdoKmd+8IikEmLlU4EwA=; b=w/qVDC74gCT7Nurmag/yWDaVgFLOpllQGgYkkolN9oig1HWlrdqhI8CEP9HI/Agd8O Tp1eWbBY1Wzzuu+fD736NTBemNUlbKOOQ/EaoQVwwW8LyyQolJPvk1dKrWEHnN3GOBd3 q/RVDA3KKvDQG+SS/prQCEvNh+sOo6fWv+E2i6txzlDss6m06CQfYQrysBTXlRxuRHJR X3NP8e6XEVrpnCp3BF0KngKEjEezIPvRN26xtBuBvaBBH4h64XExWvqzNXIlB7vEgvUi 5B98pj7mYvs2cALv89QPeGBx/xuU86IQcg9MmDSKUUcoTiaAuizBKcXv8IgcPhWtc11B XlbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MRAek1kI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx5si9046628ejb.74.2020.04.16.13.40.12; Thu, 16 Apr 2020 13:40:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MRAek1kI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2636604AbgDPQCK (ORCPT + 99 others); Thu, 16 Apr 2020 12:02:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:35064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2895309AbgDPN0u (ORCPT ); Thu, 16 Apr 2020 09:26:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0E975206E9; Thu, 16 Apr 2020 13:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587043610; bh=Gv4oa5x5E7YXqPDsRigVE4FB0OcWbjPy/wOZslMaZx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MRAek1kIYuCibq46zD/U27ypBlCdtOEqG4BOk2I4PpkPMKk20xrhUpN1dyG9gEy5z D6ljOoj3IPlQQ0LqrljeEHIEsXg01X52PUCxxxSdzo8qD6WLFnJtJAeZd8ZU2kra9n fiXZFlD5oGBy0R1G3cRewuvEs2quG4JEDR5WTzTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arvind Sankar , Ard Biesheuvel , Ingo Molnar , Sasha Levin Subject: [PATCH 4.19 027/146] x86/boot: Use unsigned comparison for addresses Date: Thu, 16 Apr 2020 15:22:48 +0200 Message-Id: <20200416131246.160098417@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131242.353444678@linuxfoundation.org> References: <20200416131242.353444678@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arvind Sankar [ 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: Arvind Sankar Signed-off-by: Ard Biesheuvel Signed-off-by: Ingo Molnar 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: Sasha Levin --- arch/x86/boot/compressed/head_32.S | 2 +- arch/x86/boot/compressed/head_64.S | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S index 37380c0d59996..01d628ea34024 100644 --- a/arch/x86/boot/compressed/head_32.S +++ b/arch/x86/boot/compressed/head_32.S @@ -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: diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 4eaa724afce34..9fa644c62839f 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -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: -- 2.20.1