Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp568640ybz; Wed, 22 Apr 2020 03:55:21 -0700 (PDT) X-Google-Smtp-Source: APiQypK7V7tATRhGgKiqa3rTl4pV8Hb59wN7GSo5HydcMCFIu0fvcKfMZcS99OKip+Ap+YKTo70r X-Received: by 2002:a17:906:f288:: with SMTP id gu8mr26336822ejb.281.1587552921113; Wed, 22 Apr 2020 03:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587552921; cv=none; d=google.com; s=arc-20160816; b=s+iIXvEHnbpWKw1Ow81Fh5NOPp0j83Wv280sJrisMI/vpjyfLNztE0xb7N0ypcTVQc jQ5zQPM72pOcWEl2pvbxXT4RYIAzHF7JUL7ILlWRWTd8WzMsN+mHQGkPJ0rgXqAdWOUy r+sGoBQw4wYFe/pax0/glojnjNg43ctSAWG/muT3iBjuCLc+TJxNmze/hucs9Q+gbtIM PiB6LOVz/Ja+TuLIEvqS33ldV+ApEoIA3iPjfBwZyVCLNXNXgfmJyMomTVxL9fKVl6Ru KBb/GRiVulSK02LhdzJJ9Tlj9PueeVtLx0mVp/8d5wN0GvtzBibeyc/iY6HtNOZYmh9o fxpw== 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=rGM8bAn4NZwHOpWDi0LWveZeupS3e+D52tymblqEcDQ=; b=hJk4cw7qy37D4Nn5hVHjpm8I+cGKohBUtCVq6G8Dh/dgZ2uSMeBsK7qvmPVzgjUYpN lHf591e0pj7pBtJbsjtoUxcVz6HTY2+E+JLBlzQl23xGxjSqcVgC09UuXAFPTBxLsSUz 3dT3KhyGdfy3lpW5vPe7cQUUNsVnpTVKVpgu3FPaYNlgKaeskdQqc+WCz7V73MclS4HL 2EzyA1v+CFrD9DdJvuZIPGe+Sx97TO4Rhy1eWzgHzi/ENjdJOWKSxRyY4MiJrAWR52JV bwLPQ/VjQXgGHdfeRkEhmZAyFHLftRx2g+QuLpLvUQ2ti1gWD9DaGhEE4BohVV/BcNN/ 76ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F1+g5E0O; 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 m24si3202868edr.227.2020.04.22.03.54.58; Wed, 22 Apr 2020 03:55:21 -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=F1+g5E0O; 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 S1729071AbgDVKKo (ORCPT + 99 others); Wed, 22 Apr 2020 06:10:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:40054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728479AbgDVKK0 (ORCPT ); Wed, 22 Apr 2020 06:10:26 -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 2D6592070B; Wed, 22 Apr 2020 10:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587550226; bh=MPttC5wXtR7BefjcAZ3LylgLYLtku1sJI3+nLqHtGaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F1+g5E0OhfEQLN8G3XbkBHyv6/shg6MwKg9eMByXVgTOlt6J/29DpaymasVV+cRZY uYc1Sd1gO/QfwJUbmVNSgzDEy/7Npsh4PONXNGcFTB4DuQTOFqpax/EJE5ROGngX7/ v/cJPQN2u/fJtkjlo740131eCgAJp3BpPhIhIYOA= 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.14 019/199] x86/boot: Use unsigned comparison for addresses Date: Wed, 22 Apr 2020 11:55:45 +0200 Message-Id: <20200422095100.130213510@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200422095057.806111593@linuxfoundation.org> References: <20200422095057.806111593@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 39fdede523f21..a25127916e679 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -105,7 +105,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: @@ -280,7 +280,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