* [PATCH v3 0/3] Add support for loading SMBIOS OEM strings from a file @ 2020-09-23 13:38 Daniel P. Berrangé 2020-09-23 13:38 ` [PATCH v3 1/3] hw/smbios: support loading OEM strings values " Daniel P. Berrangé ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Daniel P. Berrangé @ 2020-09-23 13:38 UTC (permalink / raw) To: qemu-devel Cc: Peter Maydell, Daniel P. Berrangé, Eduardo Habkost, Michael S. Tsirkin, Laszlo Ersek, Markus Armbruster, qemu-arm, Igor Mammedov, Paolo Bonzini, Richard Henderson I previously added support for SMBIOS OEM strings tables but only allowed for data to be passed inline. Potential users indicated they wanted to pass some quite large data blobs which is inconvenient todo inline. Thus I'm adding support for passing the data from a file. In testing this I discovered the hard way that on x86 we're limited to using the SMBIOS 2.1 entry point currently. This has a maximum size of 0xffff, and if you exceed this all sorts of wierd behaviour happens. QEMU forces SMBIOS 2.1 on x86 because the default SeaBIOS firmware does not support SMBIOS 3.0. The EDK2 firmware supports SMBIOS 3.0 and QEMU defaults to this on the ARM virt machine type. This series adds support for checking the SMBIOS 2.1 limits to protect users from impossible to diagnose problems. There is also a fix needed to SeaBIOS which fails to check for integer overflow when it appends the type 0 table. https://mail.coreboot.org/hyperkitty/list/seabios@seabios.org/thread/3EMIOY= 6YS6MG5UQN3JJJS2A3DJZOVFR6/ IIUC, SMBIOS 3.0 should only be limited by what you can fit into RAM, but in testing, EDK2 appears to hang shortly after the SMBIOS 3.0 data size exceeds 128 KB. I've not spotted an obvious flaw in EDK2 or QEMU, nor do I attempt to enforce a limit in QEMU for SMBIOS 3.0. Changed in v3: - Adjust for qemu_open method signature change Changed in v2: - Drop the patches that allowed choice of SMBIOS 2.1 / 3.0 entry point. There's no compelling reason to need 3.0 on x86 while aarch64 is 3.0 only. Daniel P. Berrang=C3=A9 (3): hw/smbios: support loading OEM strings values from a file hw/smbios: report error if table size is too large qemu-options: document SMBIOS type 11 settings hw/smbios/smbios.c | 85 +++++++++++++++++++++++++++++++++++++++------- qemu-options.hx | 41 ++++++++++++++++++++++ 2 files changed, 113 insertions(+), 13 deletions(-) --=20 2.26.2 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/3] hw/smbios: support loading OEM strings values from a file 2020-09-23 13:38 [PATCH v3 0/3] Add support for loading SMBIOS OEM strings from a file Daniel P. Berrangé @ 2020-09-23 13:38 ` Daniel P. Berrangé 2020-09-24 7:20 ` Laszlo Ersek 2020-09-23 13:38 ` [PATCH v3 2/3] hw/smbios: report error if table size is too large Daniel P. Berrangé 2020-09-23 13:38 ` [PATCH v3 3/3] qemu-options: document SMBIOS type 11 settings Daniel P. Berrangé 2 siblings, 1 reply; 7+ messages in thread From: Daniel P. Berrangé @ 2020-09-23 13:38 UTC (permalink / raw) To: qemu-devel Cc: Peter Maydell, Daniel P. Berrangé, Eduardo Habkost, Michael S. Tsirkin, Laszlo Ersek, Markus Armbruster, Philippe Mathieu-Daudé, qemu-arm, Igor Mammedov, Paolo Bonzini, Richard Henderson Some applications want to pass quite large values for the OEM strings entries. Rather than having huge strings on the command line, it would be better to load them from a file, as supported with -fw_cfg. This introduces the "path" parameter allowing for: $ echo -n "thisthing" > mydata.txt $ qemu-system-x86_64 \ -smbios type=11,value=something \ -smbios type=11,path=mydata.txt \ -smbios type=11,value=somemore \ ...other args... Now in the guest $ dmidecode -t 11 Getting SMBIOS data from sysfs. SMBIOS 2.8 present. Handle 0x0E00, DMI type 11, 5 bytes OEM Strings String 1: something String 2: thisthing String 3: somemore Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- hw/smbios/smbios.c | 71 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 13 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 7cc950b41c..d993448087 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -110,7 +110,7 @@ static struct { static struct { size_t nvalues; - const char **values; + char **values; } type11; static struct { @@ -314,6 +314,11 @@ static const QemuOptDesc qemu_smbios_type11_opts[] = { .type = QEMU_OPT_STRING, .help = "OEM string data", }, + { + .name = "path", + .type = QEMU_OPT_STRING, + .help = "OEM string data from file", + }, }; static const QemuOptDesc qemu_smbios_type17_opts[] = { @@ -641,6 +646,8 @@ static void smbios_build_type_11_table(void) for (i = 0; i < type11.nvalues; i++) { SMBIOS_TABLE_SET_STR_LIST(11, type11.values[i]); + g_free(type11.values[i]); + type11.values[i] = NULL; } SMBIOS_BUILD_TABLE_POST; @@ -940,9 +947,8 @@ static void save_opt(const char **dest, QemuOpts *opts, const char *name) struct opt_list { - const char *name; size_t *ndest; - const char ***dest; + char ***dest; }; static int save_opt_one(void *opaque, @@ -951,23 +957,60 @@ static int save_opt_one(void *opaque, { struct opt_list *opt = opaque; - if (!g_str_equal(name, opt->name)) { - return 0; + if (g_str_equal(name, "path")) { + g_autoptr(GByteArray) data = g_byte_array_new(); + g_autofree char *buf = g_new(char, 4096); + ssize_t ret; + int fd = qemu_open(value, O_RDONLY, errp); + if (fd < 0) { + return -1; + } + + while (1) { + ret = read(fd, buf, 4096); + if (ret == 0) { + break; + } + if (ret < 0) { + error_setg(errp, "Unable to read from %s: %s", + value, strerror(errno)); + return -1; + } + if (memchr(buf, '\0', ret)) { + error_setg(errp, "NUL in OEM strings value in %s", value); + return -1; + } + g_byte_array_append(data, (guint8 *)buf, ret); + } + + close(fd); + + *opt->dest = g_renew(char *, *opt->dest, (*opt->ndest) + 1); + (*opt->dest)[*opt->ndest] = (char *)g_byte_array_free(data, FALSE); + (*opt->ndest)++; + data = NULL; + } else if (g_str_equal(name, "value")) { + *opt->dest = g_renew(char *, *opt->dest, (*opt->ndest) + 1); + (*opt->dest)[*opt->ndest] = g_strdup(value); + (*opt->ndest)++; + } else if (!g_str_equal(name, "type")) { + error_setg(errp, "Unexpected option %s", name); + return -1; } - *opt->dest = g_renew(const char *, *opt->dest, (*opt->ndest) + 1); - (*opt->dest)[*opt->ndest] = value; - (*opt->ndest)++; return 0; } -static void save_opt_list(size_t *ndest, const char ***dest, - QemuOpts *opts, const char *name) +static bool save_opt_list(size_t *ndest, char ***dest, QemuOpts *opts, + Error **errp) { struct opt_list opt = { - name, ndest, dest, + ndest, dest, }; - qemu_opt_foreach(opts, save_opt_one, &opt, NULL); + if (!qemu_opt_foreach(opts, save_opt_one, &opt, errp)) { + return false; + } + return true; } void smbios_entry_add(QemuOpts *opts, Error **errp) @@ -1149,7 +1192,9 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) if (!qemu_opts_validate(opts, qemu_smbios_type11_opts, errp)) { return; } - save_opt_list(&type11.nvalues, &type11.values, opts, "value"); + if (!save_opt_list(&type11.nvalues, &type11.values, opts, errp)) { + return; + } return; case 17: if (!qemu_opts_validate(opts, qemu_smbios_type17_opts, errp)) { -- 2.26.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/3] hw/smbios: support loading OEM strings values from a file 2020-09-23 13:38 ` [PATCH v3 1/3] hw/smbios: support loading OEM strings values " Daniel P. Berrangé @ 2020-09-24 7:20 ` Laszlo Ersek 0 siblings, 0 replies; 7+ messages in thread From: Laszlo Ersek @ 2020-09-24 7:20 UTC (permalink / raw) To: Daniel P. Berrangé, qemu-devel Cc: Peter Maydell, Eduardo Habkost, Michael S. Tsirkin, Philippe Mathieu-Daudé, Markus Armbruster, qemu-arm, Igor Mammedov, Paolo Bonzini, Richard Henderson On 09/23/20 15:38, Daniel P. Berrangé wrote: > Some applications want to pass quite large values for the OEM strings > entries. Rather than having huge strings on the command line, it would > be better to load them from a file, as supported with -fw_cfg. > > This introduces the "path" parameter allowing for: > > $ echo -n "thisthing" > mydata.txt > $ qemu-system-x86_64 \ > -smbios type=11,value=something \ > -smbios type=11,path=mydata.txt \ > -smbios type=11,value=somemore \ > ...other args... > > Now in the guest > > $ dmidecode -t 11 > Getting SMBIOS data from sysfs. > SMBIOS 2.8 present. > > Handle 0x0E00, DMI type 11, 5 bytes > OEM Strings > String 1: something > String 2: thisthing > String 3: somemore > > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> > --- > hw/smbios/smbios.c | 71 +++++++++++++++++++++++++++++++++++++--------- > 1 file changed, 58 insertions(+), 13 deletions(-) > > diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c > index 7cc950b41c..d993448087 100644 > --- a/hw/smbios/smbios.c > +++ b/hw/smbios/smbios.c > @@ -110,7 +110,7 @@ static struct { > > static struct { > size_t nvalues; > - const char **values; > + char **values; > } type11; > > static struct { > @@ -314,6 +314,11 @@ static const QemuOptDesc qemu_smbios_type11_opts[] = { > .type = QEMU_OPT_STRING, > .help = "OEM string data", > }, > + { > + .name = "path", > + .type = QEMU_OPT_STRING, > + .help = "OEM string data from file", > + }, > }; > > static const QemuOptDesc qemu_smbios_type17_opts[] = { > @@ -641,6 +646,8 @@ static void smbios_build_type_11_table(void) > > for (i = 0; i < type11.nvalues; i++) { > SMBIOS_TABLE_SET_STR_LIST(11, type11.values[i]); > + g_free(type11.values[i]); > + type11.values[i] = NULL; > } > > SMBIOS_BUILD_TABLE_POST; > @@ -940,9 +947,8 @@ static void save_opt(const char **dest, QemuOpts *opts, const char *name) > > > struct opt_list { > - const char *name; > size_t *ndest; > - const char ***dest; > + char ***dest; > }; > > static int save_opt_one(void *opaque, > @@ -951,23 +957,60 @@ static int save_opt_one(void *opaque, > { > struct opt_list *opt = opaque; > > - if (!g_str_equal(name, opt->name)) { > - return 0; > + if (g_str_equal(name, "path")) { > + g_autoptr(GByteArray) data = g_byte_array_new(); > + g_autofree char *buf = g_new(char, 4096); > + ssize_t ret; > + int fd = qemu_open(value, O_RDONLY, errp); > + if (fd < 0) { > + return -1; > + } > + > + while (1) { > + ret = read(fd, buf, 4096); > + if (ret == 0) { > + break; > + } > + if (ret < 0) { > + error_setg(errp, "Unable to read from %s: %s", > + value, strerror(errno)); > + return -1; > + } > + if (memchr(buf, '\0', ret)) { > + error_setg(errp, "NUL in OEM strings value in %s", value); > + return -1; > + } > + g_byte_array_append(data, (guint8 *)buf, ret); > + } > + > + close(fd); > + > + *opt->dest = g_renew(char *, *opt->dest, (*opt->ndest) + 1); > + (*opt->dest)[*opt->ndest] = (char *)g_byte_array_free(data, FALSE); > + (*opt->ndest)++; > + data = NULL; > + } else if (g_str_equal(name, "value")) { > + *opt->dest = g_renew(char *, *opt->dest, (*opt->ndest) + 1); > + (*opt->dest)[*opt->ndest] = g_strdup(value); > + (*opt->ndest)++; > + } else if (!g_str_equal(name, "type")) { > + error_setg(errp, "Unexpected option %s", name); > + return -1; > } > > - *opt->dest = g_renew(const char *, *opt->dest, (*opt->ndest) + 1); > - (*opt->dest)[*opt->ndest] = value; > - (*opt->ndest)++; > return 0; > } > > -static void save_opt_list(size_t *ndest, const char ***dest, > - QemuOpts *opts, const char *name) > +static bool save_opt_list(size_t *ndest, char ***dest, QemuOpts *opts, > + Error **errp) > { > struct opt_list opt = { > - name, ndest, dest, > + ndest, dest, > }; > - qemu_opt_foreach(opts, save_opt_one, &opt, NULL); > + if (!qemu_opt_foreach(opts, save_opt_one, &opt, errp)) { > + return false; > + } > + return true; > } > > void smbios_entry_add(QemuOpts *opts, Error **errp) > @@ -1149,7 +1192,9 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) > if (!qemu_opts_validate(opts, qemu_smbios_type11_opts, errp)) { > return; > } > - save_opt_list(&type11.nvalues, &type11.values, opts, "value"); > + if (!save_opt_list(&type11.nvalues, &type11.values, opts, errp)) { > + return; > + } > return; > case 17: > if (!qemu_opts_validate(opts, qemu_smbios_type17_opts, errp)) { > Tested-by: Laszlo Ersek <lersek@redhat.com> Thanks! Laszlo ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 2/3] hw/smbios: report error if table size is too large 2020-09-23 13:38 [PATCH v3 0/3] Add support for loading SMBIOS OEM strings from a file Daniel P. Berrangé 2020-09-23 13:38 ` [PATCH v3 1/3] hw/smbios: support loading OEM strings values " Daniel P. Berrangé @ 2020-09-23 13:38 ` Daniel P. Berrangé 2020-09-24 7:13 ` Laszlo Ersek 2020-09-23 13:38 ` [PATCH v3 3/3] qemu-options: document SMBIOS type 11 settings Daniel P. Berrangé 2 siblings, 1 reply; 7+ messages in thread From: Daniel P. Berrangé @ 2020-09-23 13:38 UTC (permalink / raw) To: qemu-devel Cc: Peter Maydell, Daniel P. Berrangé, Eduardo Habkost, Michael S. Tsirkin, Laszlo Ersek, Markus Armbruster, Philippe Mathieu-Daudé, qemu-arm, Igor Mammedov, Paolo Bonzini, Richard Henderson The SMBIOS 2.1 entry point uses a uint16 data type for reporting the total length of the tables. If the user passes -smbios configuration to QEMU that causes the table size to exceed this limit then various bad behaviours result, including - firmware hangs in an infinite loop - firmware triggers a KVM crash on bad memory access - firmware silently discards user's SMBIOS data replacing it with a generic data set. Limiting the size to 0xffff in QEMU avoids triggering most of these problems. There is a remaining bug in SeaBIOS which tries to prepend its own data for table 0, and does not check whether there is sufficient space before attempting this. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- hw/smbios/smbios.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index d993448087..8b30906e50 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -365,6 +365,13 @@ static void smbios_register_config(void) opts_init(smbios_register_config); +/* + * The SMBIOS 2.1 "structure table length" field in the + * entry point uses a 16-bit integer, so we're limited + * in total table size + */ +#define SMBIOS_21_MAX_TABLES_LEN 0xffff + static void smbios_validate_table(MachineState *ms) { uint32_t expect_t4_count = smbios_legacy ? @@ -375,6 +382,13 @@ static void smbios_validate_table(MachineState *ms) expect_t4_count, smbios_type4_count); exit(1); } + + if (smbios_ep_type == SMBIOS_ENTRY_POINT_21 && + smbios_tables_len > SMBIOS_21_MAX_TABLES_LEN) { + error_report("SMBIOS 2.1 table length %zu exceeds %d", + smbios_tables_len, SMBIOS_21_MAX_TABLES_LEN); + exit(1); + } } -- 2.26.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/3] hw/smbios: report error if table size is too large 2020-09-23 13:38 ` [PATCH v3 2/3] hw/smbios: report error if table size is too large Daniel P. Berrangé @ 2020-09-24 7:13 ` Laszlo Ersek 0 siblings, 0 replies; 7+ messages in thread From: Laszlo Ersek @ 2020-09-24 7:13 UTC (permalink / raw) To: Daniel P. Berrangé, qemu-devel Cc: Peter Maydell, Eduardo Habkost, Michael S. Tsirkin, Philippe Mathieu-Daudé, Markus Armbruster, qemu-arm, Igor Mammedov, Paolo Bonzini, Richard Henderson On 09/23/20 15:38, Daniel P. Berrangé wrote: > The SMBIOS 2.1 entry point uses a uint16 data type for reporting the > total length of the tables. If the user passes -smbios configuration to > QEMU that causes the table size to exceed this limit then various bad > behaviours result, including > > - firmware hangs in an infinite loop > - firmware triggers a KVM crash on bad memory access > - firmware silently discards user's SMBIOS data replacing it with > a generic data set. > > Limiting the size to 0xffff in QEMU avoids triggering most of these > problems. There is a remaining bug in SeaBIOS which tries to prepend its > own data for table 0, and does not check whether there is sufficient > space before attempting this. > > Reviewed-by: Igor Mammedov <imammedo@redhat.com> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> > --- > hw/smbios/smbios.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c > index d993448087..8b30906e50 100644 > --- a/hw/smbios/smbios.c > +++ b/hw/smbios/smbios.c > @@ -365,6 +365,13 @@ static void smbios_register_config(void) > > opts_init(smbios_register_config); > > +/* > + * The SMBIOS 2.1 "structure table length" field in the > + * entry point uses a 16-bit integer, so we're limited > + * in total table size > + */ > +#define SMBIOS_21_MAX_TABLES_LEN 0xffff > + > static void smbios_validate_table(MachineState *ms) > { > uint32_t expect_t4_count = smbios_legacy ? > @@ -375,6 +382,13 @@ static void smbios_validate_table(MachineState *ms) > expect_t4_count, smbios_type4_count); > exit(1); > } > + > + if (smbios_ep_type == SMBIOS_ENTRY_POINT_21 && > + smbios_tables_len > SMBIOS_21_MAX_TABLES_LEN) { > + error_report("SMBIOS 2.1 table length %zu exceeds %d", > + smbios_tables_len, SMBIOS_21_MAX_TABLES_LEN); > + exit(1); > + } > } > > > Tested-by: Laszlo Ersek <lersek@redhat.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] qemu-options: document SMBIOS type 11 settings 2020-09-23 13:38 [PATCH v3 0/3] Add support for loading SMBIOS OEM strings from a file Daniel P. Berrangé 2020-09-23 13:38 ` [PATCH v3 1/3] hw/smbios: support loading OEM strings values " Daniel P. Berrangé 2020-09-23 13:38 ` [PATCH v3 2/3] hw/smbios: report error if table size is too large Daniel P. Berrangé @ 2020-09-23 13:38 ` Daniel P. Berrangé 2020-09-23 15:17 ` Markus Armbruster 2 siblings, 1 reply; 7+ messages in thread From: Daniel P. Berrangé @ 2020-09-23 13:38 UTC (permalink / raw) To: qemu-devel Cc: Peter Maydell, Daniel P. Berrangé, Eduardo Habkost, Michael S. Tsirkin, Laszlo Ersek, Markus Armbruster, Philippe Mathieu-Daudé, qemu-arm, Igor Mammedov, Paolo Bonzini, Richard Henderson Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- qemu-options.hx | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 47f64be0c0..2cb034bce3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2296,6 +2296,8 @@ DEF("smbios", HAS_ARG, QEMU_OPTION_smbios, "-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n" " [,asset=str][,part=str][,max-speed=%d][,current-speed=%d]\n" " specify SMBIOS type 4 fields\n" + "-smbios type=11[,value=str][,path=filename]\n" + " specify SMBIOS type 11 fields\n" "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n" " [,asset=str][,part=str][,speed=%d]\n" " specify SMBIOS type 17 fields\n", @@ -2319,6 +2321,45 @@ SRST ``-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str]`` Specify SMBIOS type 4 fields +``-smbios type=11[,value=str][,path=filename]`` + Specify SMBIOS type 11 fields inline + + This argument can be repeated multiple times, and values are added in the order they are parsed. + Applications intending to use OEM strings data are encouraged to use their application name as + a prefix for the value string. This facilitates passing information for multiple applications + concurrently. + + The ``value=str`` syntax provides the string data inline, while the ``path=filename`` syntax + loads data from a file on disk. Note that the file is not permitted to contain any NUL bytes. + + Both the ``value`` and ``path`` options can be repeated multiple times and will be added to + the SMBIOS table in the order in which they appear. + + Note that on the x86 architecture, the total size of all SMBIOS tables is limited to 65535 + bytes. Thus the OEM strings data is not suitable for passing large amounts of data into the + guest. Instead it should be used as a indicator to inform the guest where to locate the real + data set, for example, by specifying the serial ID of a block device. + + An example passing three strings is + + .. parsed-literal:: + + -smbios type=11,value=cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/,\\ + value=anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os,\\ + path=/some/file/with/oemstringsdata.txt + + In the guest OS this is visible with the ``dmidecode`` command + + .. parsed-literal:: + + $ dmidecode -t 11 + Handle 0x0E00, DMI type 11, 5 bytes + OEM Strings + String 1: cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/ + String 2: anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os + String 3: myapp:some extra data + + ``-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str][,asset=str][,part=str][,speed=%d]`` Specify SMBIOS type 17 fields ERST -- 2.26.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 3/3] qemu-options: document SMBIOS type 11 settings 2020-09-23 13:38 ` [PATCH v3 3/3] qemu-options: document SMBIOS type 11 settings Daniel P. Berrangé @ 2020-09-23 15:17 ` Markus Armbruster 0 siblings, 0 replies; 7+ messages in thread From: Markus Armbruster @ 2020-09-23 15:17 UTC (permalink / raw) To: Daniel P. Berrangé Cc: Peter Maydell, Eduardo Habkost, Michael S. Tsirkin, Laszlo Ersek, qemu-devel, qemu-arm, Paolo Bonzini, Igor Mammedov, Philippe Mathieu-Daudé, Richard Henderson Daniel P. Berrangé <berrange@redhat.com> writes: > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> > --- > qemu-options.hx | 41 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > > diff --git a/qemu-options.hx b/qemu-options.hx > index 47f64be0c0..2cb034bce3 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -2296,6 +2296,8 @@ DEF("smbios", HAS_ARG, QEMU_OPTION_smbios, > "-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]\n" > " [,asset=str][,part=str][,max-speed=%d][,current-speed=%d]\n" > " specify SMBIOS type 4 fields\n" > + "-smbios type=11[,value=str][,path=filename]\n" > + " specify SMBIOS type 11 fields\n" > "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n" > " [,asset=str][,part=str][,speed=%d]\n" > " specify SMBIOS type 17 fields\n", > @@ -2319,6 +2321,45 @@ SRST > ``-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str][,asset=str][,part=str]`` > Specify SMBIOS type 4 fields > > +``-smbios type=11[,value=str][,path=filename]`` > + Specify SMBIOS type 11 fields inline "inline"? > + > + This argument can be repeated multiple times, and values are added in the order they are parsed. > + Applications intending to use OEM strings data are encouraged to use their application name as > + a prefix for the value string. This facilitates passing information for multiple applications > + concurrently. > + > + The ``value=str`` syntax provides the string data inline, while the ``path=filename`` syntax > + loads data from a file on disk. Note that the file is not permitted to contain any NUL bytes. Out of curiosity: what happens when it does? > + > + Both the ``value`` and ``path`` options can be repeated multiple times and will be added to > + the SMBIOS table in the order in which they appear. > + > + Note that on the x86 architecture, the total size of all SMBIOS tables is limited to 65535 > + bytes. Thus the OEM strings data is not suitable for passing large amounts of data into the > + guest. Instead it should be used as a indicator to inform the guest where to locate the real > + data set, for example, by specifying the serial ID of a block device. > + > + An example passing three strings is > + > + .. parsed-literal:: > + > + -smbios type=11,value=cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/,\\ > + value=anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os,\\ > + path=/some/file/with/oemstringsdata.txt > + > + In the guest OS this is visible with the ``dmidecode`` command > + > + .. parsed-literal:: > + > + $ dmidecode -t 11 > + Handle 0x0E00, DMI type 11, 5 bytes > + OEM Strings > + String 1: cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/ > + String 2: anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os > + String 3: myapp:some extra data > + > + > ``-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str][,asset=str][,part=str][,speed=%d]`` > Specify SMBIOS type 17 fields > ERST ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-09-24 7:22 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-09-23 13:38 [PATCH v3 0/3] Add support for loading SMBIOS OEM strings from a file Daniel P. Berrangé 2020-09-23 13:38 ` [PATCH v3 1/3] hw/smbios: support loading OEM strings values " Daniel P. Berrangé 2020-09-24 7:20 ` Laszlo Ersek 2020-09-23 13:38 ` [PATCH v3 2/3] hw/smbios: report error if table size is too large Daniel P. Berrangé 2020-09-24 7:13 ` Laszlo Ersek 2020-09-23 13:38 ` [PATCH v3 3/3] qemu-options: document SMBIOS type 11 settings Daniel P. Berrangé 2020-09-23 15:17 ` Markus Armbruster
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).