Skip to content

Add initial ETW support to Rust SDK and HelloWorld sample - #188

Merged
Branden Bonaby (bbonaby) merged 6 commits into
mainfrom
add-tracelogging-to-sdk
Jan 26, 2026
Merged

Branden Bonaby (bbonaby) merged 6 commits into
mainfrom
add-tracelogging-to-sdk

Conversation

@bbonaby

@bbonaby Branden Bonaby (bbonaby) commented Jan 22, 2026 •

Copy link
Copy Markdown
Contributor

Why is this change needed?

The change Introduces end-to-end ETW (TraceLogging) support for VBS enclaves in our sdk.

What changed?

  • Added ETW support to the Rust SDK using the tracelogging crate.
  • Implemented enclave-side ETW forwarding logic and host-side ETW plumbing via new EDL definitions and generated bindings.
  • Introduced SDK helpers to register and unregister ETW providers and callbacks.
  • Updated the HelloWorld Rust sample to emit ETW events from inside the enclave.
  • etw.md describing enclave and host integration patterns and how developers can use the SDK + tracelogging crate to write events..
  • Extended codegen script to support EDL import directories.
  • Ensured all generated Rust ABI structs use #[repr(C)] for ABI correctness.
  • In the enclave.rs in the host sdk I realized we were using only the debug flag for enclave creation. I updated the create_and_initialize and create_and_initialize_with_threads api's to now accept a flag value so they can be created for production builds, where enclave debuggability is not acceptable.

How was this tested?

  • Built and ran the updated HelloWorld sample end-to-end, verifying enclave load, ETW provider registration, event emission, and clean teardown.
  • Validated that ETW callbacks are correctly forwarded from the host into the enclave.
  • Confirmed generated code compiles for both host and enclave targets with updated codegen scripts.
  • Confirmed userbound key sample still works after updates.

End-to-End dataflow

Enclave (VTL1)
  write_event!()
      ↓
SDK enclave ETW intercept
      ↓
ABI passthrough
      ↓
Host ETW bridge (EventWriteTransfer)
      ↓
Windows ETW 

Demo

Enclave-trace-logging-demo.mp4

@bbonaby

Copy link
Copy Markdown
Contributor Author

This conflicts with #187 so will let that one go in first and then first/update things with my branch after.

Comment thread rust/sdk/crates/etw.md Outdated
Comment thread rust/sdk/crates/etw.md
Comment thread rust/sdk/crates/samples/userboundkey/host/src/main.rs
Comment thread rust/sdk/crates/libs/sdk-host/src/enclave.rs
Comment thread rust/sdk/crates/libs/sdk-host/src/etw.rs
Comment thread rust/sdk/crates/libs/sdk-host/src/etw.rs Outdated
Comment thread rust/sdk/crates/libs/sdk-host/src/etw.rs Outdated
Comment thread rust/sdk/crates/libs/sdk-enclave/src/etw.rs
Comment thread rust/sdk/crates/libs/sdk-enclave/src/etw.rs

@SohamDas2021 Soham Das (SohamDas2021) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@bbonaby
Branden Bonaby (bbonaby) merged commit 76afff6 into main Jan 26, 2026
49 of 59 checks passed
@bbonaby
Branden Bonaby (bbonaby) deleted the add-tracelogging-to-sdk branch February 6, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants