Skip to content

patina-v14.3.1

Choose a tag to compare

@github-actions github-actions released this 05 Nov 21:11
· 550 commits to refs/heads/main since this release
6acc753

What's Changed

  • Update to patina-devops v0.2.2 @Javagedes (#1015)
    Change Details
      ## Description

    Updates the repository to patina-devops v0.2.2 which changes the release process as described in the release notes of patina-devops:

    ref:
    https://github.com/OpenDevicePartnership/patina-devops/releases/tag/v0.2.0

    • Impacts functionality?
    • Impacts security?
    • Breaking change?
    • Includes tests?
    • Includes documentation?
    • Creates a new crate?

    How This Was Tested

    N/A

    Integration Instructions

    N/A

      </blockquote>
      <hr>
    </details>
    
  • chore: Update repo version to 14.3.0 @[patina-automation[bot]](https://github.com/apps/patina-automation) (#1016)
    Change Details
      An automatically created pull request to update the version of the repo due to a release.

📖 Documentation Updates

  • StackTrace: AArch64: Rewrite unwind decoding implementation @vineelko (#965)
    Change Details
      ## Description

    The original implementation has some shortcomings in decoding unwind codes. It failed to account for scenarios requiring a frame pointer to dump(). This is particularly important when function prologs establish a new stack frame using instructions like add x29, sp, #16 or mov fp, sp and couple of other scenarios. This is now fixed(#700, #583).

    INFO -       # Child-SP              Return Address         Call Site
    INFO -       0 000001007E25D500      000001007E264964       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+23D34
    INFO -       1 000001007E25D510      000001007E338F40       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+6964
    INFO -       2 000001007E25D5E0      000001007E3394E0       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+DAF40
    INFO -       3 000001007E25D610      000001007E268564       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+DB4E0
    INFO -       4 000001007E25D650      000001007E2685DC       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+A564
    INFO -       5 000001007E25D6D0      000001007E2686B8       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+A5DC
    INFO -       6 000001007E25D750      000001007E268428       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+A6B8
    INFO -       7 000001007E25D7D0      000001007E28C394       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+A428
    INFO -       8 000001007E25D890      000001007E2792A8       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+2E394
    INFO -       9 000001007E25D910      000001007E274F48       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+1B2A8
    INFO -      10 000001007E25D9F0      000001007E275984       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+16F48
    INFO -      11 000001007E25DA90      000001007E26DBB0       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+17984
    INFO -      12 000001007E25DAD0      000001007E26E7F4       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+FBB0
    INFO -      13 000001007E25DBC0      000001007E264BA8       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+107F4
    INFO -      14 000001007E25DD90      000001007E2649F0       /home/vineel/repos/patina-dxe-core-qemu/target/aarch64-unknown-uefi/debug/deps/qemu_sbsa_dxe_core-a19eb59416280d66+6BA8
    
     # Source Path                                                                                                                 Child-SP         Return Address   Call Site
     0 [/home/vineel/repos/patina/core/patina_stacktrace/src/stacktrace.rs @  117]                                                 000001007E25D500 000001007E264964 qemu_sbsa_dxe_core-a19eb59416280d66!union enum2$<core::result::Result<tuple$<>,enum2$<patina_stacktrace::error::Error> > > patina_stacktrace::stacktrace::StackTrace::dump()+8
     1 [/home/vineel/repos/patina-dxe-core-qemu/bin/sbsa_dxe_core.rs @   24]                                                       000001007E25D510 000001007E338F40 qemu_sbsa_dxe_core-a19eb59416280d66!void qemu_sbsa_dxe_core::panic(struct core::panic::panic_info::PanicInfo *)+8C
     2 [/home/vineel/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panicking.rs @   90] 000001007E25D5E0 000001007E3394E0 qemu_sbsa_dxe_core-a19eb59416280d66!void core::panicking::panic_nounwind_fmt(struct core::fmt::Arguments, bool, struct core::panic::location::Location *)+0
     3 [/home/vineel/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panicking.rs @  168] 000001007E25D610 000001007E268564 qemu_sbsa_dxe_core-a19eb59416280d66!void core::panicking::panic_const::panic_const_rem_by_zero(struct core::panic::location::Location *)+0
     4 [/home/vineel/repos/patina/components/patina_samples/src/component/hello_world.rs @   58]                                   000001007E25D650 000001007E2685DC qemu_sbsa_dxe_core-a19eb59416280d66!static void patina_samples::component::hello_world::func2()+0
     5 [/home/vineel/repos/patina/components/patina_samples/src/component/hello_world.rs @   61]                                   000001007E25D6D0 000001007E2686B8 qemu_sbsa_dxe_core-a19eb59416280d66!static void patina_samples::component::hello_world::func2()+78
     6 [/home/vineel/repos/patina/components/patina_samples/src/component/hello_world.rs @   68]                                   000001007E25D750 000001007E268428 qemu_sbsa_dxe_core-a19eb59416280d66!void patina_samples::component::hello_world::func1()+78
     7 [/home/vineel/repos/patina/components/patina_samples/src/component/hello_world.rs @   25]                                   000001007E25D7D0 000001007E28C394 qemu_sbsa_dxe_core-a19eb59416280d66!union enum2$<core::result::Result<tuple$<>,enum2$<patina::error::EfiError> > > patina_samples::component::hello_world::HelloStruct::entry_point(struct patina_samples::component::hello_world::HelloStruct, struct patina::component::params::Config<i32>)+B0
     8 [/home/vineel/repos/patina/sdk/patina/src/component/struct_component.rs @   94]                                             000001007E25D890 000001007E2792A8 qemu_sbsa_dxe_core-a19eb59416280d66!union enum2$<core::result::Result<bool,enum2$<patina::error::EfiError> > > patina::component::struct_component::impl$1::run_unsafe<tuple$<patina::component::params::RunOnce,enum2$<core::result::Result<tuple$<>,enum2$<patina::error::EfiError> > > (*)(patina_samples::component::hello_world::HelloStruct,patina::component::params::Config<i32>)>,patina_samples::component::hello_world::HelloStruct,enum2$<core::result::Result<tuple$<>,enum2$<patina::error::EfiError> > > (*)(patina_samples::component::hello_world::HelloStruct,patina::component::params::Config<i32>)>(struct patina::component::struct_component::StructComponent<tuple$<patina::component::params::RunOnce,enum2$<core::result::Result<tuple$<>,enum2$<patina::error::EfiError> > > (*)(patina_samples::component::hello_world::HelloStruct,patina::component::params::Config<i32>)>,enum2$<core::result::Result<tuple$<>,enum2$<patina::error::EfiError> > > (*)(patina_samples::component::hello_world::HelloStruct,patina::component::params::Config<i32>)> *, struct patina::component::storage::UnsafeStorageCell)+60
     9 [/home/vineel/repos/patina/patina_dxe_core/src/lib.rs         @  371]                                                       000001007E25D910 000001007E274F48 qemu_sbsa_dxe_core-a19eb59416280d66!bool patina_dxe_core::impl$4::dispatch_components::closure$0(struct patina_dxe_core::impl$4::dispatch_components::closure_env$0 *, struct alloc::boxed::Box<dyn$<patina::component::Component>,alloc::alloc::Global> *)+BC
    10 [/home/vineel/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs @ 2243]  000001007E25D9F0 000001007E275984 qemu_sbsa_dxe_core-a19eb59416280d66!void alloc::vec::impl$1::retain_mut::process_loop<patina_dxe_core::impl$4::dispatch_components::closure_env$0,alloc::boxed::Box<dyn$<patina::component::Component>,alloc::alloc::Global>,alloc::alloc::Global,true>(unsigned __int64, struct patina_dxe_core::impl$4::dispatch_components::closure_env$0 *, struct alloc::vec::impl$1::retain_mut::BackshiftOnDrop<alloc::boxed::Box<dyn$<patina::component::Component>,alloc::alloc::Global>,alloc::alloc::Global> *)+70
    11 [/home/vineel/.rustup/toolchains/1.89.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs @ 2275]  000001007E25DA90 000001007E26DBB0 qemu_sbsa_dxe_core-a19eb59416280d66!void alloc::vec::Vec<alloc::boxed::Box<dyn$<patina::component::Component>,alloc::alloc::Global>,alloc::alloc::Global>::retain_mut<alloc::boxed::Box<dyn$<patina::component::Component>,alloc::alloc::Global>,alloc::alloc::Global,patina_dxe_core::impl$4::dispatch_components::closure_env$0>(struct patina_dxe_core::impl$4::dispatch_components::closure_env$0)+48
    12 [/home/vineel/repos/patina/patina_dxe_core/src/lib.rs         @  398]                                                       000001007E25DAD0 000001007E26E7F4 qemu_sbsa_dxe_core-a19eb59416280d66!static union enum2$<core::result::Result<tuple$<>,enum2$<patina::error::EfiError> > > patina_dxe_core::Core<patina_dxe_core::Alloc>::core_dispatcher()+A0
    13 [/home/vineel/repos/patina/patina_dxe_core/src/lib.rs         @  555]                                                       000001007E25DBC0 000001007E264BA8 qemu_sbsa_dxe_core-a19eb59416280d66!union enum2$<core::result::Result<tuple$<>,enum2$<patina::error::EfiError> > > patina_dxe_core::Core<patina_dxe_core::Alloc>::start(struct patina_dxe_core::Core<patina_dxe_core::Alloc>)+AF8
    14 [/home/vineel/repos/patina-dxe-core-qemu/bin/sbsa_dxe_core.rs @   74]                                                       000001007E25DD90 000001007E2649F0 qemu_sbsa_dxe_core-a19eb59416280d66!void qemu_sbsa_dxe_core::_start(core::ffi::c_void *)+1B8
    

    Other alternatives considered: Before reimplementing unwind codes, frame pointer chaining was strongly considered and validated.

    Frame pointer chaining on AArch64: call stack tracing can be implemented without decoding unwind codes, by simply following the frame pointer chain as a linked list. This is mandated by the ARM64 ABI

    In other words, no .pdata or .xdata sections are required. Contributing to reduction in binary size.

    In our tests, the only reliable way to generate a valid frame pointer chain is by also including -C force-unwind-tables along with -C force-frame-pointers=yes, which defeats the purpose of using frame pointer chaining. Without it, Rust generates
    non-standard frame pointer chains, breaking the test implementation.

    // -C force-frame-pointers=yes      | // -C force-frame-pointers=yes
    // -C force-unwind-tables           |
    example::dump::hcc2f0dfbfd9a8b3c:   | example::dump::hcc2f0dfbfd9a8b3c:
            sub     sp, sp, #32         |         sub     sp, sp, #32
            stp     x29, x30, [sp, #16] |         stp     x30, x29, [sp, #16] # non-standard fp/lr save pair
            add     x29, sp, #16        |         add     x29, sp, #16

    Frame pointer chaining on X64: The Windows x64 calling convention does not guarantee RBP chaining. Even with -C force-frame-pointers=yes and -C force-unwind-tables, RBP may not point to the previous RBP location, unlike AArch64, where FP always points to the saved FP and LR location.

    qemu_q35_dxe_core_6193246bcaceb9a2!patina_stacktrace::stacktrace::StackTrace::dump:
       00000100`0002378f  push  rbp
       00000100`00023790  push  rsi
       00000100`00023791  sub   rsp,28h
       00000100`00023795  lea   rbp,[rsp+20h]  # rbp do not point to saved rdp location!
       00000100`0002379a  mov   rsi,rcx
       00000100`0002379d  lea   rdx,[<addr>+0x15]
       00000100`000237a4  mov   r8,rbp
       00000100`000237a7  call  <dump_with>
       00000100`000237ac  mov   rax,rsi
       00000100`000237af  add   rsp,28h
       00000100`000237b3  pop   rsi
       00000100`000237b4  pop   rbp
       00000100`000237b5  ret

    Although frame pointer chaining is simpler to implement, it has been discarded due to the inconsistencies and compiler differences mentioned above. Additionally, .pdata/.xdata sections are still required in the binary for the debugger to reliably generate call stacks.

    • Impacts functionality?
    • Impacts security?
    • Breaking change?
    • Includes tests?
    • Includes documentation?

    How This Was Tested

    The core decoding logic was validated by creating a sample test std app that triggers a panic with abort semantics. During the panic, the Rust panic handler invoked this stack trace logic, and the resulting call stack was simultaneously verified using WinDbg.

    Below QEMU combinations and few other hardware platforms have been validated.

    Rust Compiler Windows WSL
    Q35 MSVC LLVM
    SBSA NA LLVM

    Integration Instructions

    Follow the standard Patina release process and use it in downstream repositories, such as patina-dxe-core-qemu. All consumers of the StackTrace::dump() API won’t require any changes. However, callers that explicitly use StackTrace::dump_with() will need to provide the StackFrame structure as an argument on AArch64.




Full Changelog: patina-v14.3.0...v14.3.1