Discussion: SCT debug_assert in `WaitForEvent_Conf`

Open
#1,906 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
rust

Research direction

Read patina_dxe_core/src/events.rs around wait_for_event and the linked SCT test EventTimerTaskPriorityServicesBBTestWaitForEvent.c at lines 201–213. The issue presents several possible approaches but does not choose one; first determine whether the debug assertion should accommodate this conformance test. Done means there is an agreed behavior for debug builds and the SCT run confirms it.

Written by the indexing model from the issue text.

Description

Patina debug (dev profile) builds with debug_asserts enabled will assert when running the "WaitForEvent_Conf" tests for "Conformance test for boot service WaitForEvent().".

While the UEFI Specification requires WaitForEvent() to be called at TPL_APPLICATION, the test will intentionally call at invalid TPL to verify that EFI_UNSUPPORTED is returned:

edk2-test/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest
/EventTimerTaskPriorityServicesBBTestWaitForEvent.c
:

  //
  // Wait for event at invalid TPLs
  //
  for (Index = 0; CheckTpls[Index] != 0; Index++) {
    OldTpl = gtBS->RaiseTPL (CheckTpls[Index]);
    Status = gtBS->WaitForEvent (1, &Event, &EventIndex);
    gtBS->RestoreTPL (OldTpl);

    if (Status == EFI_UNSUPPORTED) {
      AssertionType = EFI_TEST_ASSERTION_PASSED;
    } else {
      AssertionType = EFI_TEST_ASSERTION_FAILED;
    }

After commit https://github.com/OpenDevicePartnership/patina/commit/208185bf5dea58532d7ba9d80a9965099ab714ca, unsafe extern "efiapi" fn wait_for_event will debug_assert:

https://github.com/OpenDevicePartnership/patina/blob/35b0b47159327cc77be40ca76a85c30f40f92947/patina_dxe_core/src/events.rs#L147-L163


In the normal debug build case, the assert is reasonable given UEFI Specification caller requirements and the release profile does pass SCT as expected. On the other hand, a debug (dev) build generally runs fine against every other SCT test (attempted so far), so this is an outlier for interrupting testing. Another point is that the SCT can be resumed on subsequent boots, so while annoying, cases like this could technically be automated/accommodated. Another possible line of thinking would be to treat SCT builds special in some way, but I'd prefer not to do that for many reasons, especially in the patina repo (build/code complexity, potential to use that "flavor" in non-SCT scenarios, etc.). In patina-dxe-core-qemu, perhaps an SCT profile or something like that would be less pervasive but still undesirable.

In any case, the issue is raised here for discussion and awareness.


Note: I am currently automating SCT execution on both dev and release profile builds. However, like I said earlier, even a decision to stay as-is, can be worked around.

Dominant language
Rust
Stars
568
Forks
63
Avg merge
1d 16h
Merged PRs (30d)
60

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenDevicePartnership/patina

All issues in OpenDevicePartnership/patina

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.