public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Stuart Yoder" <stuart.yoder@arm.com>
To: devel@edk2.groups.io, Abhi.Singh@arm.com
Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>,
	Barton Gao <gaojie@byosoft.com.cn>,
	Carolyn Gjertsen <Carolyn.Gjertsen@amd.com>
Subject: Re: [edk2-devel] [PATCH v2 5/6] uefi-sct/SctPkg: TCG MORLOCK Locked No Key State Test
Date: Thu, 21 Sep 2023 14:03:40 -0500	[thread overview]
Message-ID: <c70c40a1-1b69-09bd-bc22-84c1f009b539@arm.com> (raw)
In-Reply-To: <20230921163748.275971-6-Abhi.Singh@arm.com>


See inline comments...

On 9/21/23 11:37 AM, Abhimanyu Singh via groups.io wrote:
> SCT spec: https://bugzilla.tianocore.org/show_bug.cgi?id=4374
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4419
> 
> -Implement MemoryOverwriteRequestControlLock Locked No Key
>   State test cases
>   -Add Assertions 23 - 32 from SCT spec
>   -Add Test Case to MemoryOverwriteRequestFunctionTest
> 
> Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>
> Cc: Barton Gao <gaojie@byosoft.com.cn>
> Cc: Carolyn Gjertsen <Carolyn.Gjertsen@amd.com>
> Signed-off-by: Abhi Singh <Abhi.Singh@arm.com>
> Change-Id: I298f8a0f55376b00233c9ee9c6b0262dc8869ccb
> ---

I think there is one test assertion missing from the code and from
the SCT spec for these tests.  There should be a test for the
case where MemoryOverwriteRequestControlLock is locked without
a key and there is an attempt to _delete_ MemoryOverwriteRequestControl.

That is a different path in the firmware from writing data to
the variable and should return ACCESS_DENIED.


[cut]

> +TCGMemoryOverwriteRequestControlLockLockedNoKeyState (
> +  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL       *StandardLib,
> +  IN EFI_TEST_RECOVERY_LIBRARY_PROTOCOL       *RecoveryLib,
> +  IN RESET_DATA                               *ResetData
> +  )
> +{
> +  EFI_STATUS                           Status;
> +  EFI_TEST_ASSERTION                   Result;
> +  UINTN                                DataSize;
> +  UINTN                                MemoryOverwriteControlLockKeyValue;
> +  UINT8                                MemoryOverwriteRequestControlLockData;
> +  UINT8                                MemoryOverwriteRequestControlData;
> +  UINT8                                MemoryOverwriteRequestControlDataCached;
> +  UINT32                               Attributes;
> +
> +   if (ResetData->Step == 0) {
> +    goto INITIAL_RESET;
> +  } else if (ResetData->Step == 1) {
> +    goto MORLOCK_LOCKED_STATE;
> +  }
> +
> +INITIAL_RESET:
> +  //
> +  // Reset MORLock variable by performing a cold reset
> +  //
> +  ResetData->Step = 1;
> +  ResetData->CheckpointStep = LOCK_NO_KEY_STATE_TEST;
> +
> +  Status = RecoveryLib->WriteResetRecord (
> +                  RecoveryLib,
> +                  sizeof (RESET_DATA),
> +                  (UINT8*)ResetData
> +                  );
> +  if (EFI_ERROR(Status)) {
> +    StandardLib->RecordAssertion (
> +                  StandardLib,
> +                  EFI_TEST_ASSERTION_FAILED,
> +                  gTestGenericFailureGuid,
> +                  L"TestRecoveryLib - WriteResetRecord",
> +                  L"%a:%d:Status - %r",
> +                  __FILE__,
> +                  (UINTN)__LINE__,
> +                  Status
> +                  );
> +    return Status;
> +  }
> +  SctPrint (L"System will cold reset after 1 second...");
> +  gtBS->Stall (1000000);
> +  gtRT->ResetSystem (
> +                  EfiResetCold,
> +                  EFI_SUCCESS,
> +                  0,
> +                  NULL
> +                  );
> +
> +MORLOCK_LOCKED_STATE:
> +  //change checkpoint to next function

Nit- space after comment char.

Thanks,
Stuart


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108966): https://edk2.groups.io/g/devel/message/108966
Mute This Topic: https://groups.io/mt/101504340/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-09-21 19:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 16:37 [edk2-devel] [PATCH v2 0/6] RESEND: TCG MemoryOverwriteRequest Tests Abhimanyu Singh
2023-09-21 16:37 ` [edk2-devel] [PATCH v2 1/6] uefi-sct/SctPkg: TCG Platform Reset Check Test Abhimanyu Singh
2023-09-21 16:37 ` [edk2-devel] [PATCH v2 2/6] uefi-sct/SctPkg: TCG MOR SetVariable Test Abhimanyu Singh
2023-09-21 19:03   ` Stuart Yoder
2023-09-21 16:37 ` [edk2-devel] [PATCH v2 3/6] uefi-sct/SctPkg: TCG MORLOCK " Abhimanyu Singh
2023-09-21 19:03   ` Stuart Yoder
2023-09-21 16:37 ` [edk2-devel] [PATCH v2 4/6] uefi-sct/SctPkg: TCG MORLOCK Unlocked State Test Abhimanyu Singh
2023-09-21 19:03   ` Stuart Yoder
2023-09-21 16:37 ` [edk2-devel] [PATCH v2 5/6] uefi-sct/SctPkg: TCG MORLOCK Locked No Key " Abhimanyu Singh
2023-09-21 19:03   ` Stuart Yoder [this message]
2023-09-21 16:37 ` [edk2-devel] [PATCH v2 6/6] uefi-sct/SctPkg: TCG MORLOCK Locked with " Abhimanyu Singh
2023-09-21 19:03   ` Stuart Yoder
2023-09-21 19:03 ` [edk2-devel] [PATCH v2 0/6] RESEND: TCG MemoryOverwriteRequest Tests Stuart Yoder
  -- strict thread matches above, loose matches on Subject: below --
2023-08-23  2:09 [edk2-devel] [PATCH v2 0/6] " Abhimanyu Singh
2023-08-23  2:09 ` [edk2-devel] [PATCH v2 5/6] uefi-sct/SctPkg: TCG MORLOCK Locked No Key State Test Abhimanyu Singh

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=c70c40a1-1b69-09bd-bc22-84c1f009b539@arm.com \
    --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