Page MenuHomeFreeBSD

libsa: smbios: Reject a 64-bit entry point with revision 0
AcceptedPublic

Authored by olce on Fri, Mar 7, 4:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 8, 7:43 AM
Unknown Object (File)
Sat, Mar 8, 4:27 AM
Unknown Object (File)
Sat, Mar 8, 1:21 AM
Subscribers

Details

Summary

According to the specification, such an entry point may have different
data in bytes at offsets 0x0c to 0x17 (included). In such a case,
interpreting them as the Structure Table Maximum Size and Address fields
could have catastrophic consequences.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62826
Build 59710: arc lint + arc unit

Event Timeline

olce requested review of this revision.Fri, Mar 7, 4:57 PM
This revision is now accepted and ready to land.Fri, Mar 7, 5:05 PM
stand/libsa/smbios.c
199

Where in the spec is this claimed? As far as I can see, a value of 0 is just "reserved for assignment". I guess it's probably harmless to check this, but the comment implies something more specific than my understanding.

stand/libsa/smbios.c
199

The spec hints at that (emphasis mine):

EPS revision implemented in this structure and *identifies the formatting
of offsets 0Bh and beyond* as follows:
00h
 Reserved for assignment by this specification
01h
 Entry Point is based on SMBIOS 3.0 definition.
02h-FFh Reserved for assignment by this specification;
*offsets 0Ch-17h are defined per revision 01h*

My understanding is: Bytes at offset 0x0b and beyond depend on the entry point revision, so nothing can be assumed a priori. Entry point revision 0x01 is the current specification, with the two fields Structure Table Maximum Size and Address, defined at offsets 0x0c and 0x10. Revisions 0x02h to 0xff are reserved, but it is explicitly said that, for these, bytes 0x0c to 0x17 are defined as for revision 0x01. The only revision for which nothing is said about these bytes is 0, hence the exclusion.

On the (admittedly very limited number of) machines I have featuring a SMBIOS v3 entry point, I always see value 1 as the revision in practice.

Perhaps the initial comment' formulation is a bit too strong. How about:

The specification only guarantees the presence of the Structure Table Maximum Size and Address Entry fields at offsets 0x0c and 0x10 if the Entry Point Revision is not 0.