Skip to content

Conversation

@kat-perez
Copy link
Contributor

@kat-perez kat-perez commented Nov 21, 2025

Description

Fixes SMBIOS protocol initialization to prevent allocation failures during SmbiosAdd() operations.

What changed

Fixed initialization order:

  • Allocate SMBIOS buffers before installing protocol (was failing when SmbiosAdd() called during install)
  • Publish initial table with Type 127 (End-Of-Table) marker immediately after protocol install
  • Subsequent SmbiosAdd() calls update buffer in-place

C protocol compatibility improvements:

  • GetNext now returns pointers into the published table (not internal buffer), ensuring RecordA != RecordB for different records
  • Added checksum-based table integrity verification to detect direct modifications
  • Returns TableDirectlyModified error if published table was modified directly instead of using protocol APIs
  • Error message guides users to use Remove() + Add() or UpdateString() instead

Safety improvements:

  • Scoped manager locks to prevent TplMutex re-entrant lock panic during republish
  • Use write_unaligned() for FFI pointer writes
  • Narrowed unsafe scopes in protocol layer

Code cleanup:

  • Use MemoryManager service for allocations
  • Replace hard-coded sizes with SIZE_(n)KB constants
  • Enhanced error handling and debug_asserts

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

How This Was Tested

  • Integrated with Tiano DXE Core to test C FFI protocol functions
  • Integrated with patched branch in patina-dxe-core-qemu to ensure it also works with Patina DXE Core
  • Verified direct modification detection with test in PatinaSmbiosDxe driver

Integration Instructions

N/A

@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch from ba1e589 to 6e19bd9 Compare November 21, 2025 17:12
@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 95.38462% with 27 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
components/patina_smbios/src/manager/core.rs 93.41% 24 Missing ⚠️
components/patina_smbios/src/manager/protocol.rs 76.92% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch 4 times, most recently from a8708d6 to 6444608 Compare November 21, 2025 17:58
@kat-perez kat-perez marked this pull request as ready for review November 21, 2025 18:09
@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch 4 times, most recently from 70b4345 to 9ecef5f Compare November 21, 2025 20:30
@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch 2 times, most recently from 323ee31 to e75121f Compare November 21, 2025 23:00
@kat-perez kat-perez added the type:bug Something isn't working label Nov 21, 2025
@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch from 43a84e3 to ee68f9c Compare November 22, 2025 00:49
@github-actions github-actions bot added the impact:testing Affects testing label Nov 24, 2025
@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch from be0a6a0 to 879ee55 Compare November 24, 2025 18:11
@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch 2 times, most recently from e545b1c to 558577f Compare November 24, 2025 19:15
@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch 3 times, most recently from 551842a to 3930784 Compare December 1, 2025 17:56
@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch 4 times, most recently from 4b3befb to e39d0cc Compare December 2, 2025 14:36
@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch 3 times, most recently from be52be0 to 2d5d6d8 Compare December 2, 2025 21:36
@kat-perez kat-perez self-assigned this Dec 4, 2025
@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch from 2d5d6d8 to e736599 Compare December 4, 2025 19:35
@kat-perez kat-perez changed the title SMBIOS: Fix protocol installation and cleanup implementation patina_smbios: Fix protocol installation and cleanup implementation Dec 4, 2025
Fixes SMBIOS protocol initialization to prevent allocation failures
during Add() operations

Publishes initial table with Type 127 (End-Of-Table) marker
@kat-perez kat-perez force-pushed the smbios-protocol-install-cleanup branch from e736599 to 0707660 Compare December 4, 2025 19:44
@kat-perez kat-perez merged commit 606583a into OpenDevicePartnership:main Dec 4, 2025
8 checks passed
@kat-perez kat-perez deleted the smbios-protocol-install-cleanup branch December 10, 2025 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:testing Affects testing type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants