public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH installer] fix #8020: common: dmi: don't error out on invalid strings
@ 2026-09-10 10:15 Christoph Heiss
  2026-09-11 11:28 ` applied: " Wolfgang Bumiller
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Heiss @ 2026-09-10 10:15 UTC (permalink / raw)
  To: pve-devel

.. when reading attributes.

Fixes #8020 [0].

Although the SMBIOS specification states that text strings must be
encoded as UTF-8 (w/o BOM) [1], bogus/broken firmwares may put junk
bytes in there.

On consumer hardware, there is normally also no way to change/fix these
entries.

So just skip these invalid attributes, which don't contain valid UTF-8.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=8020
[1] DSP0134 SMBIOS spec v3.9.0; section 6.1.3 "Text strings"

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-installer-common/src/dmi.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/proxmox-installer-common/src/dmi.rs b/proxmox-installer-common/src/dmi.rs
index 76ae4a5..a1127e3 100644
--- a/proxmox-installer-common/src/dmi.rs
+++ b/proxmox-installer-common/src/dmi.rs
@@ -1,4 +1,4 @@
-use std::{collections::HashMap, fs};
+use std::{collections::HashMap, fs, io::ErrorKind};
 
 use anyhow::{Result, bail};
 use proxmox_installer_types::SystemDMI;
@@ -28,8 +28,10 @@ fn get_dmi_infos_for(files: &[&str]) -> Result<HashMap<String, String>> {
     for file in files {
         let path = format!("{DMI_PATH}/{file}");
         let content = match fs::read_to_string(&path) {
-            Err(ref err) if err.kind() == std::io::ErrorKind::NotFound => continue,
-            Err(ref err) if err.kind() == std::io::ErrorKind::PermissionDenied => {
+            Err(ref err) if [ErrorKind::NotFound, ErrorKind::InvalidData].contains(&err.kind()) => {
+                continue;
+            }
+            Err(ref err) if err.kind() == ErrorKind::PermissionDenied => {
                 bail!("Could not read data. Are you running as root or with sudo?")
             }
             Err(err) => bail!("Error: '{err}' on '{path}'"),
-- 
2.55.0





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* applied: [PATCH installer] fix #8020: common: dmi: don't error out on invalid strings
  2026-09-10 10:15 [PATCH installer] fix #8020: common: dmi: don't error out on invalid strings Christoph Heiss
@ 2026-09-11 11:28 ` Wolfgang Bumiller
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bumiller @ 2026-09-11 11:28 UTC (permalink / raw)
  To: Christoph Heiss; +Cc: pve-devel

applied, thanks

FYI: I also updated the proxmox-installer-types dependency

On Thu, Sep 10, 2026 at 12:15:34PM +0200, Christoph Heiss wrote:
> .. when reading attributes.
> 
> Fixes #8020 [0].
> 
> Although the SMBIOS specification states that text strings must be
> encoded as UTF-8 (w/o BOM) [1], bogus/broken firmwares may put junk
> bytes in there.
> 
> On consumer hardware, there is normally also no way to change/fix these
> entries.
> 
> So just skip these invalid attributes, which don't contain valid UTF-8.
> 
> [0] https://bugzilla.proxmox.com/show_bug.cgi?id=8020
> [1] DSP0134 SMBIOS spec v3.9.0; section 6.1.3 "Text strings"
> 
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
>  proxmox-installer-common/src/dmi.rs | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/proxmox-installer-common/src/dmi.rs b/proxmox-installer-common/src/dmi.rs
> index 76ae4a5..a1127e3 100644
> --- a/proxmox-installer-common/src/dmi.rs
> +++ b/proxmox-installer-common/src/dmi.rs
> @@ -1,4 +1,4 @@
> -use std::{collections::HashMap, fs};
> +use std::{collections::HashMap, fs, io::ErrorKind};
>  
>  use anyhow::{Result, bail};
>  use proxmox_installer_types::SystemDMI;
> @@ -28,8 +28,10 @@ fn get_dmi_infos_for(files: &[&str]) -> Result<HashMap<String, String>> {
>      for file in files {
>          let path = format!("{DMI_PATH}/{file}");
>          let content = match fs::read_to_string(&path) {
> -            Err(ref err) if err.kind() == std::io::ErrorKind::NotFound => continue,
> -            Err(ref err) if err.kind() == std::io::ErrorKind::PermissionDenied => {
> +            Err(ref err) if [ErrorKind::NotFound, ErrorKind::InvalidData].contains(&err.kind()) => {
> +                continue;
> +            }
> +            Err(ref err) if err.kind() == ErrorKind::PermissionDenied => {
>                  bail!("Could not read data. Are you running as root or with sudo?")
>              }
>              Err(err) => bail!("Error: '{err}' on '{path}'"),
> -- 
> 2.55.0
> 
> 
> 
> 
> 

-- 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-11 11:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10 10:15 [PATCH installer] fix #8020: common: dmi: don't error out on invalid strings Christoph Heiss
2026-09-11 11:28 ` applied: " Wolfgang Bumiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal