Linux ACPI
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Bob Moore <robert.moore@intel.com>,
	Peter Williams <peter@newton.cx>,
	"Dumbre, Saket" <saket.dumbre@intel.com>,
	Hans de Goede <hansg@kernel.org>
Subject: [PATCH v1] ACPICA: Refuse to evaluate a method if arguments are missing
Date: Wed, 18 Jun 2025 14:17:45 +0200	[thread overview]
Message-ID: <5909446.DvuYhMxLoT@rjwysocki.net> (raw)

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

As reported in [1], a platform firmware update that increased the number
of method parameters and forgot to update a least one of its callers,
caused ACPICA to crash due to use-after-free.

Since this a result of a clear AML issue that arguably cannot be fixed
up by the interpreter (it cannot produce missing data out of thin air),
address it by making ACPICA refuse to evaluate a method if the caller
attempts to pass fewer arguments than expected to it.

Closes: https://github.com/acpica/acpica/issues/1027 [1]
Reported-by: Peter Williams <peter@newton.cx>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

This is an exception as it fixes a kernel crash on multiple platforms
affected by the defective platform firmware update.

I will take care of submitting an equivalent change to upstream
ACPICA later.

---
 drivers/acpi/acpica/dsmethod.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -483,6 +483,13 @@
 		return_ACPI_STATUS(AE_NULL_OBJECT);
 	}
 
+	if (this_walk_state->num_operands < obj_desc->method.param_count) {
+		ACPI_ERROR((AE_INFO, "Missing argument for method [%4.4s]",
+			    acpi_ut_get_node_name(method_node)));
+
+		return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
+	}
+
 	/* Init for new method, possibly wait on method mutex */
 
 	status =




             reply	other threads:[~2025-06-18 12:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18 12:17 Rafael J. Wysocki [this message]
2025-06-18 12:21 ` [PATCH v1] ACPICA: Refuse to evaluate a method if arguments are missing Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5909446.DvuYhMxLoT@rjwysocki.net \
    --to=rjw@rjwysocki.net \
    --cc=hansg@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@newton.cx \
    --cc=robert.moore@intel.com \
    --cc=saket.dumbre@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox