From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by mx.groups.io with SMTP id smtpd.web10.6154.1602528923999525856 for ; Mon, 12 Oct 2020 11:55:24 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=cMqcwxox; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 216.228.121.64, mailfrom: jbobek@nvidia.com) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Mon, 12 Oct 2020 11:54:25 -0700 Received: from localhost (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 12 Oct 2020 18:55:14 +0000 References: <20201001161507.48710-1-jbobek@nvidia.com> <20201001161507.48710-2-jbobek@nvidia.com> <91988ebd-49cd-4a47-1c95-0e9e970d819d@arm.com> User-agent: mu4e 1.4.10; emacs 26.3 From: "Jan Bobek" To: "Kinney, Michael D" , Ard Biesheuvel , "devel@edk2.groups.io" , Liming Gao CC: Leif Lindholm , "Liu, Zhiguang" , Jeff Brasen , Ashish Singhal Subject: Re: [PATCH v2 1/1] MdePkg/BaseLib: Fix invalid memory access in AArch64 SetJump/LongJump In-Reply-To: Date: Mon, 12 Oct 2020 12:55:12 -0600 Message-ID: <87blh7jmun.fsf@nvidia.com> MIME-Version: 1.0 Return-Path: jbobek@nvidia.com X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1602528865; bh=YeJwMX8GGGTac53nhHqonVqip6vGaHPVMf4dXdB9xDM=; h=References:User-agent:From:To:CC:Subject:In-Reply-To:Date: Message-ID:MIME-Version:Content-Type:X-Originating-IP: X-ClientProxiedBy; b=cMqcwxoxdIcDaLHzaIekVRMqaCj5HbgtHKj2LuBeQlTnNQ3Eyco7abCsvgnYuwyE2 p3teWxbQ4leq4SV6jrA3Gzg00wEtnxld5ymI8iLpvSYnvpw0eFPVEX7mrSK0IiyfK6 4rUg1q4tLfSBIWffbKCNbyHuFZ2Vc908iZ6nwLrcFbmJPTxQG7ACItkA52d+wyMXsS s0lxeKVZW46CmKPlZr3xFqdSc6+82UrHmFg3pDGx1Hem1PUovgI9zcoNJhbb3C4SXS EDGBmhDkYT1GBhoqYRPL9M+/lU1iSI9DcIxNv8GEKnnSg4Msn53e7H2Scovg45GqhB jocP0lZZpifwg== Content-Type: text/plain Hey guys, just wondering, are we waiting for more reviews before this is good to merge? Best, -Jan Kinney, Michael D writes: > No concerns. > > Acked-by: Michael D Kinney > > Mike > >> -----Original Message----- >> From: Ard Biesheuvel >> Sent: Monday, October 5, 2020 7:33 AM >> To: Jan Bobek ; devel@edk2.groups.io; Kinney, Michael D ; Liming Gao >> >> Cc: Leif Lindholm ; Liu, Zhiguang ; Jeff Brasen ; Ashish Singhal >> >> Subject: Re: [PATCH v2 1/1] MdePkg/BaseLib: Fix invalid memory access in AArch64 SetJump/LongJump >> >> On 10/1/20 6:15 PM, 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 is 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 >> >> Thanks Jan, >> >> Reviewed-by: Ard Biesheuvel >> >> Liming, Michael: any concerns? >> >> Thanks, >> >> >> > --- >> > 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 72cea259e913..deefdf526b95 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 20dd0f1b850f..df70f298998e 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.# >> >