From nobody Thu Oct 30 18:55:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1755988045; cv=none; d=zohomail.com; s=zohoarc; b=duB37mBlhUfZRR9H6RGVgky3s3RT0VOC1NecVcvehxZR/FVChApnT5kpr3zizjxSc5C8o14V9Z2vv4jgS+E/Nb1vh5s5fvNyeUmxspJ7lUjAoZm4ipbfNNhPynnkhUfBhIiaaiVrZCcO5sQDNcQ1ukBq+scvBKhAJJ+aVKvpPHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1755988045; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hxbSUIBsw0EVkmhIu0DrRsRTOlPMr0YznFiwwKR8I0U=; b=cV4hvABUK8kz58Q4PUWkacNV1Q9nvSOqsjo0CfxxvuHXNQSgehsCt/9xH5ES6MRmZuK1c112QCx2ysr5/y9R04w2cLbyP87dW37a1g5pEyG5LXihLR78SYyrgiTdd+0YqPkGXJQOsQRDZn54vaQkjfhBYl/2/5VrPA+col1KybI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1755988045451427.4637707504768; Sat, 23 Aug 2025 15:27:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1091560.1448080 (Exim 4.92) (envelope-from ) id 1upwhQ-0001QG-1k; Sat, 23 Aug 2025 22:27:00 +0000 Received: by outflank-mailman (output) from mailman id 1091560.1448080; Sat, 23 Aug 2025 22:27:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1upwhP-0001PK-Ri; Sat, 23 Aug 2025 22:26:59 +0000 Received: by outflank-mailman (input) for mailman id 1091560; Sat, 23 Aug 2025 22:26:58 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1upwhO-0001Mm-R9 for xen-devel@lists.xenproject.org; Sat, 23 Aug 2025 22:26:58 +0000 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [2a00:1450:4864:20::52d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 47d4fabd-8070-11f0-a32b-13f23c93f187; Sun, 24 Aug 2025 00:26:58 +0200 (CEST) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-6188b72d690so450913a12.2 for ; Sat, 23 Aug 2025 15:26:58 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-afe48fd37fbsm252045166b.47.2025.08.23.15.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Aug 2025 15:26:56 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 47d4fabd-8070-11f0-a32b-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755988017; x=1756592817; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hxbSUIBsw0EVkmhIu0DrRsRTOlPMr0YznFiwwKR8I0U=; b=Sr7Ud6jS6eRSf0GZDtOwnKjqsPOJCNk45Eub2ilnAjRR2u2p3mU2W1cMQSIoUXVHlO tX4RNhNZ6uMYdvEzDyjUfPO7P5oSmcfSin4WuvvINJSQda/EKKXJNo8cG2CG0X77T8BL nMj4yfJtAQkJxg+EFogCwMFmYK8oE2TjgVPoLJYtNdK5VtCXNxoDH9rcGpMPmL3aE4+A vl8p/r9A2bjTEveeiCNrk4OOqtiZ0ffp4P1kpaSjqxPSelNksR0POTYnmLU118Rj7oPU viXqlyihiQj7BLixjle35J+EdMjGoucyxwapWRu9euJksDV8cj/gwr5FVUpu7dkCTAEg MeCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755988017; x=1756592817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hxbSUIBsw0EVkmhIu0DrRsRTOlPMr0YznFiwwKR8I0U=; b=dqBM2JYk60PBOATgethxl1vTOLd+HiRThSH78o5dwXVyKRJDUCodWqUpfqS280zLKF xEoJP24+qFpxaIRLmX8TMijAYK0kIMAcvcgFrxKuAuwBFRgrB7WFgxx6B1fy+H7079rv 7dlvwWtTWPVb+NsDAEIQ1wcDtNDGOebzM/qKnGFGpfGNvM6puCqU5qku18UdZbNzo9oI 39zMevDOK+czNoFTrj+gBeG1SS9NbkgwRqGwaJ8xjjz/tnGVyhcq37RDhtXTI5nMo63+ 0wj/Nd7IwPodZwfWYH7csxZ1q5+g5hLhlxrzc0JDuUjr+HO3Q7nSxPIHO33T7O2LN4LX tzUA== X-Gm-Message-State: AOJu0Yyp123CJKcmiSOrxGgMVfkU50bNwrD82ToYRFh89dk2+WyOWHd8 vDEg2+kbeWYNFRyOaWYCRhnujd6AOLZ18D6NMmxCLsjcvXnEumSEySXRy+6LcQ== X-Gm-Gg: ASbGncsghcISAjGTmwj5lgne+JMLrHWsOZZaUvhvM7NqFaVNZx2ZCKqI7IDeDwhIiyh 6qRl1cRkQLzXKpUUnKNXd8NbOwZG1cFjLzHaYwSBIt7CvKEFT4Jz+A4A4p7cq6brPtVwwVgqBh3 Rngr4W/eNb3Pb37jQHo0XBqb5MqKpqO1xnjS87ECJf1otDAkRqsARIl/8nR8BY4iSQ21kLN/lsa 0TW/pSHZiGTPJD9AzuG5W9L9Bbnt9X2N18aGcsH+FNypo6CFJRSi0XN8zoZmR14gFBDdJTZKlob HZveEJOe2g06yg8QS8z848Pi7GZu/CVUMqGe3rNHnMeR+T72VmUhOcTdk0WYx8veVEE3XPT2uZ7 y0vUI4hnp4wqIQyIPqdkPa8ctcDGy1yX7BxInWRBNCdiLZYslKHhPYMRb5py+GDRf8R7amiSNZ6 +lCNdq70ARPWkJSxMG3vPfhA== X-Google-Smtp-Source: AGHT+IGiF52LgoFc0dxwElU/Bxjwb+i8FifOsoea3FMdnNUewjH/+n9bU2JS++tq+h0gcEicTZJ7Cg== X-Received: by 2002:a17:906:4794:b0:af8:fd22:6e28 with SMTP id a640c23a62f3a-afe2903168dmr384184466b.7.1755988016979; Sat, 23 Aug 2025 15:26:56 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Anthony PERARD Subject: [PATCH v5 1/4] tools: add sizeof_field and endof_field macros Date: Sat, 23 Aug 2025 22:26:49 +0000 Message-Id: <8dd6b217fbde427407113fedabb70f54d12aed61.1755987697.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1755988048472124100 From: Petr Bene=C5=A1 * `sizeof_field` returns the size of a specific struct member * `endof_field` returns the offset to the end of the member within the stru= ct It will be useful in upcoming layout checks of SMBIOS structs. Signed-off-by: Petr Bene=C5=A1 Acked-by: Anthony PERARD --- tools/include/xen-tools/common-macros.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/include/xen-tools/common-macros.h b/tools/include/xen-to= ols/common-macros.h index 0088208c2e..9838a108aa 100644 --- a/tools/include/xen-tools/common-macros.h +++ b/tools/include/xen-tools/common-macros.h @@ -83,6 +83,11 @@ #define __packed __attribute__((__packed__)) #endif =20 +#define sizeof_field(type, member) sizeof(((type *)NULL)->member) + +#define endof_field(type, member) \ + (offsetof(type, member) + sizeof_field(type, member)) + #define container_of(ptr, type, member) ({ \ typeof(((type *)0)->member) *mptr__ =3D (ptr); \ (type *)((char *)mptr__ - offsetof(type, member)); \ --=20 2.34.1 From nobody Thu Oct 30 18:55:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1755988039; cv=none; d=zohomail.com; s=zohoarc; b=LxkOQDz9H4qEffZ5o3bkpuxBtFwbkA4PG7oTvDF1ob9LXKFfiv6zHUzhCPQVJTL3KGBxON8rT+he+EgBPV2HLJ1GU++ngzcI8wpqoSlC1ogT6XPS2kLIHMTcog/ArOSsb+ObtUsC/kNoGSUnxmgCWWKm3dCjzmlNmPxaQ9sLTwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1755988039; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=r1lhEkTlVqxto/yaeiFL6OuJ5JEHWn2qkZQk+y0ltKI=; b=KhWwsOPfUAYys+PO2Aj2WjcTiuBHKeeiXzcyfxRfpj+Li+DcW5YPjnT7pPnNWD6Jmku3rC9Nl+FZsV1ANj+hg4SKkXX7FrDicFrduSNcREsb/gEyp5Hq25xx9LpDD5Epq5501mp3xO1hh4Z6Bs2ij3zsof9Otd2bA+UiuyIIVVY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1755988039717339.7100153106071; Sat, 23 Aug 2025 15:27:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1091561.1448093 (Exim 4.92) (envelope-from ) id 1upwhR-0001oP-C9; Sat, 23 Aug 2025 22:27:01 +0000 Received: by outflank-mailman (output) from mailman id 1091561.1448093; Sat, 23 Aug 2025 22:27:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1upwhR-0001oI-8H; Sat, 23 Aug 2025 22:27:01 +0000 Received: by outflank-mailman (input) for mailman id 1091561; Sat, 23 Aug 2025 22:27:00 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1upwhP-0001Mm-RR for xen-devel@lists.xenproject.org; Sat, 23 Aug 2025 22:26:59 +0000 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [2a00:1450:4864:20::62c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 487543ec-8070-11f0-a32b-13f23c93f187; Sun, 24 Aug 2025 00:26:59 +0200 (CEST) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-afe72d68b88so27266b.3 for ; Sat, 23 Aug 2025 15:26:59 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-afe48fd37fbsm252045166b.47.2025.08.23.15.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Aug 2025 15:26:57 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 487543ec-8070-11f0-a32b-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755988018; x=1756592818; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r1lhEkTlVqxto/yaeiFL6OuJ5JEHWn2qkZQk+y0ltKI=; b=MBRUxl1I1MRp4dPu/QIm03q5bmD8be2p0IxzJjLZK0dF4mh1VjJkUvI2RIxAXo7mav Ob2kaSCxVfWDxXFYzysktlgenX7QFG1SljaW4n4ngV4R4K93x5eVllKQlJUT41PRdBYy /lo8usI+5VDk6ScqzyQeUS1ABghKc0wZcgEWLZRziBLX8NzrISmNm67X4bW3dApJj4bd HJVrkQ0Oa2gawuPnPg3h/wXPBFcQFB+XBjK/jUBgdn2IYm13RXAT6NULY+uo/eTpT+kk f/VV+Ds2c0ENyAYrtS+6wSx/9fpNLuzYZ1DmqsxwwWdvdYkMseLGBgggyf23YIgp9AUT gmeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755988018; x=1756592818; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r1lhEkTlVqxto/yaeiFL6OuJ5JEHWn2qkZQk+y0ltKI=; b=lzBmk29X456GPl9kA/L8fGKGQwKfYS4pjD/JmUStnYWyMVqa73WO0hK49EfsrdKyMl eai+2PmvW/tyhygzbPk4ljZb4XGq4Bsg3QngiskBCG8amOI12NgbJ2BD8iz1eKjLUoCk jeltHLzW6xt93nm294X82BVp8PHlb8yOmi9/4202V/P9Gjdl6PPoegUn5A4ns8akEBfN nzWhqn7PxmEp0/08E7uI+k60YI9xVCJFTHuYaBp7Eh++vN0QMHoyHlX8sC0jUneiE31u 5BG5mlqJyss4bnXjhpWZyzThiqK9QJgrML2Me7MQwWXyl9K4894Wi1Xkqk66VPHzOpJU fT+w== X-Gm-Message-State: AOJu0YyT5g5pFWAdEGW9kNfP/TDMLNBr8dBssv/2SxQObck6JtTLB9VU t79p1snE815L89pHZbnhnj4JRnouIneSHJpUba+m5fmspGJJx708hGyliOpzpQ== X-Gm-Gg: ASbGncsGwulia+arNPRBvMIeDmrqUpcpR2S1mS9DJTVBX7tNvdE5B4C7Fht81CYebPi ngGjjspRzfmN1l39ZzA2SgF4Uq1rKaRoIhGn3xT4eCArHKF0EztbSTSbbkJ/qep+jeOTNCr3QRf ybeJ7RA0p5BfZiRXamYo8bolpTTMsCsxjl6Nab3GxClezLxpdkPcW9JNPV7k1qAWIwQX3VMdXSH Xu5XA6zF0zigX+sOeU68KJuMFUNQj5f4zPWATm1y0JVpqZHxZUOB/M8GDh9xUkA+HfM28oF1TKV PiIHjVlRQZ9pSoUoFUmAyEBMcZR+BuyDraSMIWdZYYc/TDEySoX/53PVbbfWgPNW2N+IXtUFdPJ zoJ4kaPKMtgxPib2o6fE26EO1oJQUpg1e9iae7TgrrfVdwyMk+OqmY8upXHVFg0aWMclUGltn6L A/jg7msgwCZIj4eQWNnfFgCEcJ3gR2Vv9D X-Google-Smtp-Source: AGHT+IFtprpwCtSr1ovoEKFv+twEsizD65Cfe20l2rSDjhgySffZKWxK9zvF4nJog5uPA3IngZJE8A== X-Received: by 2002:a17:907:6d19:b0:ae0:cff8:5717 with SMTP id a640c23a62f3a-afe28f275d5mr381817766b.4.1755988018037; Sat, 23 Aug 2025 15:26:58 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD Subject: [PATCH v5 2/4] hvmloader: fix SMBIOS table length checks Date: Sat, 23 Aug 2025 22:26:50 +0000 Message-Id: <58f42aaaf460c33d9d0935d670aab9f54eb184b8.1755987697.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1755988042878124100 From: Petr Bene=C5=A1 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 >=3D 13 instead of > 13. hvmloader currently implements version 2.4 Furthermore, this commit introduces smbios_pt_copy helper function to subst= itute previously repeating pattern of locating the struct in physical memory (via get_smbios_pt_struct), checking the length and copying it into SMBIOS regio= n. Signed-off-by: Petr Bene=C5=A1 Acked-by: Jan Beulich --- tools/firmware/hvmloader/smbios.c | 178 ++++++++++++++---------- tools/firmware/hvmloader/smbios_types.h | 32 ++--- 2 files changed, 123 insertions(+), 87 deletions(-) diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/s= mbios.c index 6bcdcc233a..de3ba78e87 100644 --- a/tools/firmware/hvmloader/smbios.c +++ b/tools/firmware/hvmloader/smbios.c @@ -47,6 +47,8 @@ static void smbios_pt_init(void); static void* get_smbios_pt_struct(uint8_t type, uint32_t *length_out); +static void * +smbios_pt_copy(void *start, uint8_t type, uint16_t handle, size_t table_si= ze); static void get_cpu_manufacturer(char *buf, int len); static int @@ -154,6 +156,24 @@ get_smbios_pt_struct(uint8_t type, uint32_t *length_ou= t) return NULL; } =20 +static void * +smbios_pt_copy(void *start, uint8_t type, uint16_t handle, size_t min_size) +{ + struct smbios_structure_header *header =3D start; + void *pts; + uint32_t length; + + pts =3D get_smbios_pt_struct(type, &length); + if ( pts !=3D NULL && length >=3D min_size ) + { + memcpy(start, pts, length); + header->handle =3D handle; + return start + length; + } + + return start; +} + static void get_cpu_manufacturer(char *buf, int len) { @@ -381,16 +401,17 @@ smbios_type_0_init(void *start, const char *xen_versi= on, struct smbios_type_0 *p =3D start; static const char *smbios_release_date =3D __SMBIOS_DATE__; const char *s; - void *pts; - uint32_t length; + void *next; =20 - pts =3D get_smbios_pt_struct(0, &length); - if ( pts !=3D NULL && length > 0 ) - { - memcpy(start, pts, length); - p->header.handle =3D SMBIOS_HANDLE_TYPE0; - return start + length; - } + /* + * Specification says Type 0 table has length of at least 18h for v2.4= -3.0. + */ + + BUILD_BUG_ON(sizeof(*p) !=3D 24); + + next =3D smbios_pt_copy(start, 0, SMBIOS_HANDLE_TYPE0, sizeof(*p)); + if ( next !=3D start ) + return next; =20 memset(p, 0, sizeof(*p)); =20 @@ -440,16 +461,14 @@ smbios_type_1_init(void *start, const char *xen_versi= on, char uuid_str[37]; struct smbios_type_1 *p =3D start; const char *s; - void *pts; - uint32_t length; + void *next; =20 - pts =3D get_smbios_pt_struct(1, &length); - if ( pts !=3D NULL && length > 0 ) - { - memcpy(start, pts, length); - p->header.handle =3D SMBIOS_HANDLE_TYPE1; - return start + length; - } + /* Specification says Type 1 table has length of 1Bh for v2.4 and late= r. */ + BUILD_BUG_ON(sizeof(*p) !=3D 27); + + next =3D smbios_pt_copy(start, 1, SMBIOS_HANDLE_TYPE1, sizeof(*p)); + if ( next !=3D start ) + return next; =20 memset(p, 0, sizeof(*p)); =20 @@ -498,26 +517,29 @@ smbios_type_2_init(void *start) { struct smbios_type_2 *p =3D start; const char *s; - uint8_t *ptr; - void *pts; - uint32_t length; + void *next; unsigned int counter =3D 0; =20 - pts =3D get_smbios_pt_struct(2, &length); - if ( pts !=3D NULL && length > 0 ) - { - memcpy(start, pts, length); - p->header.handle =3D SMBIOS_HANDLE_TYPE2; + /* + * Specification says Type 2 table has length of at least 08h, + * which corresponds with the end of the "Serial Number" field. + */ + + BUILD_BUG_ON(endof_field(struct smbios_type_2, serial_number_str) !=3D= 8); =20 + next =3D smbios_pt_copy(start, 2, SMBIOS_HANDLE_TYPE2, + endof_field(struct smbios_type_2, serial_number_= str)); + if ( next !=3D start ) + { /* Set current chassis handle if present */ - if ( p->header.length > 13 ) + if ( p->header.length >=3D endof_field(struct smbios_type_2, + chassis_handle) ) { - ptr =3D ((uint8_t*)start) + 11; =20 - if ( *((uint16_t*)ptr) !=3D 0 ) - *((uint16_t*)ptr) =3D SMBIOS_HANDLE_TYPE3; + if ( p->chassis_handle !=3D 0 ) + p->chassis_handle =3D SMBIOS_HANDLE_TYPE3; } =20 - return start + length; + return next; } =20 memset(p, 0, sizeof(*p)); @@ -593,18 +615,21 @@ smbios_type_3_init(void *start) { struct smbios_type_3 *p =3D start; const char *s; - void *pts; - uint32_t length; + void *next; uint32_t counter =3D 0; =20 - pts =3D get_smbios_pt_struct(3, &length); - if ( pts !=3D NULL && length > 0 ) - { - memcpy(start, pts, length); - p->header.handle =3D SMBIOS_HANDLE_TYPE3; - return start + length; - } - =20 + /* + * Specification says Type 3 table has length of at least 0Dh (for v2.= 1+), + * which corresponds with the end of the "Security Status" field. + */ + + BUILD_BUG_ON(endof_field(struct smbios_type_3, security_status) !=3D 1= 3); + + next =3D smbios_pt_copy(start, 3, SMBIOS_HANDLE_TYPE3, + offsetof(struct smbios_type_3, security_status)); + if ( next !=3D start ) + return next; + memset(p, 0, sizeof(*p)); =20 p->header.type =3D 3; @@ -656,6 +681,9 @@ smbios_type_4_init( struct smbios_type_4 *p =3D start; uint32_t eax, ebx, ecx, edx; =20 + /* Specification says Type 4 table has length of 23h for v2.3+. */ + BUILD_BUG_ON(sizeof(*p) !=3D 35); + memset(p, 0, sizeof(*p)); =20 p->header.type =3D 4; @@ -707,17 +735,15 @@ smbios_type_11_init(void *start) struct smbios_type_11 *p =3D start; char path[20]; const char *s; + void *next; int i; - void *pts; - uint32_t length; =20 - pts =3D get_smbios_pt_struct(11, &length); - if ( pts !=3D NULL && length > 0 ) - { - memcpy(start, pts, length); - p->header.handle =3D SMBIOS_HANDLE_TYPE11; - return start + length; - } + /* Specification says Type 11 table has length of 05h. */ + BUILD_BUG_ON(sizeof(*p) !=3D 5); + =20 + next =3D smbios_pt_copy(start, 11, SMBIOS_HANDLE_TYPE11, sizeof(*p)); + if ( next !=3D start ) + return next; =20 p->header.type =3D 11; p->header.length =3D sizeof(*p); @@ -756,6 +782,9 @@ smbios_type_16_init(void *start, uint32_t memsize, int = nr_mem_devs) { struct smbios_type_16 *p =3D start; =20 + /* Specification says Type 16 table has length of 0Fh for v2.1-2.7. */ + BUILD_BUG_ON(sizeof(*p) !=3D 15); + memset(p, 0, sizeof(*p)); =20 p->header.type =3D 16; @@ -781,6 +810,9 @@ smbios_type_17_init(void *start, uint32_t memory_size_m= b, int instance) char buf[16]; struct smbios_type_17 *p =3D start; =20 + /* Specification says Type 17 table has length of 1Bh for v2.3-2.6. */ + BUILD_BUG_ON(sizeof(*p) !=3D 27); + memset(p, 0, sizeof(*p)); =20 p->header.type =3D 17; @@ -816,6 +848,9 @@ smbios_type_19_init(void *start, uint32_t memory_size_m= b, int instance) { struct smbios_type_19 *p =3D start; =20 + /* Specification says Type 19 table has length of 0Fh for v2.1-2.7. */ + BUILD_BUG_ON(sizeof(*p) !=3D 15); + memset(p, 0, sizeof(*p)); =20 p->header.type =3D 19; @@ -838,6 +873,9 @@ smbios_type_20_init(void *start, uint32_t memory_size_m= b, int instance) { struct smbios_type_20 *p =3D start; =20 + /* Specification says Type 20 table has length of 13h for v2.1-2.7. */ + BUILD_BUG_ON(sizeof(*p) !=3D 19); + memset(p, 0, sizeof(*p)); =20 p->header.type =3D 20; @@ -865,16 +903,14 @@ smbios_type_22_init(void *start) struct smbios_type_22 *p =3D start; static const char *smbios_release_date =3D __SMBIOS_DATE__; const char *s; - void *pts; - uint32_t length; + void *next; =20 - pts =3D get_smbios_pt_struct(22, &length); - if ( pts !=3D NULL && length > 0 ) - { - memcpy(start, pts, length); - p->header.handle =3D SMBIOS_HANDLE_TYPE22; - return start + length; - } + /* Specification says Type 22 table has length of 1Ah. */ + BUILD_BUG_ON(sizeof(*p) !=3D 26); + + next =3D smbios_pt_copy(start, 22, SMBIOS_HANDLE_TYPE22, sizeof(*p)); + if ( next !=3D start ) + return next; =20 s =3D xenstore_read(HVM_XS_SMBIOS_DEFAULT_BATTERY, "0"); if ( strncmp(s, "1", 1) !=3D 0 ) @@ -929,6 +965,9 @@ smbios_type_32_init(void *start) { struct smbios_type_32 *p =3D start; =20 + /* Specification says Type 32 table has length of at least 0Bh. */ + BUILD_BUG_ON(sizeof(*p) !=3D 11); + memset(p, 0, sizeof(*p)); =20 p->header.type =3D 32; @@ -946,20 +985,17 @@ smbios_type_32_init(void *start) static void * smbios_type_39_init(void *start) { - struct smbios_type_39 *p =3D start; - void *pts; - uint32_t length; + /* + * Specification says Type 39 table has length of at least 10h, + * which corresponds with the end of the "Characteristics" field. + * + * Only present when passed in. + */ =20 - pts =3D get_smbios_pt_struct(39, &length); - if ( pts !=3D NULL && length > 0 ) - { - memcpy(start, pts, length); - p->header.handle =3D SMBIOS_HANDLE_TYPE39; - return start + length; - } + BUILD_BUG_ON(endof_field(struct smbios_type_39, characteristics) !=3D = 16); =20 - /* Only present when passed in */ - return start; + return smbios_pt_copy(start, 39, SMBIOS_HANDLE_TYPE39, + endof_field(struct smbios_type_39, characteristi= cs)); } =20 static void * diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmlo= ader/smbios_types.h index 7c648ece71..a04d194975 100644 --- a/tools/firmware/hvmloader/smbios_types.h +++ b/tools/firmware/hvmloader/smbios_types.h @@ -90,13 +90,13 @@ struct smbios_type_2 { uint8_t product_name_str; uint8_t version_str; uint8_t serial_number_str; - uint8_t asset_tag_str; - uint8_t feature_flags; - uint8_t location_in_chassis_str; - uint16_t chassis_handle; - uint8_t board_type; - uint8_t contained_handle_count; - uint16_t contained_handles[]; + uint8_t asset_tag_str; /* Optional */ + uint8_t feature_flags; /* Optional */ + uint8_t location_in_chassis_str; /* Optional */ + uint16_t chassis_handle; /* Optional */ + uint8_t board_type; /* Optional */ + uint8_t contained_handle_count; /* Optional */ + uint16_t contained_handles[]; /* Optional */ } __attribute__ ((packed)); =20 /* System Enclosure - Contained Elements */ @@ -118,12 +118,12 @@ struct smbios_type_3 { uint8_t power_supply_state; uint8_t thermal_state; uint8_t security_status; - uint32_t oem_specific; - uint8_t height; - uint8_t number_of_power_cords; - uint8_t contained_element_count; - uint8_t contained_element_length; - struct smbios_contained_element contained_elements[]; + uint32_t oem_specific; /* Optional */ + uint8_t height; /* Optional */ + uint8_t number_of_power_cords; /* Optional */ + uint8_t contained_element_count; /* Optional */ + uint8_t contained_element_length; /* Optional */ + struct smbios_contained_element contained_elements[]; /* Optional */ } __attribute__ ((packed)); =20 /* SMBIOS type 4 - Processor Information */ @@ -252,9 +252,9 @@ struct smbios_type_39 { uint8_t revision_level_str; uint16_t max_capacity; uint16_t characteristics; - uint16_t input_voltage_probe_handle; - uint16_t cooling_device_handle; - uint16_t input_current_probe_handle; + uint16_t input_voltage_probe_handle; /* Optional */ + uint16_t cooling_device_handle; /* Optional */ + uint16_t input_current_probe_handle; /* Optional */ } __attribute__ ((packed)); =20 /* SMBIOS type 127 -- End-of-table */ --=20 2.34.1 From nobody Thu Oct 30 18:55:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1755988043; cv=none; d=zohomail.com; s=zohoarc; b=YZBtxdEsIFnhNm55ZCZAHTvFgP7b4a4OYxYMHkToatPbYTyQaZHsQC6ZKatRF5BDy/NZb2i6xpA4W6enxQpH7w52BGZx2ZXDQGhChmSU57qRE9ibO9QbvjfPWeZtDY6WB9kLecfnhf8MVpS1MYX8b0I+aERgsQ8vUWT/P9CjFN8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1755988043; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qG4paJjVmzt2WmtR78TFt5pLQN6+xUIKpx/Ojl25OE0=; b=NyT4lal6bqLVfrMxJlYx671+pPCWoePf3sEvjpBHXHyXh6Z/5zvUBYep3tbPjx9zsa0ybs8ABanQbj31YRtKicTXXtE9vJFz3FtxXgROXjhfbvqjLwzO6eHJtirMM0iyMG/qRe4Sm9+RisZiwncTq4Au/ZG68T0BCBdw9nCA0c8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1755988043732415.3068853397875; Sat, 23 Aug 2025 15:27:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1091563.1448113 (Exim 4.92) (envelope-from ) id 1upwhX-0002N0-Rb; Sat, 23 Aug 2025 22:27:07 +0000 Received: by outflank-mailman (output) from mailman id 1091563.1448113; Sat, 23 Aug 2025 22:27:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1upwhX-0002Mo-OL; Sat, 23 Aug 2025 22:27:07 +0000 Received: by outflank-mailman (input) for mailman id 1091563; Sat, 23 Aug 2025 22:27:06 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1upwhW-0001yi-PO for xen-devel@lists.xenproject.org; Sat, 23 Aug 2025 22:27:06 +0000 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [2a00:1450:4864:20::633]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 4919ed61-8070-11f0-b898-0df219b8e170; Sun, 24 Aug 2025 00:27:00 +0200 (CEST) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-afcb7a5cff3so52655666b.3 for ; Sat, 23 Aug 2025 15:27:00 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-afe48fd37fbsm252045166b.47.2025.08.23.15.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Aug 2025 15:26:58 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4919ed61-8070-11f0-b898-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755988019; x=1756592819; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qG4paJjVmzt2WmtR78TFt5pLQN6+xUIKpx/Ojl25OE0=; b=YlwuJQFsLDZslDVPiUPLsKE9dY0GWAg1Fjj3sDkfXQxdaV4GTxWqYsXvzJFFXZBQ/j /oUL6uCKEx1y2GnOIcWTexhszMTKWCsW0GuOcVSvXTU1GMrhBZoBFFVVLuBifO2psnf2 1G9JuD8mDe2t+0d3xM62gRpTNcpi6z9nhp/UcVzyL7P2dQayA4ehpIZhPYTSuzSeXC9O 6H3uitaGuDgkt1H0UXaOB3PR2ZnLgaKjNn0OPeRApTS2y3GdRVaZ/IJCbNNN02TC/FVM Ys4olNTgGrt75rf+9ICf7gpAw9IWmIZ5s8kPrQeLEhgPzpE5WSioNe8L2hFb2a1dIeAK Bb1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755988019; x=1756592819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qG4paJjVmzt2WmtR78TFt5pLQN6+xUIKpx/Ojl25OE0=; b=Qx7JyV6IXK6IUGY2WBeIxuJ2kwz1m6aTWyeqeoS2hjUNFZm3Wh4Y2TiJLD8iUJvt8e pqPrSr884LJGLlL2WyR7O4D+RhpHPy7p9ooaLaf492U0dvAZVWJz9gEYisW8XCOt2rNz 7t08sjdEJkQ+rrBYd0M2UiWmNZwF6N+DnIwrAur05NoN6+ovIqc2VxwIdLY6mhYSWM3D DzwYnNzm07IHCcf+7sSPvUuPjd6CYGuB0NAgh7nhliA28/K6FcZ8uI/g+Jps2U7iUfYL dB6Yj9i5wsWZ06nRnCgrR97dMJ1aSrB3XTiUWaXPpgqXNfg18XR64LnznBCOICwPhxLE Kpjg== X-Gm-Message-State: AOJu0YwrsRiisjZrQys3pc64qdWJEBnBi+RxyllMjIfUKZv9zHUA6ir1 uVSmYxBjZzlirDBO9luHGPpvsjKC3DXqbkRfTEFCOVW4PhSDbjVjcLUgUwVsUQ== X-Gm-Gg: ASbGncsLPosoInPUFotwiC2KTiQAwLbIZmA0EwaB6g/wQT9cdQbcu7+PRYVBzdDqW1q ncYGMSlszZUOPJZUMX/Glmem8KH6oGXW3atsHUvyhsCh0I0Jt4T+qaQOTz7AmF7+zxMZrqT1Omb hQSkt+ohSzIK5lWVOfqpMfMppt3hr/FVzBci9qYlWWpD8Wr0d0Ki33Qi0eoc9eLjGvMtgwyw0PC TzK1vLSwMTuYeCwYXvoNaPFq5945jBRfkn5i9Pw9Tmdlt8NFRCCtVjPbL4HfTz804A5tunyuMed JuSXfL+VAlSyGH3qsaQMJmTobn65WTTXo8Gk8RUtx+sOUeTgIe6gDjmHE4nQvLwCLtX86EFaeKm mTcHHqKKnm4mDl+hbTBTC6Nzzgfwi7LTU/8b53NJLzpu9mLEUpr4u4oBOtrVoX/cmXkV4ZWRlSp fGyxVflWDWg+NTo9X2bwVbd0Eew9cz8CGe X-Google-Smtp-Source: AGHT+IFRpio/VEsHjfPDgitsBpViUeoq+NQACVyobSIWuzWw6zfVLpQQeYRT8ev7MjvL/Xz00K6wNw== X-Received: by 2002:a17:907:94c9:b0:ad8:8e05:e5e9 with SMTP id a640c23a62f3a-afe28f0797amr344817666b.2.1755988019128; Sat, 23 Aug 2025 15:26:59 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD Subject: [PATCH v5 3/4] hvmloader: add new SMBIOS tables (7, 8, 9, 26, 27, 28) Date: Sat, 23 Aug 2025 22:26:51 +0000 Message-Id: <4ecd33acd8bdf629e9103e97ff271150541e7415.1755987697.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1755988045586116600 From: Petr Bene=C5=A1 Some SMBIOS tables are used by certain malware families to detect virtualiz= ed environments via WMI queries. To improve stealth for sandboxing purposes, this patch adds support for populating these SMBIOS tables from an external binary specified via the "smbios_firmware" domain config option: * 7 - Cache Info * 8 - Port Connector * 9 - System Slots * 26 - Voltage Probe * 27 - Cooling Device * 28 - Temperature Probe If particular table is absent in binary file, then it will not be mapped to memory. This method works for Windows domains as tables 7,8,9,26,27,28 are = not critical for OS boot and runtime. Also if "smbios_firmware" parameter is not provided, these tables will be skipped in write_smbios_tables function. From: Anton Belousov Signed-off-by: Petr Bene=C5=A1 Acked-by: Jan Beulich --- tools/firmware/hvmloader/smbios.c | 111 ++++++++++++++++++++++++ tools/firmware/hvmloader/smbios_types.h | 77 ++++++++++++++++ 2 files changed, 188 insertions(+) diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/s= mbios.c index de3ba78e87..76c7090d16 100644 --- a/tools/firmware/hvmloader/smbios.c +++ b/tools/firmware/hvmloader/smbios.c @@ -33,12 +33,18 @@ #define SMBIOS_HANDLE_TYPE2 0x0200 #define SMBIOS_HANDLE_TYPE3 0x0300 #define SMBIOS_HANDLE_TYPE4 0x0400 +#define SMBIOS_HANDLE_TYPE7 0x0700 +#define SMBIOS_HANDLE_TYPE8 0x0800 +#define SMBIOS_HANDLE_TYPE9 0x0900 #define SMBIOS_HANDLE_TYPE11 0x0B00 #define SMBIOS_HANDLE_TYPE16 0x1000 #define SMBIOS_HANDLE_TYPE17 0x1100 #define SMBIOS_HANDLE_TYPE19 0x1300 #define SMBIOS_HANDLE_TYPE20 0x1400 #define SMBIOS_HANDLE_TYPE22 0x1600 +#define SMBIOS_HANDLE_TYPE26 0x1A00 +#define SMBIOS_HANDLE_TYPE27 0x1B00 +#define SMBIOS_HANDLE_TYPE28 0x1C00 #define SMBIOS_HANDLE_TYPE32 0x2000 #define SMBIOS_HANDLE_TYPE39 0x2700 #define SMBIOS_HANDLE_TYPE127 0x7f00 @@ -79,6 +85,12 @@ static void * smbios_type_4_init(void *start, unsigned int cpu_number, char *cpu_manufacturer); static void * +smbios_type_7_init(void *start); +static void * +smbios_type_8_init(void *start); +static void * +smbios_type_9_init(void *start); +static void * smbios_type_11_init(void *start); static void * smbios_type_16_init(void *start, uint32_t memory_size_mb, int nr_mem_devs); @@ -91,6 +103,12 @@ smbios_type_20_init(void *start, uint32_t memory_size_m= b, int instance); static void * smbios_type_22_init(void *start); static void * +smbios_type_26_init(void *start); +static void * +smbios_type_27_init(void *start); +static void * +smbios_type_28_init(void *start); +static void * smbios_type_32_init(void *start); static void * smbios_type_39_init(void *start); @@ -225,6 +243,9 @@ write_smbios_tables(void *ep, void *start, do_struct(smbios_type_3_init(p)); for ( cpu_num =3D 1; cpu_num <=3D vcpus; cpu_num++ ) do_struct(smbios_type_4_init(p, cpu_num, cpu_manufacturer)); + do_struct(smbios_type_7_init(p)); + do_struct(smbios_type_8_init(p)); + do_struct(smbios_type_9_init(p)); do_struct(smbios_type_11_init(p)); =20 /* Each 'memory device' covers up to 16GB of address space. */ @@ -241,6 +262,9 @@ write_smbios_tables(void *ep, void *start, } =20 do_struct(smbios_type_22_init(p)); + do_struct(smbios_type_26_init(p)); + do_struct(smbios_type_27_init(p)); + do_struct(smbios_type_28_init(p)); do_struct(smbios_type_32_init(p)); do_struct(smbios_type_39_init(p)); do_struct(smbios_type_vendor_oem_init(p)); @@ -728,6 +752,42 @@ smbios_type_4_init( return start+1; } =20 +/* Type 7 -- Cache Information */ +static void * +smbios_type_7_init(void *start) +{ + /* Specification says Type 7 table has length of 13h for v2.1+. */ + BUILD_BUG_ON(sizeof(struct smbios_type_7) !=3D 19); + + /* Only present when passed in. */ + return smbios_pt_copy(start, 7, SMBIOS_HANDLE_TYPE7, + sizeof(struct smbios_type_7)); +} + +/* Type 8 -- Port Connector Information */ +static void * +smbios_type_8_init(void *start) +{ + /* Specification says Type 8 table has length of 09h. */ + BUILD_BUG_ON(sizeof(struct smbios_type_8) !=3D 9); + + /* Only present when passed in. */ + return smbios_pt_copy(start, 8, SMBIOS_HANDLE_TYPE8, + sizeof(struct smbios_type_8)); +} + +/* Type 9 -- System Slots */ +static void * +smbios_type_9_init(void *start) +{ + /* Specification says Type 9 table has length of 0Dh for v2.1-2.5. */ + BUILD_BUG_ON(sizeof(struct smbios_type_9) !=3D 13); + + /* Only present when passed in. */ + return smbios_pt_copy(start, 9, SMBIOS_HANDLE_TYPE9, + sizeof(struct smbios_type_9)); +} + /* Type 11 -- OEM Strings */ static void * smbios_type_11_init(void *start) @@ -959,6 +1019,57 @@ smbios_type_22_init(void *start) return start + 1; } =20 +/* Type 26 -- Voltage Probe */ +static void * +smbios_type_26_init(void *start) +{ + /* + * Specification says Type 26 table has length of at least 14h, + * which corresponds with the end of the "OEM-defined" field. + * + * Only present when passed in. + */ + + BUILD_BUG_ON(endof_field(struct smbios_type_26, oem_defined) !=3D 20); + + return smbios_pt_copy(start, 26, SMBIOS_HANDLE_TYPE26, + endof_field(struct smbios_type_26, oem_defined)); +} + +/* Type 27 -- Cooling Device */ +static void * +smbios_type_27_init(void *start) +{ + /* + * Specification says Type 27 table has length of at least 0Ch, + * which corresponds with the end of the "OEM-defined" field. + * + * Only present when passed in. + */ + + BUILD_BUG_ON(endof_field(struct smbios_type_27, oem_defined) !=3D 12); +=20 + return smbios_pt_copy(start, 27, SMBIOS_HANDLE_TYPE27, + endof_field(struct smbios_type_27, oem_defined)); +} + +/* Type 28 -- Temperature Probe */ +static void * +smbios_type_28_init(void *start) +{ + /* + * Specification says Type 28 table has length of at least 14h, + * which corresponds with the end of the "OEM-defined" field. + * + * Only present when passed in. + */ + + BUILD_BUG_ON(endof_field(struct smbios_type_28, oem_defined) !=3D 20); + + return smbios_pt_copy(start, 28, SMBIOS_HANDLE_TYPE28, + endof_field(struct smbios_type_28, oem_defined)); +} + /* Type 32 -- System Boot Information */ static void * smbios_type_32_init(void *start) diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmlo= ader/smbios_types.h index a04d194975..c04b435d31 100644 --- a/tools/firmware/hvmloader/smbios_types.h +++ b/tools/firmware/hvmloader/smbios_types.h @@ -149,6 +149,44 @@ struct smbios_type_4 { uint8_t part_number_str; } __attribute__ ((packed)); =20 +/* SMBIOS type 7 - Cache Information */ +struct smbios_type_7 { + struct smbios_structure_header header; + uint8_t socket_designation_str; + uint16_t cache_configuration; + uint16_t maximum_cache_size; + uint16_t installed_size; + uint16_t supported_SRAM_type; + uint16_t current_SRAM_type; + uint8_t cache_speed; + uint8_t error_connection_type; + uint8_t system_cache_type; + uint8_t associativity; +} __attribute__ ((packed)); + +/* SMBIOS type 8 - Port Connector Information */ +struct smbios_type_8 { + struct smbios_structure_header header; + uint8_t internal_reference_designator_str; + uint8_t internal_connector_type; + uint8_t external_reference_designator_str; + uint8_t external_connector_type; + uint8_t port_type; +} __attribute__ ((packed)); + +/* SMBIOS type 9 - System Slots */ +struct smbios_type_9 { + struct smbios_structure_header header; + uint8_t slot_designation_str; + uint8_t slot_type; + uint8_t slot_data_bus_width; + uint8_t current_usage; + uint8_t slot_length; + uint16_t slot_id; + uint8_t slot_characteristics_1; + uint8_t slot_characteristics_2; +} __attribute__ ((packed)); + /* SMBIOS type 11 - OEM Strings */ struct smbios_type_11 { struct smbios_structure_header header; @@ -232,6 +270,45 @@ struct smbios_type_22 { uint32_t oem_specific; } __attribute__ ((packed)); =20 +/* SMBIOS type 26 - Voltage Probe */ +struct smbios_type_26 { + struct smbios_structure_header header; + uint8_t description_str; + uint8_t location_and_status; + uint16_t maximum_value; + uint16_t minimum_value; + uint16_t resolution; + uint16_t tolerance; + uint16_t accuracy; + uint32_t oem_defined; + uint16_t nominal_value; /* Optional */ +} __attribute__ ((packed)); + +/* SMBIOS type 27 - Cooling Device */ +struct smbios_type_27 { + struct smbios_structure_header header; + uint16_t temperature_probe_handle; + uint8_t device_type_and_status; + uint8_t cooling_unit_group; + uint32_t oem_defined; + uint16_t nominal_speed; /* Optional */ + uint8_t description_str; /* Optional */ +} __attribute__ ((packed)); + +/* SMBIOS type 28 - Temperature Probe */ +struct smbios_type_28 { + struct smbios_structure_header header; + uint8_t description_str; + uint8_t location_and_status; + uint16_t maximum_value; + uint16_t minimum_value; + uint16_t resolution; + uint16_t tolerance; + uint16_t accuracy; + uint32_t oem_defined; + uint16_t nominal_value; /* Optional */ +} __attribute__ ((packed)); + /* SMBIOS type 32 - System Boot Information */ struct smbios_type_32 { struct smbios_structure_header header; --=20 2.34.1 From nobody Thu Oct 30 18:55:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1755988049; cv=none; d=zohomail.com; s=zohoarc; b=Fcr3YnM3I269ygCcbF/l3p1tLKX3eaImB/XXpDP6aJtuoVjCl8kCIjQxDyJO8HoBoW4mcxdwZ0KygPej4DdCH6kwc7EGtUR+vje5SPTwi0EY/VFe5Y9xKy2haSxmBPGa9DBXOFOUo2Cky2Li+U12+TnnMdwabP6YljVe9t3SCYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1755988049; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=G/s2AGi+UpKxEGtbj5W5HX0hMz+DM0tpmm0fVHROyTA=; b=Y3elEnLfHyHLE90JhFTUO7j/pbOKDXlLFhdOfYCmrKStKQxwV4scIEk6PbD1n6CiivwR2UKfhyLVxwql1j56G2r72vYuKwv7qAORbaHYLWscYhO2dYe7EF8dVUyTL9rNlD9JKuDMSHI0ZCXbd7zs/wRKgtr+ZT/jaRjI5PoSZiM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1755988049150279.70424195874807; Sat, 23 Aug 2025 15:27:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1091562.1448103 (Exim 4.92) (envelope-from ) id 1upwhS-00022Y-Ia; Sat, 23 Aug 2025 22:27:02 +0000 Received: by outflank-mailman (output) from mailman id 1091562.1448103; Sat, 23 Aug 2025 22:27:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1upwhS-00022P-FN; Sat, 23 Aug 2025 22:27:02 +0000 Received: by outflank-mailman (input) for mailman id 1091562; Sat, 23 Aug 2025 22:27:01 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1upwhR-0001Mm-EN for xen-devel@lists.xenproject.org; Sat, 23 Aug 2025 22:27:01 +0000 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [2a00:1450:4864:20::52e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 49a4005f-8070-11f0-a32b-13f23c93f187; Sun, 24 Aug 2025 00:27:01 +0200 (CEST) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-6188b72d690so450916a12.2 for ; Sat, 23 Aug 2025 15:27:01 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-afe48fd37fbsm252045166b.47.2025.08.23.15.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Aug 2025 15:26:59 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 49a4005f-8070-11f0-a32b-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755988020; x=1756592820; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G/s2AGi+UpKxEGtbj5W5HX0hMz+DM0tpmm0fVHROyTA=; b=b+Onh4/v7Czx4MZUbL/tynr4SGNKiwpmMA4KeYYS00AvvNq3maK7ibBUV07rfEHsNb GrNOKAVOg3iifyQ/sGWOokYyL0h0QQQA9bgN2jNJnmtPxw2CfeKTZbLaUhOMTGV/SMW1 FaVCNrYrm1hpNseIJq2IX9GNorQfby+bNY8WwVT+eL/GEJxiSIh3ZRNrkh9pngF+JYeW V/oNGcCVXMfzYHc1Ou/tzQR1IintYuH3Xwgx917ixwYsFqjDO8jBjuunpn75gtu0h7A+ lneJ3pcYsV/KKFil31q7mZnsPG9ZIn/KXXVakC/+gdeKO77AKl90naLdC0Somnban2od iwZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755988020; x=1756592820; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G/s2AGi+UpKxEGtbj5W5HX0hMz+DM0tpmm0fVHROyTA=; b=oV8AhGsu8JiAW47DFLw5HsHfTXLnkt/4IWmPp0aZJlphpyo7RXcES3hkU3SU+h0MqP 5djvUk1QAYLMtGTwt8HpZYiIWCtcuya0t7DZfk+SAPQMjmP3O6CPQwfo/deLyLrK5AQv j0PlXqiJdeZU9ULfxUzFw3z4hER06JB3H9AQX7YU9wy7xlMqzaTj/gTnAjkgW7YkWgU3 bzHSsRNVOzBof55pRGmMLNa6HEKFXgX4aZpoNtGIBxYYJVm8qo9XKFb08BN7vdJD+5k2 HReuHRZ1KYplhFcb5i4J9pgM8nOJoFw0ajw5O+tgawzxtYnRGLjHUp59Nw60GBPfstXg pghA== X-Gm-Message-State: AOJu0YxuHw2zViZ6vDCxL2rXQodTQNGinyhSV5xUhQ2xTaI683RREZKg vYAXLbDyBCDYT0QJeDuZaWFFI50PVETLwNWM8pE/SUlvadWyOCt6xPs9c+ZE3A== X-Gm-Gg: ASbGncuZg5JLmH5Lni9/Ylk9Guk5LMmqqjFOLIBMmHNSwUzNGModF+NYaf4rEZKcp6z bG4hC/zlDv4qkp81iQzDJdL7de3zyoPS4qZndPI+CUw98hook3FCjTTXLApVnNZtdZVHTd5+Ydd eAh0nSYV9jQ6IotljNJCfwKV0IjI+YTO1xelrqLS51Jfgjkh5xlTrab3eixq/hF7Zo62AT+f55C bQdn/VxpH3qzIyldt7p6481DJGH9fSva7PzPHKFXCJHk/BF6m7yhYeAoW+UuuMMQLrlvqrZj7EX ewWA9iSsCjfHEIlW5D2lnyDp3l1TwzFT7MHsRCW/lPmC8YoLy7DqlE4byIPwQQzdwbgP7+IPMJb oO085OqJZ6k+iFLxovjW7Z9t02jQYDpMNouHtAVPka5itPDaYiZRAhWZIwJ+/epV8JowXfA4cJi Dfuafm7Q/CSZuz17hrvp8eMoUx9qTk/P36 X-Google-Smtp-Source: AGHT+IGf/E2dGFpEjsjyXWOodYnyuATtTqSt72S5E1ty0jq77FE+VHvH7pCTBwOFHmb0tQdnI7aqKQ== X-Received: by 2002:a17:907:3da1:b0:af9:67ef:96d2 with SMTP id a640c23a62f3a-afe294b0f6emr365696466b.11.1755988020097; Sat, 23 Aug 2025 15:27:00 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Oleksii Kurochko , Community Manager Subject: [PATCH v5 4/4] CHANGELOG.md: add new SMBIOS tables (7, 8, 9, 26, 27, 28) Date: Sat, 23 Aug 2025 22:26:52 +0000 Message-Id: <3c9c7c48c9d8633b4c36bb0bb91fab88c03ae279.1755987697.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1755988049311116600 From: Petr Bene=C5=A1 Signed-off-by: Petr Bene=C5=A1 Acked-by: Oleksii Kurochko --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 271ac73a0a..2fd65b90a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](https://keepach= angelog.com/en/1.0.0/) capability usage is not yet supported on PVH dom0). - Smoke tests for the FreeBSD Xen builds in Cirrus CI. - PVH xenstore-stubdom now supports Live Update. + - Support for new SMBIOS tables: 7, 8, 9, 26, 27, 28. =20 - On Arm: - Ability to enable stack protector --=20 2.34.1