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]
Date:   Fri, 25 Feb 2022 17:57:23 +0100
From:   "Jason A. Donenfeld" <Jason@...c4.com>
To:     Alexander Graf <graf@...zon.com>
Cc:     linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Len Brown <lenb@...nel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Greg KH <gregkh@...uxfoundation.org>, ardb@...nel.org,
        dwmw@...zon.co.uk
Subject: Re: [PATCH] ACPI: bus: Match first 9 bytes of device IDs

Hi Alex,

Thanks for this.

I tested this out with the vmgenid driver, and I found a bug in this v1:

On Fri, Feb 25, 2022 at 04:55:52PM +0100, Alexander Graf wrote:
> -				if (id->id[0] && !strcmp((char *)id->id, hwid->id))
> +				if (id->id[0] && !strncmp((char *)id->id, hwid->id, ACPI_ID_LEN))

This only worked once I made that `ACPI_ID_LEN - 1`, because that length
includes the null terminator. The below patch works fine. If you adjust
that and send a quick v2 follow-up, I'm happy to ack it.

Regards,
Jason

--------8<--------------------------

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 07f604832fd6..f179ebf16f21 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -829,7 +829,7 @@ static bool __acpi_match_device(struct acpi_device *device,
 		/* First, check the ACPI/PNP IDs provided by the caller. */
 		if (acpi_ids) {
 			for (id = acpi_ids; id->id[0] || id->cls; id++) {
-				if (id->id[0] && !strcmp((char *)id->id, hwid->id))
+				if (id->id[0] && !strncmp((char *)id->id, hwid->id, ACPI_ID_LEN - 1))
 					goto out_acpi_match;
 				if (id->cls && __acpi_match_device_cls(id, hwid))
 					goto out_acpi_match;
diff --git a/drivers/virt/vmgenid.c b/drivers/virt/vmgenid.c
index b503c210c2d7..04751fc1d365 100644
--- a/drivers/virt/vmgenid.c
+++ b/drivers/virt/vmgenid.c
@@ -78,8 +78,7 @@ static void vmgenid_acpi_notify(struct acpi_device *device, u32 event)
 }

 static const struct acpi_device_id vmgenid_ids[] = {
-	{ "QEMUVGID", 0 },	/* QEMU */
-	{ "VMGENID", 0 },	/* Firecracker */
+	{ "VM_GEN_C", 0 }, /* Truncated "VM_Gen_Counter" */
 	{ },
 };

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ