Re: [edk2-devel] [PATCH] SecurityPkg: Initailize variable Status before it is consumed.

2020-09-01 Thread Laszlo Ersek
On 09/01/20 09:02, Laszlo Ersek wrote:
> On 09/01/20 02:55, Zhiguang Liu wrote:
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2945
>>
>> V2: Move "Status = EFI_SUCCESS;" before the EDKII_TCG_PRE_HASH check.
>>
>> Cc: Jiewen Yao 
>> Cc: Jian J Wang 
>> Cc: Qi Zhang 
>> Cc: Rahul Kumar 
>> Cc: Laszlo Ersek 
>> Reviewed-by: Jiewen Yao 
>> Signed-off-by: Zhiguang Liu 
>> ---
>>  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c 
>> b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
>> index 0e770f4485..93a8803ff6 100644
>> --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
>> +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
>> @@ -456,6 +456,7 @@ HashLogExtendEvent (
>>if ((Flags & EDKII_TCG_PRE_HASH) != 0 || (Flags & 
>> EDKII_TCG_PRE_HASH_LOG_ONLY) != 0) {
>>  ZeroMem (&DigestList, sizeof(DigestList));
>>  CopyMem (&DigestList, HashData, sizeof(DigestList));
>> +Status = EFI_SUCCESS;
>>  if ((Flags & EDKII_TCG_PRE_HASH) !=0 ) {
>>Status = Tpm2PcrExtend (
>> NewEventHdr->PCRIndex,
>>
> 
> Reviewed-by: Laszlo Ersek 
> 
> I'll let Jiewen or Jian merge this.
> 
> Please change the status of TianoCore#2945 to IN_PROGRESS, and link both
> versions of this patch into the ticket as well (in a new comment).

Merged as commit 46db105b7b77, via
.

BZ updated.

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64909): https://edk2.groups.io/g/devel/message/64909
Mute This Topic: https://groups.io/mt/76530112/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] SecurityPkg: Initailize variable Status before it is consumed.

2020-09-01 Thread Zhiguang Liu
Hi Liming,
Can this patch check in before this stable tag?

Thanks
Zhiguang

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Zhiguang
> Liu
> Sent: Tuesday, September 1, 2020 8:55 AM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen ; Wang, Jian J ;
> Zhang, Qi1 ; Kumar, Rahul1 ;
> Laszlo Ersek 
> Subject: [edk2-devel] [PATCH] SecurityPkg: Initailize variable Status before 
> it is
> consumed.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2945
> 
> V2: Move "Status = EFI_SUCCESS;" before the EDKII_TCG_PRE_HASH check.
> 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Qi Zhang 
> Cc: Rahul Kumar 
> Cc: Laszlo Ersek 
> Reviewed-by: Jiewen Yao 
> Signed-off-by: Zhiguang Liu 
> ---
>  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> index 0e770f4485..93a8803ff6 100644
> --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> @@ -456,6 +456,7 @@ HashLogExtendEvent (
>if ((Flags & EDKII_TCG_PRE_HASH) != 0 || (Flags &
> EDKII_TCG_PRE_HASH_LOG_ONLY) != 0) {
> 
>  ZeroMem (&DigestList, sizeof(DigestList));
> 
>  CopyMem (&DigestList, HashData, sizeof(DigestList));
> 
> +Status = EFI_SUCCESS;
> 
>  if ((Flags & EDKII_TCG_PRE_HASH) !=0 ) {
> 
>Status = Tpm2PcrExtend (
> 
> NewEventHdr->PCRIndex,
> 
> --
> 2.25.1.windows.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#64865): https://edk2.groups.io/g/devel/message/64865
> Mute This Topic: https://groups.io/mt/76530112/1779286
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub  [zhiguang@intel.com]
> -=-=-=-=-=-=


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64872): https://edk2.groups.io/g/devel/message/64872
Mute This Topic: https://groups.io/mt/76530112/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] SecurityPkg: Initailize variable Status before it is consumed.

2020-09-01 Thread Laszlo Ersek
On 09/01/20 02:55, Zhiguang Liu wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2945
> 
> V2: Move "Status = EFI_SUCCESS;" before the EDKII_TCG_PRE_HASH check.
> 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Qi Zhang 
> Cc: Rahul Kumar 
> Cc: Laszlo Ersek 
> Reviewed-by: Jiewen Yao 
> Signed-off-by: Zhiguang Liu 
> ---
>  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c 
> b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> index 0e770f4485..93a8803ff6 100644
> --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> @@ -456,6 +456,7 @@ HashLogExtendEvent (
>if ((Flags & EDKII_TCG_PRE_HASH) != 0 || (Flags & 
> EDKII_TCG_PRE_HASH_LOG_ONLY) != 0) {
>  ZeroMem (&DigestList, sizeof(DigestList));
>  CopyMem (&DigestList, HashData, sizeof(DigestList));
> +Status = EFI_SUCCESS;
>  if ((Flags & EDKII_TCG_PRE_HASH) !=0 ) {
>Status = Tpm2PcrExtend (
> NewEventHdr->PCRIndex,
> 

Reviewed-by: Laszlo Ersek 

I'll let Jiewen or Jian merge this.

Please change the status of TianoCore#2945 to IN_PROGRESS, and link both
versions of this patch into the ticket as well (in a new comment).

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64869): https://edk2.groups.io/g/devel/message/64869
Mute This Topic: https://groups.io/mt/76530112/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH] SecurityPkg: Initailize variable Status before it is consumed.

2020-08-31 Thread Zhiguang Liu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2945

V2: Move "Status = EFI_SUCCESS;" before the EDKII_TCG_PRE_HASH check.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Qi Zhang 
Cc: Rahul Kumar 
Cc: Laszlo Ersek 
Reviewed-by: Jiewen Yao 
Signed-off-by: Zhiguang Liu 
---
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c 
b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
index 0e770f4485..93a8803ff6 100644
--- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
+++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
@@ -456,6 +456,7 @@ HashLogExtendEvent (
   if ((Flags & EDKII_TCG_PRE_HASH) != 0 || (Flags & 
EDKII_TCG_PRE_HASH_LOG_ONLY) != 0) {
 ZeroMem (&DigestList, sizeof(DigestList));
 CopyMem (&DigestList, HashData, sizeof(DigestList));
+Status = EFI_SUCCESS;
 if ((Flags & EDKII_TCG_PRE_HASH) !=0 ) {
   Status = Tpm2PcrExtend (
NewEventHdr->PCRIndex,
-- 
2.25.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64865): https://edk2.groups.io/g/devel/message/64865
Mute This Topic: https://groups.io/mt/76530112/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] SecurityPkg: Initailize variable Status before it is consumed.

2020-08-31 Thread Yao, Jiewen
Agree with Laszlo.

I prefer to move "Status = EFI_SUCCESS;" before the EDKII_TCG_PRE_HASH check.

With that moving, reviewed-by: Jiewen Yao 

Thank you
Yao Jiewen


> -Original Message-
> From: Laszlo Ersek 
> Sent: Monday, August 31, 2020 11:46 PM
> To: devel@edk2.groups.io; Liu, Zhiguang 
> Cc: Yao, Jiewen ; Wang, Jian J ;
> Zhang, Qi1 ; Kumar, Rahul1 
> Subject: Re: [edk2-devel] [PATCH] SecurityPkg: Initailize variable Status 
> before it
> is consumed.
> 
> On 08/31/20 10:15, Zhiguang Liu wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2945
> >
> > Cc: Jiewen Yao 
> > Cc: Jian J Wang 
> > Cc: Qi Zhang 
> > Cc: Rahul Kumar 
> > Signed-off-by: Zhiguang Liu 
> > ---
> >  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> > index 0e770f4485..5e883f0cc5 100644
> > --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> > +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> > @@ -449,6 +449,7 @@ HashLogExtendEvent (
> >EFI_STATUSStatus;
> >TPML_DIGEST_VALUESDigestList;
> >
> > +  Status = EFI_SUCCESS;
> >if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {
> >  return EFI_DEVICE_ERROR;
> >}
> >
> 
> I agree that there is a path in the code where Status is read without
> having been set.
> 
> It seems that using EFI_SUCCESS as default value makes sense (assuming
> the LogHashEvent() call is the important one). I'll let SecurityPkg
> maintainers decide about this.
> 
> I think it would be nicer to set Status to EFI_SUCCESS either on the
> (currently missing) "else" branch, or else just before the
> EDKII_TCG_PRE_HASH check. In particular, setting Status so early that we
> may still exit with EFI_DEVICE_ERROR is wasteful. So at least I'd move
> the assignment past the "return EFI_DEVICE_ERROR" statement.
> 
> But... it's late. I agree that this patch qualifies for the stable tag.
> So I'm not asking for a repost. I just wish more thought had been given
> to the placement of the assignment.
> 
> Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64843): https://edk2.groups.io/g/devel/message/64843
Mute This Topic: https://groups.io/mt/76530112/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] SecurityPkg: Initailize variable Status before it is consumed.

2020-08-31 Thread Laszlo Ersek
On 08/31/20 10:15, Zhiguang Liu wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2945
> 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Qi Zhang 
> Cc: Rahul Kumar 
> Signed-off-by: Zhiguang Liu 
> ---
>  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c 
> b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> index 0e770f4485..5e883f0cc5 100644
> --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> @@ -449,6 +449,7 @@ HashLogExtendEvent (
>EFI_STATUSStatus;
>TPML_DIGEST_VALUESDigestList;
>  
> +  Status = EFI_SUCCESS;
>if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {
>  return EFI_DEVICE_ERROR;
>}
> 

I agree that there is a path in the code where Status is read without
having been set.

It seems that using EFI_SUCCESS as default value makes sense (assuming
the LogHashEvent() call is the important one). I'll let SecurityPkg
maintainers decide about this.

I think it would be nicer to set Status to EFI_SUCCESS either on the
(currently missing) "else" branch, or else just before the
EDKII_TCG_PRE_HASH check. In particular, setting Status so early that we
may still exit with EFI_DEVICE_ERROR is wasteful. So at least I'd move
the assignment past the "return EFI_DEVICE_ERROR" statement.

But... it's late. I agree that this patch qualifies for the stable tag.
So I'm not asking for a repost. I just wish more thought had been given
to the placement of the assignment.

Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64840): https://edk2.groups.io/g/devel/message/64840
Mute This Topic: https://groups.io/mt/76530112/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] SecurityPkg: Initailize variable Status before it is consumed.

2020-08-31 Thread Zhiguang Liu
Hi Liming,
This is a small bug fix, and I want to catch the stable tag.

Thanks
Zhiguang

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Zhiguang
> Liu
> Sent: Monday, August 31, 2020 4:16 PM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen ; Wang, Jian J ;
> Zhang, Qi1 ; Kumar, Rahul1 
> Subject: [edk2-devel] [PATCH] SecurityPkg: Initailize variable Status before 
> it is
> consumed.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2945
> 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Qi Zhang 
> Cc: Rahul Kumar 
> Signed-off-by: Zhiguang Liu 
> ---
>  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> index 0e770f4485..5e883f0cc5 100644
> --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
> @@ -449,6 +449,7 @@ HashLogExtendEvent (
>EFI_STATUSStatus;
> 
>TPML_DIGEST_VALUESDigestList;
> 
> 
> 
> +  Status = EFI_SUCCESS;
> 
>if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {
> 
>  return EFI_DEVICE_ERROR;
> 
>}
> 
> --
> 2.25.1.windows.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#64819): https://edk2.groups.io/g/devel/message/64819
> Mute This Topic: https://groups.io/mt/76530112/1779286
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub  [zhiguang@intel.com]
> -=-=-=-=-=-=


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64821): https://edk2.groups.io/g/devel/message/64821
Mute This Topic: https://groups.io/mt/76530112/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH] SecurityPkg: Initailize variable Status before it is consumed.

2020-08-31 Thread Zhiguang Liu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2945

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Qi Zhang 
Cc: Rahul Kumar 
Signed-off-by: Zhiguang Liu 
---
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c 
b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
index 0e770f4485..5e883f0cc5 100644
--- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
+++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
@@ -449,6 +449,7 @@ HashLogExtendEvent (
   EFI_STATUSStatus;
   TPML_DIGEST_VALUESDigestList;
 
+  Status = EFI_SUCCESS;
   if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {
 return EFI_DEVICE_ERROR;
   }
-- 
2.25.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64819): https://edk2.groups.io/g/devel/message/64819
Mute This Topic: https://groups.io/mt/76530112/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-