[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH] tools/firmware/hvmloader/smbios.c: Add new SMBIOS tables (7,8,9,26,27,28)


  • To: Anton Belousov <blsvntn@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 17 Jan 2022 13:23:57 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jNkvD2+GRaqZz9PTe/yp2vbKsCiHiJ53Qm9FoyYrtnE=; b=O9pm5JuxKVp03QJFUsPeMkPaJ5acxHtyVpJG+85K4RR1YDWhoKEQy8VsoGVYLJfWm2ltuL6ERD5aA4YXtvRJ87WogXmtJSRPRwae9dQ1Uw7bHT1/hEIb4C6Faro71fbP5ziUrJaIBATUiDTrjn+gzHVNkhWHHhKjnc1dKeu0ebz3Z1/xmo+/ut6if+5wU+97+CA2cuqJ0FF6vztnqReSQa8DT3k2H0l2D5ZhEOSc+wzFQjUJR7SSIzhX9kc6dJTDuv5dlsCrqg3p4gstIuBAX/3XNQgh8cUjWz+tsl2mXJpgaywLTQILYZBq4lVUIayPfMQuKGz0wlJBY9+igjXWMw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d0Rsji25YB6+ThZZViUubnQmgxauz1K5hRkoRCt5U27V1jOytSgkk5uIHFotCe96Y0G2Sq++oS39XACV9Qgdcj+C0x0Cckht+5gyVlqXHeUPEGhLwVETK+/gwNQDoj08LD/zfrhlTKmu8gtqjgnHDonfrnr94SyR1uSffOjKuLWDKAXxmY9ko6Tw/QH20xuc7s9m87szNLbX7byXLCAxC+Clbour9eN9UsnocjIsCV9FSdFTa393oqwTPg7THKgv3JwslgHb5z1Lk2Q2Oxmhwhx3fIQ7Ibt1eIyi9+tvO9LSB1F8ynU2ChGWyJZkl4NI20V2f3yB1xyq2EE2KFYc1w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 17 Jan 2022 12:24:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.01.2022 09:52, Anton Belousov wrote:
> SMBIOS tables like 7,8,9,26,27,28 are neccessary to prevent sandbox detection 
> by malware
> using WMI-queries.

This is a statement without any proof. It may seem obvious to you, but
could you please make us properly see the value of your addition as
well as allow justification towards the completeness of your changes
(i.e. that there aren't further types specifying of which may also
help)?

Furthermore, with the original intention of the machinery having been
to pass through host SMBIOS structures, you will also want to say a
word on the (intended) source of the data here. If it's again the host
table, then you will want to also discuss the security of doing so.

> New tables can be mapped to memory from binary file specified in
> "smbios_firmware" parameter of domain configuration. 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.
> 
> Signed-off-by: Anton Belousov <blsvntn@xxxxxxxxxxx>
> ---
>  tools/firmware/hvmloader/smbios.c       | 146 ++++++++++++++++++++++++
>  tools/firmware/hvmloader/smbios_types.h |  77 +++++++++++++
>  2 files changed, 223 insertions(+)

Somewhere here please have a brief description of what has changed
between versions. Also please properly tag you patch with a version
(this one looks to be v2).

> @@ -700,6 +724,66 @@ smbios_type_4_init(
>      return start+1;
>  }
>  
> +/* Type 7 -- Cache Information */
> +static void *
> +smbios_type_7_init(void *start)
> +{
> +    struct smbios_type_7 *p = (struct smbios_type_7 *)start;

Please avoid introducing casts when none are necessary.

> +    void *pts;
> +    uint32_t length;
> +
> +    pts = get_smbios_pt_struct(7, &length);
> +    if ( (pts != NULL)&&(length > 0) )

In reply to v1 I did ask you to avoid copying existing style violations.
In the example here there are missing blanks on either side of &&.

I further wonder whether indeed any non-zero length is fine. IOW it may
be worthwhile to first harden the pre-existing cases a little before
further cloning them. Actually, seeing that the smbios_type_<N>_init()
functions are all largely identical, it may be worthwhile to introduce
a single function doing what is needed for all overridable types.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.