mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
SMBIOS specification dictates that tables should have a minimal length. This commit introduces further validation for user-input SMBIOS tables. As per SMBIOS Reference Specification: * Type 0: For version 2.3 and later implementations, the length is at least 14h * Type 1: 1Bh for 2.4 and later * Type 2: at least 08h * Type 3: 0Dh for version 2.1 and later * Type 11: 5h (+ strings) * Type 22: 1Ah (+ strings) * Type 39: a minimum of 10h Notably, this also fixes previously incorrect check for chassis handle in smbios_type_2_init. Chassis handle is a WORD, therefore, the condition now correctly checks for >= 13 instead of > 13. hvmloader currently implements version 2.4 Furthermore, this commit introduces smbios_pt_copy helper function to substitute previously repeating pattern of locating the struct in physical memory (via get_smbios_pt_struct), checking the length and copying it into SMBIOS region. Fixes:4d23036e70("HVM firmware passthrough SMBIOS processing") Signed-off-by: Petr Beneš <w1benny@gmail.com> Acked-by: Jan Beulich <jbeulich@suse.com> master commit:2f7d52f016master date: 2025-08-27 11:26:33 +0200