From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web10.12075.1601557497334224558 for ; Thu, 01 Oct 2020 06:04:57 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LvXApfAB; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601557496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3u17wqzb6/XneUmrucUjruxsNj0t9VcI/avJQ7F+WLc=; b=LvXApfAB/jlD5ZVmTkesHa5gRkDr8bAVPK3M2Ixbk/81XSN8v79gmPBj13PKnFkhbX05oM iq2xpys8GiWikhDi+GQ+gvLLXYoEF0g9H1aDedknkKu/eys1y9H60hEtwdSWJQaRVXke1e GffeOcrF0aHBFxTATnxXZgzVaZUFOys= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-585-ethihWD8OEyh0EfMUEBk8g-1; Thu, 01 Oct 2020 09:04:54 -0400 X-MC-Unique: ethihWD8OEyh0EfMUEBk8g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C24FD106272E; Thu, 1 Oct 2020 13:04:52 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-110.ams2.redhat.com [10.36.113.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A6B660BF1; Thu, 1 Oct 2020 13:04:50 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 1/1] MdePkg/BaseLib: Fix invalid memory access in AArch64 SetJump/LongJump To: devel@edk2.groups.io, jbobek@nvidia.com Cc: Harry Liebel , Olivier Martin , Jeff Brasen , Ashish Singhal , Leif Lindholm , Ard Biesheuvel , Michael D Kinney , Liming Gao , Zhiguang Liu References: From: "Laszlo Ersek" Message-ID: Date: Thu, 1 Oct 2020 15:04:49 +0200 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 09/29/20 03:12, Jan Bobek wrote: > Correct the memory offsets used in REG_ONE/REG_PAIR macros to > synchronize them with definition of the BASE_LIBRARY_JUMP_BUFFER > structure on AArch64. > > The REG_ONE macro declares only a single 64-bit register be > read/written; however, the subsequent offset has previously been 16 > bytes larger, creating an unused memory gap in the middle of the > structure and causing SetJump/LongJump functions to read/write 8 bytes > of memory past the end of the jump buffer struct. > > Signed-off-by: Jan Bobek > --- > MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S | 8 ++++---- > MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm | 8 ++++---- > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S > index 72cea259e9..deefdf526b 100644 > --- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S > +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S > @@ -20,10 +20,10 @@ GCC_ASM_EXPORT(InternalLongJump) > REG_ONE (x16, 96) /*IP0*/ > > > > #define FPR_LAYOUT \ > > - REG_PAIR ( d8, d9, 112); \ > > - REG_PAIR (d10, d11, 128); \ > > - REG_PAIR (d12, d13, 144); \ > > - REG_PAIR (d14, d15, 160); > > + REG_PAIR ( d8, d9, 104); \ > > + REG_PAIR (d10, d11, 120); \ > > + REG_PAIR (d12, d13, 136); \ > > + REG_PAIR (d14, d15, 152); > > > > #/** > > # Saves the current CPU context that can be restored with a call to LongJump() and returns 0.# > > diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm > index 20dd0f1b85..df70f29899 100644 > --- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm > +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm > @@ -19,10 +19,10 @@ > REG_ONE (x16, #96) /*IP0*/ > > > > #define FPR_LAYOUT \ > > - REG_PAIR ( d8, d9, #112); \ > > - REG_PAIR (d10, d11, #128); \ > > - REG_PAIR (d12, d13, #144); \ > > - REG_PAIR (d14, d15, #160); > > + REG_PAIR ( d8, d9, #104); \ > > + REG_PAIR (d10, d11, #120); \ > > + REG_PAIR (d12, d13, #136); \ > > + REG_PAIR (d14, d15, #152); > > > > ;/** > > ; Saves the current CPU context that can be restored with a call to LongJump() and returns 0.# > Your git setup is wrong as well (what with the extra line breaks in the formatted patch); please run "BaseTools/Scripts/SetupGit.py" in your edk2 clone. Updating the CC list on this one too. Thanks Laszlo