public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Heyi Guo <heyi.guo@linaro.org>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>,
	"linaro-uefi@lists.linaro.org" <linaro-uefi@lists.linaro.org>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Dong, Eric" <eric.dong@intel.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [PATCH] MdeModulePkg/NonDiscoverable: fix memory override bug
Date: Mon, 30 Oct 2017 22:42:39 +0800	[thread overview]
Message-ID: <03687a4b-15de-a65c-3cbb-4aacc19a041e@linaro.org> (raw)
In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5BAAC00C@SHSMSX104.ccr.corp.intel.com>

Hi Ray,

It seems Ard already provided his R-B :)

Thanks.

Heyi


On 10/30/2017 06:23 PM, Ni, Ruiyu wrote:
> I will wait for Ard's feedback. It's an ARM specific module.
>
> Thanks/Ray
>
>> -----Original Message-----
>> From: Zeng, Star
>> Sent: Monday, October 30, 2017 6:07 PM
>> To: Ni, Ruiyu <ruiyu.ni@intel.com>; Heyi Guo <heyi.guo@linaro.org>; linaro-
>> uefi@lists.linaro.org; edk2-devel@lists.01.org
>> Cc: Dong, Eric <eric.dong@intel.com>; Ard Biesheuvel
>> <ard.biesheuvel@linaro.org>; Zeng, Star <star.zeng@intel.com>
>> Subject: RE: [edk2][PATCH] MdeModulePkg/NonDiscoverable: fix memory
>> override bug
>>
>> Ray,
>> Please help take a review to this patch.
>>
>>
>> Thanks,
>> Star
>> -----Original Message-----
>> From: Heyi Guo [mailto:heyi.guo@linaro.org]
>> Sent: Monday, October 30, 2017 1:48 PM
>> To: linaro-uefi@lists.linaro.org; edk2-devel@lists.01.org
>> Cc: Heyi Guo <heyi.guo@linaro.org>; Zeng, Star <star.zeng@intel.com>;
>> Dong, Eric <eric.dong@intel.com>; Ard Biesheuvel
>> <ard.biesheuvel@linaro.org>; Ni, Ruiyu <ruiyu.ni@intel.com>
>> Subject: [edk2][PATCH] MdeModulePkg/NonDiscoverable: fix memory
>> override bug
>>
>> For PciIoPciRead interface, memory prior to Buffer would be written with
>> zeros if Offset was larger than sizeof (Dev->ConfigSpace), which would cause
>> serious system exception.
>>
>> So we add a pre-check branch to avoid memory override.
>>
>> Cc: Star Zeng <star.zeng@intel.com>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
>> ---
>>   .../Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c | 5
>> +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git
>> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
>> PciDeviceIo.c
>> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
>> PciDeviceIo.c
>> index c836ad6..0e42ae4 100644
>> ---
>> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
>> PciDeviceIo.c
>> +++
>> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverable
>> Pc
>> +++ iDeviceIo.c
>> @@ -465,6 +465,11 @@ PciIoPciRead (
>>     Address = (UINT8 *)&Dev->ConfigSpace + Offset;
>>     Length = Count << ((UINTN)Width & 0x3);
>>
>> +  if (Offset >= sizeof (Dev->ConfigSpace)) {
>> +    ZeroMem (Buffer, Length);
>> +    return EFI_SUCCESS;
>> +  }
>> +
>>     if (Offset + Length > sizeof (Dev->ConfigSpace)) {
>>       //
>>       // Read all zeroes for config space accesses beyond the first
>> --
>> 1.9.1



      reply	other threads:[~2017-10-30 14:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-30  5:47 [PATCH] MdeModulePkg/NonDiscoverable: fix memory override bug Heyi Guo
2017-10-30  8:14 ` Ard Biesheuvel
2017-11-07  9:33   ` Heyi Guo
2017-11-08  4:53     ` Zeng, Star
2017-11-08  5:02       ` Heyi Guo
2017-10-30 10:07 ` Zeng, Star
2017-10-30 10:23   ` Ni, Ruiyu
2017-10-30 14:42     ` Heyi Guo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03687a4b-15de-a65c-3cbb-4aacc19a041e@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox