lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251214185309.152614-5-superm1@kernel.org>
Date: Sun, 14 Dec 2025 12:53:08 -0600
From: "Mario Limonciello (AMD)" <superm1@...nel.org>
To: Yazen Ghannam <yazen.ghannam@....com>,
	x86@...nel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
	Jean Delvare <jdelvare@...e.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	"H . Peter Anvin" <hpa@...or.com>,
	linux-kernel@...r.kernel.org,
	"Mario Limonciello (AMD)" <superm1@...nel.org>
Subject: [PATCH 4/5] firmware: dmi: Add debugfs for additional information entries

Additional information entries are not exposed through standardized
information from sysfs, but can still contain valuable information.

For example on AMD systems this encodes the AGESA version.  Introduce
a debugfs file that will export this information.

Signed-off-by: Mario Limonciello (AMD) <superm1@...nel.org>
---
 drivers/firmware/dmi_scan.c | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index f7b7ed1d872e8..52ed2a6b1c1d4 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -4,6 +4,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/ctype.h>
+#include <linux/debugfs.h>
 #include <linux/dmi.h>
 #include <linux/efi.h>
 #include <linux/memblock.h>
@@ -30,6 +31,7 @@ static u32 dmi_len;
 static u16 dmi_num;
 static u8 smbios_entry_point[32];
 static int smbios_entry_point_size;
+static struct dentry *debugfs_dir;
 
 /* DMI system identification string used during boot */
 static char dmi_ids_string[128] __initdata;
@@ -180,6 +182,17 @@ static LIST_HEAD(dmi_devices);
 int dmi_available;
 EXPORT_SYMBOL_GPL(dmi_available);
 
+static int additional_show(struct seq_file *m, void *v)
+{
+	const struct dmi_device *dev = NULL;
+
+	while ((dev = dmi_find_device(DMI_DEV_TYPE_ADDITIONAL, NULL, dev)))
+		seq_printf(m, "%s\n", dev->name);
+
+	return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(additional);
+
 /*
  *	Save a DMI string
  */
@@ -810,6 +823,20 @@ static void __init dmi_scan_machine(void)
 static __ro_after_init BIN_ATTR_SIMPLE_ADMIN_RO(smbios_entry_point);
 static __ro_after_init BIN_ATTR_SIMPLE_ADMIN_RO(DMI);
 
+static void __init dmi_create_debugfs(void)
+{
+	if (!arch_debugfs_dir)
+		return;
+	debugfs_dir = debugfs_create_dir("dmi", arch_debugfs_dir);
+	if (!debugfs_dir)
+		return;
+	if (!dmi_find_device(DMI_DEV_TYPE_ADDITIONAL, NULL, NULL))
+		return;
+	debugfs_create_file("additional", 0444,
+			    debugfs_dir, NULL,
+			    &additional_fops);
+}
+
 static int __init dmi_init(void)
 {
 	struct kobject *tables_kobj;
@@ -845,9 +872,14 @@ static int __init dmi_init(void)
 	bin_attr_DMI.size = dmi_len;
 	bin_attr_DMI.private = dmi_table;
 	ret = sysfs_create_bin_file(tables_kobj, &bin_attr_DMI);
-	if (!ret)
-		return 0;
+	if (ret)
+		goto err_sysfs;
+
+	dmi_create_debugfs();
+
+	return 0;
 
+ err_sysfs:
 	sysfs_remove_bin_file(tables_kobj,
 			      &bin_attr_smbios_entry_point);
  err_unmap:
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ