linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 00/19] ACPICA: ACPICA 20250404
@ 2025-04-25 19:19 Rafael J. Wysocki
  2025-04-25 19:20 ` [PATCH v1 01/19] ACPICA: Drop stale comment about the header file content Rafael J. Wysocki
                   ` (18 more replies)
  0 siblings, 19 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:19 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

Hi All,

This series of patches represents upstream ACPICA changes made between
the 20241212 release and the 20250404 release that have not been included
into the Linux source code yet.

It contains the following material:

Ahmed Salem (3):
      ACPICA: Avoid sequence overread in call to strncmp()
      ACPICA: Apply ACPI_NONSTRING in more places
      ACPICA: Replace strncpy() with memcpy()

Alexey Neyman (1):
      ACPICA: Interpret SIDP structures in DMAR

Colin Ian King (1):
      ACPICA: Utilities: Fix spelling mistake "Incremement" -> "Increment"

Kees Cook (2):
      ACPICA: Introduce ACPI_NONSTRING
      ACPICA: Apply ACPI_NONSTRING

Saket Dumbre (2):
      ACPICA: Update copyright year
      ACPICA: Logfile: Changes for version 20250404

Shiju Jose (1):
      ACPICA: actbl2.h: ACPI 6.5: RAS2: Rename structure and field names of the RAS2 table

Sudeep Holla (1):
      ACPICA: Drop stale comment about the header file content

Sunil V L (1):
      ACPICA: actbl2: Add definitions for RIMT

Tamir Duberstein (1):
      ACPICA: Apply pack(1) to union aml_resource

Tony Luck (5):
      ACPICA: infrastructure: Add new header and ACPI_DMT_BUF26 types
      ACPICA: actbl2.h: MRRM: Add typedef and other definitions
      ACPICA: MRRM: Some cleanups
      ACPICA: infrastructure: Add new DMT_BUF types and shorten a long name
      ACPICA: actbl2.h: ERDT: Add typedef and other definitions

Zhe Qiao (1):
      ACPICA: Adjust the position of code lines

gldrk (1):
      ACPICA: utilities: Fix overflow check in vsnprintf()

Thanks!




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

* [PATCH v1 01/19] ACPICA: Drop stale comment about the header file  content
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
@ 2025-04-25 19:20 ` Rafael J. Wysocki
  2025-04-25 19:21 ` [PATCH v1 02/19] ACPICA: Apply pack(1) to union aml_resource Rafael J. Wysocki
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:20 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Sudeep Holla <sudeep.holla@arm.com>

ACPICA commit 48e7c4cd893270dab8d05e6d75fbf23d0fcbb267

Commit a025731aec31 ("Restructure ACPI table files") restructed the
header files and moved lots of tables that are in the ACPI specification
to actbl2.h(e.g.: APIC/MADT, PCCT, PPTT, ..etc).

This restructure made the comment stating this header file contains tables
that are not in the ACPI specification incorrect. From that commit onwards
it has remained as stale. Let us get rid of it as it might be misleading.

Link: https://github.com/acpica/acpica/commit/48e7c4cd
Reported-by: Sahil Kaushal <sahil.kaushal@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actbl2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 2e917a8f8bca..a3008bae6f48 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
 /******************************************************************************
  *
- * Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec)
+ * Name: actbl2.h - ACPI Table Definitions
  *
  * Copyright (C) 2000 - 2023, Intel Corp.
  *
-- 
2.43.0





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

* [PATCH v1 02/19] ACPICA: Apply pack(1) to union aml_resource
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
  2025-04-25 19:20 ` [PATCH v1 01/19] ACPICA: Drop stale comment about the header file content Rafael J. Wysocki
@ 2025-04-25 19:21 ` Rafael J. Wysocki
  2025-04-30 18:48   ` Tamir Duberstein
  2025-04-30 18:48   ` [PATCH 0/0] Cover letter only Tamir Duberstein
  2025-04-25 19:21 ` [PATCH v1 03/19] ACPICA: utilities: Fix overflow check in vsnprintf() Rafael J. Wysocki
                   ` (16 subsequent siblings)
  18 siblings, 2 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:21 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Tamir Duberstein <tamird@gmail.com>

ACPICA commit 1c28da2242783579d59767617121035dafba18c3

This was originally done in NetBSD:
https://github.com/NetBSD/src/commit/b69d1ac3f7702f67edfe412e4392f77d09804910
and is the correct alternative to the smattering of `memcpy`s I
previously contributed to this repository.

This also sidesteps the newly strict checks added in UBSAN:
https://github.com/llvm/llvm-project/commit/792674400f6f04a074a3827349ed0e2ac10067f6

Before this change we see the following UBSAN stack trace in Fuchsia:

  #0    0x000021afcfdeca5e in acpi_rs_get_address_common(struct acpi_resource*, union aml_resource*) ../../third_party/acpica/source/components/resources/rsaddr.c:329 <platform-bus-x86.so>+0x6aca5e
  #1.2  0x000021982bc4af3c in ubsan_get_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 <libclang_rt.asan.so>+0x41f3c
  #1.1  0x000021982bc4af3c in maybe_print_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 <libclang_rt.asan.so>+0x41f3c
  #1    0x000021982bc4af3c in ~scoped_report() compiler-rt/lib/ubsan/ubsan_diag.cpp:395 <libclang_rt.asan.so>+0x41f3c
  #2    0x000021982bc4bb6f in handletype_mismatch_impl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:137 <libclang_rt.asan.so>+0x42b6f
  #3    0x000021982bc4b723 in __ubsan_handle_type_mismatch_v1 compiler-rt/lib/ubsan/ubsan_handlers.cpp:142 <libclang_rt.asan.so>+0x42723
  #4    0x000021afcfdeca5e in acpi_rs_get_address_common(struct acpi_resource*, union aml_resource*) ../../third_party/acpica/source/components/resources/rsaddr.c:329 <platform-bus-x86.so>+0x6aca5e
  #5    0x000021afcfdf2089 in acpi_rs_convert_aml_to_resource(struct acpi_resource*, union aml_resource*, struct acpi_rsconvert_info*) ../../third_party/acpica/source/components/resources/rsmisc.c:355 <platform-bus-x86.so>+0x6b2089
  #6    0x000021afcfded169 in acpi_rs_convert_aml_to_resources(u8*, u32, u32, u8, void**) ../../third_party/acpica/source/components/resources/rslist.c:137 <platform-bus-x86.so>+0x6ad169
  #7    0x000021afcfe2d24a in acpi_ut_walk_aml_resources(struct acpi_walk_state*, u8*, acpi_size, acpi_walk_aml_callback, void**) ../../third_party/acpica/source/components/utilities/utresrc.c:237 <platform-bus-x86.so>+0x6ed24a
  #8    0x000021afcfde66b7 in acpi_rs_create_resource_list(union acpi_operand_object*, struct acpi_buffer*) ../../third_party/acpica/source/components/resources/rscreate.c:199 <platform-bus-x86.so>+0x6a66b7
  #9    0x000021afcfdf6979 in acpi_rs_get_method_data(acpi_handle, const char*, struct acpi_buffer*) ../../third_party/acpica/source/components/resources/rsutils.c:770 <platform-bus-x86.so>+0x6b6979
  #10   0x000021afcfdf708f in acpi_walk_resources(acpi_handle, char*, acpi_walk_resource_callback, void*) ../../third_party/acpica/source/components/resources/rsxface.c:731 <platform-bus-x86.so>+0x6b708f
  #11   0x000021afcfa95dcf in acpi::acpi_impl::walk_resources(acpi::acpi_impl*, acpi_handle, const char*, acpi::Acpi::resources_callable) ../../src/devices/board/lib/acpi/acpi-impl.cc:41 <platform-bus-x86.so>+0x355dcf
  #12   0x000021afcfaa8278 in acpi::device_builder::gather_resources(acpi::device_builder*, acpi::Acpi*, fidl::any_arena&, acpi::Manager*, acpi::device_builder::gather_resources_callback) ../../src/devices/board/lib/acpi/device-builder.cc:84 <platform-bus-x86.so>+0x368278
  #13   0x000021afcfbddb87 in acpi::Manager::configure_discovered_devices(acpi::Manager*) ../../src/devices/board/lib/acpi/manager.cc:75 <platform-bus-x86.so>+0x49db87
  #14   0x000021afcf99091d in publish_acpi_devices(acpi::Manager*, zx_device_t*, zx_device_t*) ../../src/devices/board/drivers/x86/acpi-nswalk.cc:95 <platform-bus-x86.so>+0x25091d
  #15   0x000021afcf9c1d4e in x86::X86::do_init(x86::X86*) ../../src/devices/board/drivers/x86/x86.cc:60 <platform-bus-x86.so>+0x281d4e
  #16   0x000021afcf9e33ad in λ(x86::X86::ddk_init::(anon class)*) ../../src/devices/board/drivers/x86/x86.cc:77 <platform-bus-x86.so>+0x2a33ad
  #17   0x000021afcf9e313e in fit::internal::target<(lambda at../../src/devices/board/drivers/x86/x86.cc:76:19), false, false, std::__2::allocator<std::byte>, void>::invoke(void*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:183 <platform-bus-x86.so>+0x2a313e
  #18   0x000021afcfbab4c7 in fit::internal::function_base<16UL, false, void(), std::__2::allocator<std::byte>>::invoke(const fit::internal::function_base<16UL, false, void (), std::__2::allocator<std::byte> >*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:522 <platform-bus-x86.so>+0x46b4c7
  #19   0x000021afcfbab342 in fit::function_impl<16UL, false, void(), std::__2::allocator<std::byte>>::operator()(const fit::function_impl<16UL, false, void (), std::__2::allocator<std::byte> >*) ../../sdk/lib/fit/include/lib/fit/function.h:315 <platform-bus-x86.so>+0x46b342
  #20   0x000021afcfcd98c3 in async::internal::retained_task::Handler(async_dispatcher_t*, async_task_t*, zx_status_t) ../../sdk/lib/async/task.cc:24 <platform-bus-x86.so>+0x5998c3
  #21   0x00002290f9924616 in λ(const driver_runtime::Dispatcher::post_task::(anon class)*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, zx_status_t) ../../src/devices/bin/driver_runtime/dispatcher.cc:789 <libdriver_runtime.so>+0x10a616
  #22   0x00002290f9924323 in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:788:7), true, false, std::__2::allocator<std::byte>, void, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int>::invoke(void*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <libdriver_runtime.so>+0x10a323
  #23   0x00002290f9904b76 in fit::internal::function_base<24UL, true, void(std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int), std::__2::allocator<std::byte>>::invoke(const fit::internal::function_base<24UL, true, void (std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int), std::__2::allocator<std::byte> >*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:522 <libdriver_runtime.so>+0xeab76
  #24   0x00002290f9904831 in fit::callback_impl<24UL, true, void(std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int), std::__2::allocator<std::byte>>::operator()(fit::callback_impl<24UL, true, void (std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int), std::__2::allocator<std::byte> >*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/function.h:471 <libdriver_runtime.so>+0xea831
  #25   0x00002290f98d5adc in driver_runtime::callback_request::Call(driver_runtime::callback_request*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, zx_status_t) ../../src/devices/bin/driver_runtime/callback_request.h:74 <libdriver_runtime.so>+0xbbadc
  #26   0x00002290f98e1e58 in driver_runtime::Dispatcher::dispatch_callback(driver_runtime::Dispatcher*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >) ../../src/devices/bin/driver_runtime/dispatcher.cc:1248 <libdriver_runtime.so>+0xc7e58
  #27   0x00002290f98e4159 in driver_runtime::Dispatcher::dispatch_callbacks(driver_runtime::Dispatcher*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.cc:1308 <libdriver_runtime.so>+0xca159
  #28   0x00002290f9918414 in λ(const driver_runtime::Dispatcher::create_with_adder::(anon class)*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.cc:353 <libdriver_runtime.so>+0xfe414
  #29   0x00002290f991812d in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:351:7), true, false, std::__2::allocator<std::byte>, void, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>>::invoke(void*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <libdriver_runtime.so>+0xfe12d
  #30   0x00002290f9906fc7 in fit::internal::function_base<8UL, true, void(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>), std::__2::allocator<std::byte>>::invoke(const fit::internal::function_base<8UL, true, void (std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>), std::__2::allocator<std::byte> >*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/internal/function.h:522 <libdriver_runtime.so>+0xecfc7
  #31   0x00002290f9906c66 in fit::function_impl<8UL, true, void(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>), std::__2::allocator<std::byte>>::operator()(const fit::function_impl<8UL, true, void (std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>), std::__2::allocator<std::byte> >*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/function.h:315 <libdriver_runtime.so>+0xecc66
  #32   0x00002290f98e73d9 in driver_runtime::Dispatcher::event_waiter::invoke_callback(driver_runtime::Dispatcher::event_waiter*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.h:543 <libdriver_runtime.so>+0xcd3d9
  #33   0x00002290f98e700d in driver_runtime::Dispatcher::event_waiter::handle_event(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, async_dispatcher_t*, async::wait_base*, zx_status_t, zx_packet_signal_t const*) ../../src/devices/bin/driver_runtime/dispatcher.cc:1442 <libdriver_runtime.so>+0xcd00d
  #34   0x00002290f9918983 in async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>::handle_event(async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>*, async_dispatcher_t*, async::wait_base*, zx_status_t, zx_packet_signal_t const*) ../../src/devices/bin/driver_runtime/async_loop_owned_event_handler.h:59 <libdriver_runtime.so>+0xfe983
  #35   0x00002290f9918b9e in async::wait_method<async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>, &async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>::handle_event>::call_handler(async_dispatcher_t*, async_wait_t*, zx_status_t, zx_packet_signal_t const*) ../../sdk/lib/async/include/lib/async/cpp/wait.h:201 <libdriver_runtime.so>+0xfeb9e
  #36   0x00002290f99bf509 in async_loop_dispatch_wait(async_loop_t*, async_wait_t*, zx_status_t, zx_packet_signal_t const*) ../../sdk/lib/async-loop/loop.c:394 <libdriver_runtime.so>+0x1a5509
  #37   0x00002290f99b9958 in async_loop_run_once(async_loop_t*, zx_time_t) ../../sdk/lib/async-loop/loop.c:343 <libdriver_runtime.so>+0x19f958
  #38   0x00002290f99b9247 in async_loop_run(async_loop_t*, zx_time_t, _Bool) ../../sdk/lib/async-loop/loop.c:301 <libdriver_runtime.so>+0x19f247
  #39   0x00002290f99ba962 in async_loop_run_thread(void*) ../../sdk/lib/async-loop/loop.c:860 <libdriver_runtime.so>+0x1a0962
  #40   0x000041afd176ef30 in start_c11(void*) ../../zircon/third_party/ulib/musl/pthread/pthread_create.c:63 <libc.so>+0x84f30
  #41   0x000041afd18a448d in thread_trampoline(uintptr_t, uintptr_t) ../../zircon/system/ulib/runtime/thread.cc:100 <libc.so>+0x1ba48d

Link: https://github.com/acpica/acpica/commit/1c28da22
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpica/amlresrc.h |  8 ++++----
 drivers/acpi/acpica/rsaddr.c   | 13 ++++---------
 drivers/acpi/acpica/rscalc.c   | 22 +++++-----------------
 drivers/acpi/acpica/rslist.c   | 12 +++---------
 drivers/acpi/acpica/utresrc.c  | 14 +++++---------
 5 files changed, 21 insertions(+), 48 deletions(-)

diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h
index 4e88f9fc2a28..b6588b7fa898 100644
--- a/drivers/acpi/acpica/amlresrc.h
+++ b/drivers/acpi/acpica/amlresrc.h
@@ -504,10 +504,6 @@ struct aml_resource_pin_group_config {
 
 #define AML_RESOURCE_PIN_GROUP_CONFIG_REVISION    1	/* ACPI 6.2 */
 
-/* restore default alignment */
-
-#pragma pack()
-
 /* Union of all resource descriptors, so we can allocate the worst case */
 
 union aml_resource {
@@ -562,6 +558,10 @@ union aml_resource {
 	u8 byte_item;
 };
 
+/* restore default alignment */
+
+#pragma pack()
+
 /* Interfaces used by both the disassembler and compiler */
 
 void
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c
index 27384ee245f0..f92010e667cd 100644
--- a/drivers/acpi/acpica/rsaddr.c
+++ b/drivers/acpi/acpica/rsaddr.c
@@ -272,18 +272,13 @@ u8
 acpi_rs_get_address_common(struct acpi_resource *resource,
 			   union aml_resource *aml)
 {
-	struct aml_resource_address address;
-
 	ACPI_FUNCTION_ENTRY();
 
-	/* Avoid undefined behavior: member access within misaligned address */
-
-	memcpy(&address, aml, sizeof(address));
-
 	/* Validate the Resource Type */
 
-	if ((address.resource_type > 2) &&
-	    (address.resource_type < 0xC0) && (address.resource_type != 0x0A)) {
+	if ((aml->address.resource_type > 2) &&
+	    (aml->address.resource_type < 0xC0) &&
+	    (aml->address.resource_type != 0x0A)) {
 		return (FALSE);
 	}
 
@@ -304,7 +299,7 @@ acpi_rs_get_address_common(struct acpi_resource *resource,
 		/* Generic resource type, just grab the type_specific byte */
 
 		resource->data.address.info.type_specific =
-		    address.specific_flags;
+		    aml->address.specific_flags;
 	}
 
 	return (TRUE);
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index 6e7a152d6459..242daf45e20e 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -608,18 +608,12 @@ acpi_rs_get_list_length(u8 *aml_buffer,
 
 		case ACPI_RESOURCE_NAME_SERIAL_BUS:{
 
-				/* Avoid undefined behavior: member access within misaligned address */
-
-				struct aml_resource_common_serialbus
-				    common_serial_bus;
-				memcpy(&common_serial_bus, aml_resource,
-				       sizeof(common_serial_bus));
-
 				minimum_aml_resource_length =
 				    acpi_gbl_resource_aml_serial_bus_sizes
-				    [common_serial_bus.type];
+				    [aml_resource->common_serial_bus.type];
 				extra_struct_bytes +=
-				    common_serial_bus.resource_length -
+				    aml_resource->common_serial_bus.
+				    resource_length -
 				    minimum_aml_resource_length;
 				break;
 			}
@@ -688,16 +682,10 @@ acpi_rs_get_list_length(u8 *aml_buffer,
 		 */
 		if (acpi_ut_get_resource_type(aml_buffer) ==
 		    ACPI_RESOURCE_NAME_SERIAL_BUS) {
-
-			/* Avoid undefined behavior: member access within misaligned address */
-
-			struct aml_resource_common_serialbus common_serial_bus;
-			memcpy(&common_serial_bus, aml_resource,
-			       sizeof(common_serial_bus));
-
 			buffer_size =
 			    acpi_gbl_resource_struct_serial_bus_sizes
-			    [common_serial_bus.type] + extra_struct_bytes;
+			    [aml_resource->common_serial_bus.type] +
+			    extra_struct_bytes;
 		} else {
 			buffer_size =
 			    acpi_gbl_resource_struct_sizes[resource_index] +
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c
index 164c96e063c6..e46efaa889cd 100644
--- a/drivers/acpi/acpica/rslist.c
+++ b/drivers/acpi/acpica/rslist.c
@@ -55,21 +55,15 @@ acpi_rs_convert_aml_to_resources(u8 * aml,
 	aml_resource = ACPI_CAST_PTR(union aml_resource, aml);
 
 	if (acpi_ut_get_resource_type(aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) {
-
-		/* Avoid undefined behavior: member access within misaligned address */
-
-		struct aml_resource_common_serialbus common_serial_bus;
-		memcpy(&common_serial_bus, aml_resource,
-		       sizeof(common_serial_bus));
-
-		if (common_serial_bus.type > AML_RESOURCE_MAX_SERIALBUSTYPE) {
+		if (aml_resource->common_serial_bus.type >
+		    AML_RESOURCE_MAX_SERIALBUSTYPE) {
 			conversion_table = NULL;
 		} else {
 			/* This is an I2C, SPI, UART, or CSI2 serial_bus descriptor */
 
 			conversion_table =
 			    acpi_gbl_convert_resource_serial_bus_dispatch
-			    [common_serial_bus.type];
+			    [aml_resource->common_serial_bus.type];
 		}
 	} else {
 		conversion_table =
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index cff7901f7866..e1cc3d348750 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -361,20 +361,16 @@ acpi_ut_validate_resource(struct acpi_walk_state *walk_state,
 	aml_resource = ACPI_CAST_PTR(union aml_resource, aml);
 	if (resource_type == ACPI_RESOURCE_NAME_SERIAL_BUS) {
 
-		/* Avoid undefined behavior: member access within misaligned address */
-
-		struct aml_resource_common_serialbus common_serial_bus;
-		memcpy(&common_serial_bus, aml_resource,
-		       sizeof(common_serial_bus));
-
 		/* Validate the bus_type field */
 
-		if ((common_serial_bus.type == 0) ||
-		    (common_serial_bus.type > AML_RESOURCE_MAX_SERIALBUSTYPE)) {
+		if ((aml_resource->common_serial_bus.type == 0) ||
+		    (aml_resource->common_serial_bus.type >
+		     AML_RESOURCE_MAX_SERIALBUSTYPE)) {
 			if (walk_state) {
 				ACPI_ERROR((AE_INFO,
 					    "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X",
-					    common_serial_bus.type));
+					    aml_resource->common_serial_bus.
+					    type));
 			}
 			return (AE_AML_INVALID_RESOURCE_TYPE);
 		}
-- 
2.43.0





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

* [PATCH v1 03/19] ACPICA: utilities: Fix overflow check in vsnprintf()
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
  2025-04-25 19:20 ` [PATCH v1 01/19] ACPICA: Drop stale comment about the header file content Rafael J. Wysocki
  2025-04-25 19:21 ` [PATCH v1 02/19] ACPICA: Apply pack(1) to union aml_resource Rafael J. Wysocki
@ 2025-04-25 19:21 ` Rafael J. Wysocki
  2025-05-09 21:41   ` gldrk
  2025-04-25 19:22 ` [PATCH v1 04/19] ACPICA: Interpret SIDP structures in DMAR Rafael J. Wysocki
                   ` (15 subsequent siblings)
  18 siblings, 1 reply; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:21 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: gldrk <me@rarity.fan>

ACPICA commit d9d59b7918514ae55063b93f3ec041b1a569bf49

The old version breaks sprintf on 64-bit systems for buffers
outside [0..UINT32_MAX].

Link: https://github.com/acpica/acpica/commit/d9d59b79
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpica/utprint.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c
index 42b30b9f9312..7fad03c5252c 100644
--- a/drivers/acpi/acpica/utprint.c
+++ b/drivers/acpi/acpica/utprint.c
@@ -333,11 +333,8 @@ int vsnprintf(char *string, acpi_size size, const char *format, va_list args)
 
 	pos = string;
 
-	if (size != ACPI_UINT32_MAX) {
-		end = string + size;
-	} else {
-		end = ACPI_CAST_PTR(char, ACPI_UINT32_MAX);
-	}
+	size = ACPI_MIN(size, ACPI_PTR_DIFF(ACPI_MAX_PTR, string));
+	end = string + size;
 
 	for (; *format; ++format) {
 		if (*format != '%') {
-- 
2.43.0





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

* [PATCH v1 04/19] ACPICA: Interpret SIDP structures in DMAR
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (2 preceding siblings ...)
  2025-04-25 19:21 ` [PATCH v1 03/19] ACPICA: utilities: Fix overflow check in vsnprintf() Rafael J. Wysocki
@ 2025-04-25 19:22 ` Rafael J. Wysocki
  2025-04-25 19:23 ` [PATCH v1 05/19] ACPICA: infrastructure: Add new header and ACPI_DMT_BUF26 types Rafael J. Wysocki
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:22 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Alexey Neyman <aneyman@google.com>

ACPICA commit af51f730e0bccf789686cea68e116d5f0b27aacb

Added in revision 3.4 of the VT-d spec. To support SIDP, part of the
previously reserved field in the device scope structure was used to
create a 1-byte "Flags" field.

Link: https://github.com/acpica/acpica/commit/af51f730
Signed-off-by: Alexey Neyman <aneyman@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actbl1.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 329454c303b9..e0cbda95fec8 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -819,7 +819,8 @@ enum acpi_dmar_type {
 	ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3,
 	ACPI_DMAR_TYPE_NAMESPACE = 4,
 	ACPI_DMAR_TYPE_SATC = 5,
-	ACPI_DMAR_TYPE_RESERVED = 6	/* 6 and greater are reserved */
+	ACPI_DMAR_TYPE_SIDP = 6,
+	ACPI_DMAR_TYPE_RESERVED = 7	/* 7 and greater are reserved */
 };
 
 /* DMAR Device Scope structure */
@@ -827,7 +828,8 @@ enum acpi_dmar_type {
 struct acpi_dmar_device_scope {
 	u8 entry_type;
 	u8 length;
-	u16 reserved;
+	u8 flags;
+	u8 reserved;
 	u8 enumeration_id;
 	u8 bus;
 };
@@ -923,6 +925,15 @@ struct acpi_dmar_satc {
 	u8 reserved;
 	u16 segment;
 };
+
+/* 6: so_c Integrated Device Property Reporting Structure */
+
+struct acpi_dmar_sidp {
+	struct acpi_dmar_header header;
+	u16 reserved;
+	u16 segment;
+};
+
 /*******************************************************************************
  *
  * DRTM - Dynamic Root of Trust for Measurement table
-- 
2.43.0





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

* [PATCH v1 05/19] ACPICA: infrastructure: Add new header and  ACPI_DMT_BUF26 types
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (3 preceding siblings ...)
  2025-04-25 19:22 ` [PATCH v1 04/19] ACPICA: Interpret SIDP structures in DMAR Rafael J. Wysocki
@ 2025-04-25 19:23 ` Rafael J. Wysocki
  2025-04-25 19:24 ` [PATCH v1 06/19] ACPICA: actbl2.h: MRRM: Add typedef and other definitions Rafael J. Wysocki
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:23 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Tony Luck <tony.luck@intel.com>

ACPICA commit 52840d3826bd7e183fcb555e044e190aea0b5021

New MRRM tables can have subtables that are larger than 255 bytes.

Add a new header typedef that uses u16 for Length. Could be
backported to acpi_aspt_header, struct acpi_dmar_header, struct acpi_nfit_header,
struct acpi_prmt_module_header, struct acpi_prmt_module_info. Will be used for
upcoming ERDT table.

MRRM table has a 26-byte reserved section in header. Add ACPI_DMT_BUF26
to describe this in struct acpi_dmtable_info.

Link: https://github.com/acpica/acpica/commit/52840d38
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actbl1.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index e0cbda95fec8..b403b0b60bf6 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -155,6 +155,13 @@ struct acpi_aspt_acpi_mbox_regs {
 	u64 reserved2[2];
 };
 
+/* Larger subtable header (when Length can exceed 255) */
+
+struct acpi_subtable_header_16 {
+	u16 type;
+	u16 length;
+};
+
 /*******************************************************************************
  *
  * ASF - Alert Standard Format table (Signature "ASF!")
-- 
2.43.0





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

* [PATCH v1 06/19] ACPICA: actbl2.h: MRRM: Add typedef and other  definitions
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (4 preceding siblings ...)
  2025-04-25 19:23 ` [PATCH v1 05/19] ACPICA: infrastructure: Add new header and ACPI_DMT_BUF26 types Rafael J. Wysocki
@ 2025-04-25 19:24 ` Rafael J. Wysocki
  2025-04-25 19:24 ` [PATCH v1 07/19] ACPICA: actbl2: Add definitions for RIMT Rafael J. Wysocki
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:24 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Tony Luck <tony.luck@intel.com>

ACPICA commit 04fd53b2647b9f6f98cfca551383689cb3b59362

The MRRM table describes association between physical address ranges
and "region numbers".

Structure defined in the Intel Resource Director Technology (RDT)
Architecture specification downloadable from www.intel.com/sdm

Link: https://github.com/acpica/acpica/commit/04fd53b2
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actbl2.h | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index a3008bae6f48..4fd5e8b2e199 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -37,6 +37,7 @@
 #define ACPI_SIG_MCHI           "MCHI"	/* Management Controller Host Interface table */
 #define ACPI_SIG_MPAM           "MPAM"	/* Memory System Resource Partitioning and Monitoring Table */
 #define ACPI_SIG_MPST           "MPST"	/* Memory Power State Table */
+#define ACPI_SIG_MRRM           "MRRM"	/* Memory Range and Region Mapping table */
 #define ACPI_SIG_MSDM           "MSDM"	/* Microsoft Data Management Table */
 #define ACPI_SIG_NFIT           "NFIT"	/* NVDIMM Firmware Interface Table */
 #define ACPI_SIG_NHLT           "NHLT"	/* Non HD Audio Link Table */
@@ -1736,6 +1737,45 @@ struct acpi_msct_proximity {
 	u64 memory_capacity;	/* In bytes */
 };
 
+/*******************************************************************************
+ *
+ * MRRM - Memory Range and Region Mapping (MRRM) table
+ *
+ ******************************************************************************/
+
+struct acpi_table_mrrm {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u8 max_mem_region;	/* Max Memory Regions supported */
+	u8 flags;		/* Region assignment type */
+	u8 reserved[26];
+	u8 memory_range_entry[];
+};
+
+/* Flags */
+#define ACPI_MRRM_FLAGS_REGION_ASSIGNMENT_OS    (1<<0)
+
+/*******************************************************************************
+ *
+ * Memory Range entry - Memory Range entry in MRRM table
+ *
+ ******************************************************************************/
+
+struct acpi_table_mrrm_mem_range_entry {
+	ACPI_SUBTABLE_HEADER_16 header;
+	u32 reserved0;		/* Reserved */
+	u64 addr_base;		/* Base addr of the mem range */
+	u64 addr_len;		/* Length of the mem range */
+	u16 region_id_flags;	/* Valid local or remote Region-ID */
+	u8 local_region_id;	/* Platform-assigned static local Region-ID */
+	u8 remote_region_id;	/* Platform-assigned static remote Region-ID */
+	u32 reserved1;		/* Reserved */
+	/* Region-ID Programming Registers[] */
+};
+
+/* Values for region_id_flags above */
+#define ACPI_MRRM_VALID_REGION_ID_FLAGS_LOCAL   (1<<0)
+#define ACPI_MRRM_VALID_REGION_ID_FLAGS_REMOTE  (1<<1)
+
 /*******************************************************************************
  *
  * MSDM - Microsoft Data Management table
-- 
2.43.0





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

* [PATCH v1 07/19] ACPICA: actbl2: Add definitions for RIMT
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (5 preceding siblings ...)
  2025-04-25 19:24 ` [PATCH v1 06/19] ACPICA: actbl2.h: MRRM: Add typedef and other definitions Rafael J. Wysocki
@ 2025-04-25 19:24 ` Rafael J. Wysocki
  2025-04-25 19:25 ` [PATCH v1 08/19] ACPICA: MRRM: Some cleanups Rafael J. Wysocki
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:24 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Sunil V L <sunilvl@ventanamicro.com>

ACPICA commit 73c32bc89cad64ab19c1231a202361e917e6823c

RISC-V IO Mapping Table (RIMT) is a new static table defined for RISC-V
to communicate IOMMU information to the OS. The specification for RIMT
is available at [1]. Add structure definitions for RIMT.

[1] - https://github.com/riscv-non-isa/riscv-acpi-rimt

Link: https://github.com/acpica/acpica/commit/73c32bc8
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actbl2.h | 83 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 4fd5e8b2e199..0ae9d9915d58 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -51,6 +51,7 @@
 #define ACPI_SIG_RAS2           "RAS2"	/* RAS2 Feature table */
 #define ACPI_SIG_RGRT           "RGRT"	/* Regulatory Graphics Resource Table */
 #define ACPI_SIG_RHCT           "RHCT"	/* RISC-V Hart Capabilities Table */
+#define ACPI_SIG_RIMT           "RIMT"	/* RISC-V IO Mapping Table */
 #define ACPI_SIG_SBST           "SBST"	/* Smart Battery Specification Table */
 #define ACPI_SIG_SDEI           "SDEI"	/* Software Delegated Exception Interface Table */
 #define ACPI_SIG_SDEV           "SDEV"	/* Secure Devices table */
@@ -3042,6 +3043,88 @@ struct acpi_rhct_hart_info {
 	u32 uid;		/* ACPI processor UID */
 };
 
+/*******************************************************************************
+ *
+ * RIMT - RISC-V IO Remapping Table
+ *
+ * https://github.com/riscv-non-isa/riscv-acpi-rimt
+ *
+ ******************************************************************************/
+
+struct acpi_table_rimt {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u32 num_nodes;		/* Number of RIMT Nodes */
+	u32 node_offset;	/* Offset to RIMT Node Array */
+	u32 reserved;
+};
+
+struct acpi_rimt_node {
+	u8 type;
+	u8 revision;
+	u16 length;
+	u16 reserved;
+	u16 id;
+	char node_data[];
+};
+
+enum acpi_rimt_node_type {
+	ACPI_RIMT_NODE_TYPE_IOMMU = 0x0,
+	ACPI_RIMT_NODE_TYPE_PCIE_ROOT_COMPLEX = 0x1,
+	ACPI_RIMT_NODE_TYPE_PLAT_DEVICE = 0x2,
+};
+
+struct acpi_rimt_iommu {
+	u8 hardware_id[8];	/* Hardware ID */
+	u64 base_address;	/* Base Address */
+	u32 flags;		/* Flags */
+	u32 proximity_domain;	/* Proximity Domain */
+	u16 pcie_segment_number;	/* PCIe Segment number */
+	u16 pcie_bdf;		/* PCIe B/D/F */
+	u16 num_interrupt_wires;	/* Number of interrupt wires */
+	u16 interrupt_wire_offset;	/* Interrupt wire array offset */
+	u64 interrupt_wire[];	/* Interrupt wire array */
+};
+
+/* IOMMU Node Flags */
+#define ACPI_RIMT_IOMMU_FLAGS_PCIE      (1)
+#define ACPI_RIMT_IOMMU_FLAGS_PXM_VALID (1 << 1)
+
+/* Interrupt Wire Structure */
+struct acpi_rimt_iommu_wire_gsi {
+	u32 irq_num;		/* Interrupt Number */
+	u32 flags;		/* Flags */
+};
+
+/* Interrupt Wire Flags */
+#define ACPI_RIMT_GSI_LEVEL_TRIGGERRED  (1)
+#define ACPI_RIMT_GSI_ACTIVE_HIGH       (1 << 1)
+
+struct acpi_rimt_id_mapping {
+	u32 source_id_base;	/* Source ID Base */
+	u32 num_ids;		/* Number of IDs */
+	u32 dest_id_base;	/* Destination Device ID Base */
+	u32 dest_offset;	/* Destination IOMMU Offset */
+	u32 flags;		/* Flags */
+};
+
+struct acpi_rimt_pcie_rc {
+	u32 flags;		/* Flags */
+	u16 reserved;		/* Reserved */
+	u16 pcie_segment_number;	/* PCIe Segment number */
+	u16 id_mapping_offset;	/* ID mapping array offset */
+	u16 num_id_mappings;	/* Number of ID mappings */
+};
+
+/* PCIe Root Complex Node Flags */
+#define ACPI_RIMT_PCIE_ATS_SUPPORTED   (1)
+#define ACPI_RIMT_PCIE_PRI_SUPPORTED   (1 << 1)
+
+struct acpi_rimt_platform_device {
+	u16 id_mapping_offset;	/* ID Mapping array offset */
+	u16 num_id_mappings;	/* Number of ID mappings */
+	char device_name[];	/* Device Object Name */
+};
+
 /*******************************************************************************
  *
  * SBST - Smart Battery Specification Table
-- 
2.43.0





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

* [PATCH v1 08/19] ACPICA: MRRM: Some cleanups
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (6 preceding siblings ...)
  2025-04-25 19:24 ` [PATCH v1 07/19] ACPICA: actbl2: Add definitions for RIMT Rafael J. Wysocki
@ 2025-04-25 19:25 ` Rafael J. Wysocki
  2025-04-25 19:26 ` [PATCH v1 09/19] ACPICA: Utilities: Fix spelling mistake "Incremement" -> "Increment" Rafael J. Wysocki
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:25 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Tony Luck <tony.luck@intel.com>

ACPICA commit 022e2e4169841f429dbda677a4780830bf4c2177

 1) Added source specification to MRRM table comment in actbl2.h

 2) Shorten typedef from ACPI_TABLE_MRRM_MEM_RANGE_ENTRY to
    struct acpi_mrrm_mem_range_entry

 3) Add new typedefs to source/tools/acpisrc/astable.c

 4) Fix cut and paste errors in acpi_dm_table_info_mrrm0[] definition

 5) Fix indent and source code style errors in actbl2.h

 6) The base/length fields in the memory range structure are system
    memory addresses, not "MMIO". Update the acpi_dm_table_info_mrrm0[]
    strings.

 7) Add main/sub table comments to acpi_dm_dump_mrrm() and dt_compile_mrrm()

Link: https://github.com/acpica/acpica/commit/022e2e41
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actbl2.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 0ae9d9915d58..274b3b85b6d7 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -1741,6 +1741,8 @@ struct acpi_msct_proximity {
 /*******************************************************************************
  *
  * MRRM - Memory Range and Region Mapping (MRRM) table
+ * Conforms to "Intel Resource Director Technology Architecture Specification"
+ * Version 1.1, January 2025
  *
  ******************************************************************************/
 
@@ -1756,13 +1758,13 @@ struct acpi_table_mrrm {
 #define ACPI_MRRM_FLAGS_REGION_ASSIGNMENT_OS    (1<<0)
 
 /*******************************************************************************
- *
- * Memory Range entry - Memory Range entry in MRRM table
- *
- ******************************************************************************/
+	*
+	* Memory Range entry - Memory Range entry in MRRM table
+	*
+	******************************************************************************/
 
-struct acpi_table_mrrm_mem_range_entry {
-	ACPI_SUBTABLE_HEADER_16 header;
+struct acpi_mrrm_mem_range_entry {
+	struct acpi_subtable_header_16 header;
 	u32 reserved0;		/* Reserved */
 	u64 addr_base;		/* Base addr of the mem range */
 	u64 addr_len;		/* Length of the mem range */
-- 
2.43.0





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

* [PATCH v1 09/19] ACPICA: Utilities: Fix spelling mistake "Incremement"  -> "Increment"
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (7 preceding siblings ...)
  2025-04-25 19:25 ` [PATCH v1 08/19] ACPICA: MRRM: Some cleanups Rafael J. Wysocki
@ 2025-04-25 19:26 ` Rafael J. Wysocki
  2025-04-25 19:26 ` [PATCH v1 10/19] ACPICA: infrastructure: Add new DMT_BUF types and shorten a long name Rafael J. Wysocki
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:26 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Colin Ian King <colin.i.king@gmail.com>

ACPICA commit 0faa6e20cfe56fdaefc37a38f8fd04e3137fcdad

There is a spelling mistake in a literal string. Fix it.

Fixes: a171306ed1a1 ("Reference count: add additional debugging details)

Link: https://github.com/acpica/acpica/commit/0faa6e20
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpica/utdelete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index c85bfa13ac1e..e8180099d01f 100644
--- a/drivers/acpi/acpica/utdelete.c
+++ b/drivers/acpi/acpica/utdelete.c
@@ -404,7 +404,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
 				  object, object->common.type,
 				  acpi_ut_get_object_type_name(object),
 				  new_count));
-		message = "Incremement";
+		message = "Increment";
 		break;
 
 	case REF_DECREMENT:
-- 
2.43.0





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

* [PATCH v1 10/19] ACPICA: infrastructure: Add new DMT_BUF types and  shorten a long name
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (8 preceding siblings ...)
  2025-04-25 19:26 ` [PATCH v1 09/19] ACPICA: Utilities: Fix spelling mistake "Incremement" -> "Increment" Rafael J. Wysocki
@ 2025-04-25 19:26 ` Rafael J. Wysocki
  2025-04-25 19:27 ` [PATCH v1 11/19] ACPICA: actbl2.h: ERDT: Add typedef and other definitions Rafael J. Wysocki
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:26 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Tony Luck <tony.luck@intel.com>

ACPICA commit b8713f71b4023a0396fe61503bbbf5226e5eed1b

Some ERDT subtables have 11 and 24 byte reserved fields.

Add the ACPI_DMT_BUF11 and ACPI_DMT_BUF24 types to describe these reserved
fields in struct acpi_dmtable_info structures.

Shorten the ACPI_SUBTABLE_HEADER_16 name to ACPI_SUBTBL_HDR

Link: https://github.com/acpica/acpica/commit/b8713f71
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actbl1.h | 2 +-
 include/acpi/actbl2.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index b403b0b60bf6..6d2cc181e3a4 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -157,7 +157,7 @@ struct acpi_aspt_acpi_mbox_regs {
 
 /* Larger subtable header (when Length can exceed 255) */
 
-struct acpi_subtable_header_16 {
+struct acpi_subtbl_hdr_16 {
 	u16 type;
 	u16 length;
 };
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 274b3b85b6d7..2c07b097ef9f 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -1764,7 +1764,7 @@ struct acpi_table_mrrm {
 	******************************************************************************/
 
 struct acpi_mrrm_mem_range_entry {
-	struct acpi_subtable_header_16 header;
+	struct acpi_subtbl_hdr_16 header;
 	u32 reserved0;		/* Reserved */
 	u64 addr_base;		/* Base addr of the mem range */
 	u64 addr_len;		/* Length of the mem range */
-- 
2.43.0





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

* [PATCH v1 11/19] ACPICA: actbl2.h: ERDT: Add typedef and other  definitions
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (9 preceding siblings ...)
  2025-04-25 19:26 ` [PATCH v1 10/19] ACPICA: infrastructure: Add new DMT_BUF types and shorten a long name Rafael J. Wysocki
@ 2025-04-25 19:27 ` Rafael J. Wysocki
  2025-04-25 19:27 ` [PATCH v1 12/19] ACPICA: Introduce ACPI_NONSTRING Rafael J. Wysocki
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:27 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Tony Luck <tony.luck@intel.com>

ACPICA commit dddd9270531d74af523afa68515d8aae6a18bbe0

The ERDT table (and its many subtables) enumerate capabilities
and methods for Intel Resource Director Technology to monitor
and control L3 cache allocation and memory bandwidth by CPU
cores and IO devices.

Structure defined in the Intel Resource Director Technology (RDT)
Architecture specification downloadable from www.intel.com/sdm

Link: https://github.com/acpica/acpica/commit/dddd9270
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actbl2.h | 190 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 190 insertions(+)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 2c07b097ef9f..ccbf543bceeb 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -29,6 +29,7 @@
 #define ACPI_SIG_BDAT           "BDAT"	/* BIOS Data ACPI Table */
 #define ACPI_SIG_CCEL           "CCEL"	/* CC Event Log Table */
 #define ACPI_SIG_CDAT           "CDAT"	/* Coherent Device Attribute Table */
+#define ACPI_SIG_ERDT           "ERDT"	/* Enhanced Resource Director Technology */
 #define ACPI_SIG_IORT           "IORT"	/* IO Remapping Table */
 #define ACPI_SIG_IVRS           "IVRS"	/* I/O Virtualization Reporting Structure */
 #define ACPI_SIG_LPIT           "LPIT"	/* Low Power Idle Table */
@@ -450,6 +451,195 @@ struct acpi_table_ccel {
 	u64 log_area_start_address;
 };
 
+/*******************************************************************************
+ *
+ * ERDT - Enhanced Resource Director Technology (ERDT) table
+ *
+ * Conforms to "Intel Resource Director Technology Architecture Specification"
+ * Version 1.1, January 2025
+ *
+ ******************************************************************************/
+
+struct acpi_table_erdt {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u32 max_clos;		/* Maximum classes of service */
+	u8 reserved[24];
+	u8 erdt_substructures[];
+};
+
+/* Values for subtable type in struct acpi_subtbl_hdr_16 */
+
+enum acpi_erdt_type {
+	ACPI_ERDT_TYPE_RMDD = 0,
+	ACPI_ERDT_TYPE_CACD = 1,
+	ACPI_ERDT_TYPE_DACD = 2,
+	ACPI_ERDT_TYPE_CMRC = 3,
+	ACPI_ERDT_TYPE_MMRC = 4,
+	ACPI_ERDT_TYPE_MARC = 5,
+	ACPI_ERDT_TYPE_CARC = 6,
+	ACPI_ERDT_TYPE_CMRD = 7,
+	ACPI_ERDT_TYPE_IBRD = 8,
+	ACPI_ERDT_TYPE_IBAD = 9,
+	ACPI_ERDT_TYPE_CARD = 10,
+	ACPI_ERDT_TYPE_RESERVED = 11	/* 11 and above are reserved */
+};
+
+/*
+ * ERDT Subtables, correspond to Type in struct acpi_subtbl_hdr_16
+ */
+
+/* 0: RMDD - Resource Management Domain Description */
+
+struct acpi_erdt_rmdd {
+	struct acpi_subtbl_hdr_16 header;
+	u16 flags;
+	u16 IO_l3_slices;	/* Number of slices in IO cache */
+	u8 IO_l3_sets;		/* Number of sets in IO cache */
+	u8 IO_l3_ways;		/* Number of ways in IO cache */
+	u64 reserved;
+	u16 domain_id;		/* Unique domain ID */
+	u32 max_rmid;		/* Maximun RMID supported */
+	u64 creg_base;		/* Control Register Base Address */
+	u16 creg_size;		/* Control Register Size (4K pages) */
+	u8 rmdd_structs[];
+};
+
+/* 1: CACD - CPU Agent Collection Description */
+
+struct acpi_erdt_cacd {
+	struct acpi_subtbl_hdr_16 header;
+	u16 reserved;
+	u16 domain_id;		/* Unique domain ID */
+	u32 X2APICIDS[];
+};
+
+/* 2: DACD - Device Agent Collection Description */
+
+struct acpi_erdt_dacd {
+	struct acpi_subtbl_hdr_16 header;
+	u16 reserved;
+	u16 domain_id;		/* Unique domain ID */
+	u8 dev_paths[];
+};
+
+struct acpi_erdt_dacd_dev_paths {
+	struct acpi_subtable_header header;
+	u16 segment;
+	u8 reserved;
+	u8 start_bus;
+	u8 path[];
+};
+
+/* 3: CMRC - Cache Monitoring Registers for CPU Agents */
+
+struct acpi_erdt_cmrc {
+	struct acpi_subtbl_hdr_16 header;
+	u32 reserved1;
+	u32 flags;
+	u8 index_fn;
+	u8 reserved2[11];
+	u64 cmt_reg_base;
+	u32 cmt_reg_size;
+	u16 clump_size;
+	u16 clump_stride;
+	u64 up_scale;
+};
+
+/* 4: MMRC - Memory-bandwidth Monitoring Registers for CPU Agents */
+
+struct acpi_erdt_mmrc {
+	struct acpi_subtbl_hdr_16 header;
+	u32 reserved1;
+	u32 flags;
+	u8 index_fn;
+	u8 reserved2[11];
+	u64 reg_base;
+	u32 reg_size;
+	u8 counter_width;
+	u64 up_scale;
+	u8 reserved3[7];
+	u32 corr_factor_list_len;
+	u32 corr_factor_list[];
+};
+
+/* 5: MARC - Memory-bandwidth Allocation Registers for CPU Agents */
+
+struct acpi_erdt_marc {
+	struct acpi_subtbl_hdr_16 header;
+	u16 reserved1;
+	u16 flags;
+	u8 index_fn;
+	u8 reserved2[7];
+	u64 reg_base_opt;
+	u64 reg_base_min;
+	u64 reg_base_max;
+	u32 mba_reg_size;
+	u32 mba_ctrl_range;
+};
+
+/* 6: CARC - Cache Allocation Registers for CPU Agents */
+
+struct acpi_erdt_carc {
+	struct acpi_subtbl_hdr_16 header;
+};
+
+/* 7: CMRD - Cache Monitoring Registers for Device Agents */
+
+struct acpi_erdt_cmrd {
+	struct acpi_subtbl_hdr_16 header;
+	u32 reserved1;
+	u32 flags;
+	u8 index_fn;
+	u8 reserved2[11];
+	u64 reg_base;
+	u32 reg_size;
+	u16 cmt_reg_off;
+	u16 cmt_clump_size;
+	u64 up_scale;
+};
+
+/* 8: IBRD - Cache Monitoring Registers for Device Agents */
+
+struct acpi_erdt_ibrd {
+	struct acpi_subtbl_hdr_16 header;
+	u32 reserved1;
+	u32 flags;
+	u8 index_fn;
+	u8 reserved2[11];
+	u64 reg_base;
+	u32 reg_size;
+	u16 total_bw_offset;
+	u16 Iomiss_bw_offset;
+	u16 total_bw_clump;
+	u16 Iomiss_bw_clump;
+	u8 reserved3[7];
+	u8 counter_width;
+	u64 up_scale;
+	u32 corr_factor_list_len;
+	u32 corr_factor_list[];
+};
+
+/* 9: IBAD - IO bandwidth Allocation Registers for device agents */
+
+struct acpi_erdt_ibad {
+	struct acpi_subtbl_hdr_16 header;
+};
+
+/* 10: CARD - IO bandwidth Allocation Registers for Device Agents */
+
+struct acpi_erdt_card {
+	struct acpi_subtbl_hdr_16 header;
+	u32 reserved1;
+	u32 flags;
+	u32 contention_mask;
+	u8 index_fn;
+	u8 reserved2[7];
+	u64 reg_base;
+	u32 reg_size;
+	u16 cat_reg_offset;
+	u16 cat_reg_block_size;
+};
+
 /*******************************************************************************
  *
  * IORT - IO Remapping Table
-- 
2.43.0





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

* [PATCH v1 12/19] ACPICA: Introduce ACPI_NONSTRING
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (10 preceding siblings ...)
  2025-04-25 19:27 ` [PATCH v1 11/19] ACPICA: actbl2.h: ERDT: Add typedef and other definitions Rafael J. Wysocki
@ 2025-04-25 19:27 ` Rafael J. Wysocki
  2025-04-30 18:35   ` Kees Cook
  2025-04-25 19:28 ` [PATCH v1 13/19] ACPICA: Apply ACPI_NONSTRING Rafael J. Wysocki
                   ` (6 subsequent siblings)
  18 siblings, 1 reply; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:27 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Kees Cook <kees@kernel.org>

ACPICA commit 878823ca20f1987cba0c9d4c1056be0d117ea4fe

In order to distinguish character arrays from C Strings (i.e. strings with
a terminating NUL character), add support for the "nonstring" attribute
provided by GCC. (A better name might be "ACPI_NONCSTRING", but that's
the attribute name, so stick to the existing naming convention.)

GCC 15's -Wunterminated-string-initialization will warn about truncation
of the NUL byte for string initializers unless the destination is marked
with "nonstring". Prepare for applying this attribute to the project.

Link: https://github.com/acpica/acpica/commit/878823ca
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actypes.h        | 4 ++++
 include/acpi/platform/acgcc.h | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 80767e8bf3ad..f7b3c4a4b7e7 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -1327,4 +1327,8 @@ typedef enum {
 #define ACPI_FLEX_ARRAY(TYPE, NAME)     TYPE NAME[0]
 #endif
 
+#ifndef ACPI_NONSTRING
+#define ACPI_NONSTRING		/* No terminating NUL character */
+#endif
+
 #endif				/* __ACTYPES_H__ */
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 04b4bf620517..68e9379623e6 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -72,4 +72,12 @@
                 TYPE NAME[];                    \
         }
 
+/*
+ * Explicitly mark strings that lack a terminating NUL character so
+ * that ACPICA can be built with -Wunterminated-string-initialization.
+ */
+#if __has_attribute(__nonstring__)
+#define ACPI_NONSTRING __attribute__((__nonstring__))
+#endif
+
 #endif				/* __ACGCC_H__ */
-- 
2.43.0





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

* [PATCH v1 13/19] ACPICA: Apply ACPI_NONSTRING
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (11 preceding siblings ...)
  2025-04-25 19:27 ` [PATCH v1 12/19] ACPICA: Introduce ACPI_NONSTRING Rafael J. Wysocki
@ 2025-04-25 19:28 ` Rafael J. Wysocki
  2025-04-25 19:29 ` [PATCH v1 14/19] ACPICA: actbl2.h: ACPI 6.5: RAS2: Rename structure and field names of the RAS2 table Rafael J. Wysocki
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:28 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Kees Cook <kees@kernel.org>

ACPICA commit ed68cb8e082e3bfbba02814af4fd5a61247f491b

Add ACPI_NONSTRING annotations for places found that are using char
arrays without a terminating NUL character. These were found during
Linux kernel builds and after looking for instances of arrays of size
ACPI_NAMESEG_SIZE.

Link: https://github.com/acpica/acpica/commit/ed68cb8e
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpica/aclocal.h   | 4 ++--
 drivers/acpi/acpica/nsnames.c   | 2 +-
 drivers/acpi/acpica/nsrepair2.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 6481c48c22bb..b40e9a520618 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -293,7 +293,7 @@ acpi_status (*acpi_internal_method) (struct acpi_walk_state * walk_state);
  * expected_return_btypes - Allowed type(s) for the return value
  */
 struct acpi_name_info {
-	char name[ACPI_NAMESEG_SIZE] __nonstring;
+	char name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;
 	u16 argument_list;
 	u8 expected_btypes;
 };
@@ -370,7 +370,7 @@ typedef acpi_status (*acpi_object_converter) (struct acpi_namespace_node *
 					      converted_object);
 
 struct acpi_simple_repair_info {
-	char name[ACPI_NAMESEG_SIZE] __nonstring;
+	char name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;
 	u32 unexpected_btypes;
 	u32 package_index;
 	acpi_object_converter object_converter;
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index d91153f65700..22aeeeb56cff 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -194,7 +194,7 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node,
 			      char *full_path, u32 path_size, u8 no_trailing)
 {
 	u32 length = 0, i;
-	char name[ACPI_NAMESEG_SIZE];
+	char name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;
 	u8 do_no_trailing;
 	char c, *left, *right;
 	struct acpi_namespace_node *next_node;
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 330b5e4711da..0075fc80d498 100644
--- a/drivers/acpi/acpica/nsrepair2.c
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -25,7 +25,7 @@ acpi_status (*acpi_repair_function) (struct acpi_evaluate_info * info,
 				     return_object_ptr);
 
 typedef struct acpi_repair_info {
-	char name[ACPI_NAMESEG_SIZE] __nonstring;
+	char name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;
 	acpi_repair_function repair_function;
 
 } acpi_repair_info;
-- 
2.43.0





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

* [PATCH v1 14/19] ACPICA: actbl2.h: ACPI 6.5: RAS2: Rename structure and field names of the RAS2 table
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (12 preceding siblings ...)
  2025-04-25 19:28 ` [PATCH v1 13/19] ACPICA: Apply ACPI_NONSTRING Rafael J. Wysocki
@ 2025-04-25 19:29 ` Rafael J. Wysocki
  2025-04-25 19:29 ` [PATCH v1 15/19] ACPICA: Adjust the position of code lines Rafael J. Wysocki
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:29 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Shiju Jose <shiju.jose@huawei.com>

ACPICA commit 2c8a38f747de9d977491a494faf0dfaf799b777b

Rename the structure and field names of the RAS2 table to shorten them and
avoid long lines in the ACPI RAS2 drivers.

 1. struct acpi_ras2_shared_memory to struct acpi_ras2_shmem

 2. In struct acpi_ras2_shared_memory: fields,
    - set_capabilities[16] to set_caps[16]
    - num_parameter_blocks to num_param_blks
    - set_capabilities_status to set_caps_status

 3. struct acpi_ras2_patrol_scrub_parameter to
    struct acpi_ras2_patrol_scrub_param

 4. In struct acpi_ras2_patrol_scrub_parameter: fields,
    - patrol_scrub_command to command
    - requested_address_range to req_addr_range
    - actual_address_range to actl_addr_range

Link: https://github.com/acpica/acpica/commit/2c8a38f7
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actbl2.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index ccbf543bceeb..3c2c0730165d 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -3035,15 +3035,15 @@ struct acpi_ras2_pcc_desc {
 
 /* RAS2 Platform Communication Channel Shared Memory Region */
 
-struct acpi_ras2_shared_memory {
+struct acpi_ras2_shmem {
 	u32 signature;
 	u16 command;
 	u16 status;
 	u16 version;
 	u8 features[16];
-	u8 set_capabilities[16];
-	u16 num_parameter_blocks;
-	u32 set_capabilities_status;
+	u8 set_caps[16];
+	u16 num_param_blks;
+	u32 set_caps_status;
 };
 
 /* RAS2 Parameter Block Structure for PATROL_SCRUB */
@@ -3056,11 +3056,11 @@ struct acpi_ras2_parameter_block {
 
 /* RAS2 Parameter Block Structure for PATROL_SCRUB */
 
-struct acpi_ras2_patrol_scrub_parameter {
+struct acpi_ras2_patrol_scrub_param {
 	struct acpi_ras2_parameter_block header;
-	u16 patrol_scrub_command;
-	u64 requested_address_range[2];
-	u64 actual_address_range[2];
+	u16 command;
+	u64 req_addr_range[2];
+	u64 actl_addr_range[2];
 	u32 flags;
 	u32 scrub_params_out;
 	u32 scrub_params_in;
-- 
2.43.0





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

* [PATCH v1 15/19] ACPICA: Adjust the position of code lines
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (13 preceding siblings ...)
  2025-04-25 19:29 ` [PATCH v1 14/19] ACPICA: actbl2.h: ACPI 6.5: RAS2: Rename structure and field names of the RAS2 table Rafael J. Wysocki
@ 2025-04-25 19:29 ` Rafael J. Wysocki
  2025-04-25 19:30 ` [PATCH v1 16/19] ACPICA: Avoid sequence overread in call to strncmp() Rafael J. Wysocki
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:29 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Zhe Qiao <qiaozhe@iscas.ac.cn>

ACPICA commit 5da6daf5691169d2bf2e5c9e55baf093757312ca

In the acpica/utcache.c file, adjust the position of the
"ACPI_MEM_TRACKING(cache->total_allocated++);" code line
to ensure that the increment operation on total_allocated
is included within the ACPI_DBG_TRACK_ALLOCATIONS configuration.

Link: https://github.com/acpica/acpica/commit/5da6daf5
Signed-off-by: Zhe Qiao <qiaozhe@iscas.ac.cn>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpica/utcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c
index 85a85f7cf750..046e6ba127d4 100644
--- a/drivers/acpi/acpica/utcache.c
+++ b/drivers/acpi/acpica/utcache.c
@@ -251,9 +251,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
 	} else {
 		/* The cache is empty, create a new object */
 
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 		ACPI_MEM_TRACKING(cache->total_allocated++);
 
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 		if ((cache->total_allocated - cache->total_freed) >
 		    cache->max_occupied) {
 			cache->max_occupied =
-- 
2.43.0





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

* [PATCH v1 16/19] ACPICA: Avoid sequence overread in call to strncmp()
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (14 preceding siblings ...)
  2025-04-25 19:29 ` [PATCH v1 15/19] ACPICA: Adjust the position of code lines Rafael J. Wysocki
@ 2025-04-25 19:30 ` Rafael J. Wysocki
  2025-04-25 19:31 ` [PATCH v1 17/19] ACPICA: Apply ACPI_NONSTRING in more places Rafael J. Wysocki
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:30 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Ahmed Salem <x0rw3ll@gmail.com>

ACPICA commit 8b83a8d88dfec59ea147fad35fc6deea8859c58c

ap_get_table_length() checks if tables are valid by
calling ap_is_valid_header(). The latter then calls
ACPI_VALIDATE_RSDP_SIG(Table->Signature).

ap_is_valid_header() accepts struct acpi_table_header as an argument, so
the signature size is always fixed to 4 bytes.

The problem is when the string comparison is between ACPI-defined table
signature and ACPI_SIG_RSDP. Common ACPI table header specifies the
Signature field to be 4 bytes long[1], with the exception of the RSDP
structure whose signature is 8 bytes long "RSD PTR " (including the
trailing blank character)[2]. Calling strncmp(sig, rsdp_sig, 8) would
then result in a sequence overread[3] as sig would be smaller (4 bytes)
than the specified bound (8 bytes).

As a workaround, pass the bound conditionally based on the size of the
signature being passed.

Link: https://uefi.org/specs/ACPI/6.5_A/05_ACPI_Software_Programming_Model.html#system-description-table-header [1]
Link: https://uefi.org/specs/ACPI/6.5_A/05_ACPI_Software_Programming_Model.html#root-system-description-pointer-rsdp-structure [2]
Link: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overread [3]
Link: https://github.com/acpica/acpica/commit/8b83a8d8
Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/actypes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index f7b3c4a4b7e7..5b9f9a612548 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -527,7 +527,7 @@ typedef u64 acpi_integer;
 
 /* Support for the special RSDP signature (8 characters) */
 
-#define ACPI_VALIDATE_RSDP_SIG(a)       (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
+#define ACPI_VALIDATE_RSDP_SIG(a)       (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, (sizeof(a) < 8) ? ACPI_NAMESEG_SIZE : 8))
 #define ACPI_MAKE_RSDP_SIG(dest)        (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
 
 /* Support for OEMx signature (x can be any character) */
-- 
2.43.0





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

* [PATCH v1 17/19] ACPICA: Apply ACPI_NONSTRING in more places
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (15 preceding siblings ...)
  2025-04-25 19:30 ` [PATCH v1 16/19] ACPICA: Avoid sequence overread in call to strncmp() Rafael J. Wysocki
@ 2025-04-25 19:31 ` Rafael J. Wysocki
  2025-04-25 19:32 ` [PATCH v1 18/19] ACPICA: Replace strncpy() with memcpy() Rafael J. Wysocki
  2025-04-25 19:33 ` [PATCH v1 19/19] ACPICA: Logfile: Changes for version 20250404 Rafael J. Wysocki
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:31 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Ahmed Salem <x0rw3ll@gmail.com>

ACPICA commit 1035a3d453f7dd49a235a59ee84ebda9d2d2f41b

Add ACPI_NONSTRING for destination char arrays without a terminating NUL
character. This is a follow-up to commit 35ad99236f3a ("ACPICA: Apply
ACPI_NONSTRING") where not all instances received the same treatment, in
preparation for replacing strncpy() calls with memcpy()

Link: https://github.com/acpica/acpica/commit/1035a3d4
Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpica/acdebug.h                            | 2 +-
 include/acpi/actbl.h                                     | 6 +++---
 tools/power/acpi/os_specific/service_layers/oslinuxtbl.c | 2 +-
 tools/power/acpi/tools/acpidump/apfiles.c                | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 911875c5a5f1..58842130ca47 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -37,7 +37,7 @@ struct acpi_db_argument_info {
 struct acpi_db_execute_walk {
 	u32 count;
 	u32 max_count;
-	char name_seg[ACPI_NAMESEG_SIZE + 1];
+	char name_seg[ACPI_NAMESEG_SIZE + 1] ACPI_NONSTRING;
 };
 
 #define PARAM_LIST(pl)                  pl
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 2fc89704be17..74cc61e3ab09 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -66,12 +66,12 @@
  ******************************************************************************/
 
 struct acpi_table_header {
-	char signature[ACPI_NAMESEG_SIZE] __nonstring;	/* ASCII table signature */
+	char signature[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;	/* ASCII table signature */
 	u32 length;		/* Length of table in bytes, including this header */
 	u8 revision;		/* ACPI Specification minor version number */
 	u8 checksum;		/* To make sum of entire table == 0 */
-	char oem_id[ACPI_OEM_ID_SIZE];	/* ASCII OEM identification */
-	char oem_table_id[ACPI_OEM_TABLE_ID_SIZE];	/* ASCII OEM table identification */
+	char oem_id[ACPI_OEM_ID_SIZE] ACPI_NONSTRING;	/* ASCII OEM identification */
+	char oem_table_id[ACPI_OEM_TABLE_ID_SIZE] ACPI_NONSTRING;	/* ASCII OEM table identification */
 	u32 oem_revision;	/* OEM revision number */
 	char asl_compiler_id[ACPI_NAMESEG_SIZE];	/* ASCII ASL compiler vendor ID */
 	u32 asl_compiler_revision;	/* ASL compiler version */
diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
index 9d70d8c945af..987a5d32f3b6 100644
--- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
+++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
@@ -19,7 +19,7 @@ ACPI_MODULE_NAME("oslinuxtbl")
 typedef struct osl_table_info {
 	struct osl_table_info *next;
 	u32 instance;
-	char signature[ACPI_NAMESEG_SIZE];
+	char signature[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;
 
 } osl_table_info;
 
diff --git a/tools/power/acpi/tools/acpidump/apfiles.c b/tools/power/acpi/tools/acpidump/apfiles.c
index 13817f9112c0..9fc927fcc22a 100644
--- a/tools/power/acpi/tools/acpidump/apfiles.c
+++ b/tools/power/acpi/tools/acpidump/apfiles.c
@@ -103,7 +103,7 @@ int ap_open_output_file(char *pathname)
 
 int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance)
 {
-	char filename[ACPI_NAMESEG_SIZE + 16];
+	char filename[ACPI_NAMESEG_SIZE + 16] ACPI_NONSTRING;
 	char instance_str[16];
 	ACPI_FILE file;
 	acpi_size actual;
-- 
2.43.0





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

* [PATCH v1 18/19] ACPICA: Replace strncpy() with memcpy()
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (16 preceding siblings ...)
  2025-04-25 19:31 ` [PATCH v1 17/19] ACPICA: Apply ACPI_NONSTRING in more places Rafael J. Wysocki
@ 2025-04-25 19:32 ` Rafael J. Wysocki
  2025-05-07  5:42   ` kernel test robot
  2025-04-25 19:33 ` [PATCH v1 19/19] ACPICA: Logfile: Changes for version 20250404 Rafael J. Wysocki
  18 siblings, 1 reply; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:32 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Ahmed Salem <x0rw3ll@gmail.com>

ACPICA commit 83019b471e1902151e67c588014ba2d09fa099a3

strncpy() is deprecated for NUL-terminated destination buffers[1].

Use memcpy() for length-bounded destinations.

Link: https://github.com/KSPP/linux/issues/90 [1]
Link: https://github.com/acpica/acpica/commit/83019b47
Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpica/exconvrt.c  | 4 ++--
 drivers/acpi/acpica/tbfind.c    | 4 ++--
 drivers/acpi/acpica/utnonansi.c | 2 +-
 include/acpi/actypes.h          | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index bb1be42daee1..399c005aa57b 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -226,8 +226,8 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
 		/* Copy the string to the buffer */
 
 		new_buf = return_desc->buffer.pointer;
-		strncpy((char *)new_buf, (char *)obj_desc->string.pointer,
-			obj_desc->string.length);
+		memcpy((char *)new_buf, (char *)obj_desc->string.pointer,
+		       obj_desc->string.length);
 		break;
 
 	default:
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c
index 1c1b2e284bd9..35f72dffc250 100644
--- a/drivers/acpi/acpica/tbfind.c
+++ b/drivers/acpi/acpica/tbfind.c
@@ -57,8 +57,8 @@ acpi_tb_find_table(char *signature,
 
 	memset(&header, 0, sizeof(struct acpi_table_header));
 	ACPI_COPY_NAMESEG(header.signature, signature);
-	strncpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
-	strncpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
+	memcpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
+	memcpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
 
 	/* Search for the table */
 
diff --git a/drivers/acpi/acpica/utnonansi.c b/drivers/acpi/acpica/utnonansi.c
index ff0802ace19b..803e3e893825 100644
--- a/drivers/acpi/acpica/utnonansi.c
+++ b/drivers/acpi/acpica/utnonansi.c
@@ -168,7 +168,7 @@ void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size)
 {
 	/* Always terminate destination string */
 
-	strncpy(dest, source, dest_size);
+	memcpy(dest, source, dest_size);
 	dest[dest_size - 1] = 0;
 }
 
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 5b9f9a612548..e90ca342d7de 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -522,7 +522,7 @@ typedef u64 acpi_integer;
 #define ACPI_COPY_NAMESEG(dest,src)     (*ACPI_CAST_PTR (u32, (dest)) = *ACPI_CAST_PTR (u32, (src)))
 #else
 #define ACPI_COMPARE_NAMESEG(a,b)       (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAMESEG_SIZE))
-#define ACPI_COPY_NAMESEG(dest,src)     (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAMESEG_SIZE))
+#define ACPI_COPY_NAMESEG(dest,src)     (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAMESEG_SIZE))
 #endif
 
 /* Support for the special RSDP signature (8 characters) */
-- 
2.43.0





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

* [PATCH v1 19/19] ACPICA: Logfile: Changes for version 20250404
  2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
                   ` (17 preceding siblings ...)
  2025-04-25 19:32 ` [PATCH v1 18/19] ACPICA: Replace strncpy() with memcpy() Rafael J. Wysocki
@ 2025-04-25 19:33 ` Rafael J. Wysocki
  18 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-25 19:33 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Bob Moore, Saket Dumbre

From: Saket Dumbre <saket.dumbre@intel.com>

ACPICA commit 52de9040740c562a35244de19d21c0313964c874

Link: https://github.com/acpica/acpica/commit/52de9040
Signed-off-by: Saket Dumbre <saket.dumbre@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/acpi/acpixf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 70f1d1b4d307..b49396aa4058 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -12,7 +12,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20241212
+#define ACPI_CA_VERSION                 0x20250404
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
-- 
2.43.0





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

* Re: [PATCH v1 12/19] ACPICA: Introduce ACPI_NONSTRING
  2025-04-25 19:27 ` [PATCH v1 12/19] ACPICA: Introduce ACPI_NONSTRING Rafael J. Wysocki
@ 2025-04-30 18:35   ` Kees Cook
  2025-04-30 18:49     ` Rafael J. Wysocki
  0 siblings, 1 reply; 27+ messages in thread
From: Kees Cook @ 2025-04-30 18:35 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux ACPI, LKML, Bob Moore, Saket Dumbre

On Fri, Apr 25, 2025 at 09:27:58PM +0200, Rafael J. Wysocki wrote:
> From: Kees Cook <kees@kernel.org>
> 
> ACPICA commit 878823ca20f1987cba0c9d4c1056be0d117ea4fe
> 
> In order to distinguish character arrays from C Strings (i.e. strings with
> a terminating NUL character), add support for the "nonstring" attribute
> provided by GCC. (A better name might be "ACPI_NONCSTRING", but that's
> the attribute name, so stick to the existing naming convention.)
> 
> GCC 15's -Wunterminated-string-initialization will warn about truncation
> of the NUL byte for string initializers unless the destination is marked
> with "nonstring". Prepare for applying this attribute to the project.
> 
> Link: https://github.com/acpica/acpica/commit/878823ca
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Whoops, I missed adding my S-o-b to the original upstream ACPICA commit.
Please consider this:

Signed-off-by: Kees Cook <kees@kernel.org>

-- 
Kees Cook

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

* Re: [PATCH v1 02/19] ACPICA: Apply pack(1) to union aml_resource
  2025-04-25 19:21 ` [PATCH v1 02/19] ACPICA: Apply pack(1) to union aml_resource Rafael J. Wysocki
@ 2025-04-30 18:48   ` Tamir Duberstein
  2025-04-30 18:48   ` [PATCH 0/0] Cover letter only Tamir Duberstein
  1 sibling, 0 replies; 27+ messages in thread
From: Tamir Duberstein @ 2025-04-30 18:48 UTC (permalink / raw)
  To: rjw; +Cc: linux-acpi, linux-kernel, robert.moore, saket.dumbre,
	Tamir Duberstein

Signed-off-by: Tamir Duberstein <tamird@gmail.com>

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

* [PATCH 0/0] Cover letter only
  2025-04-25 19:21 ` [PATCH v1 02/19] ACPICA: Apply pack(1) to union aml_resource Rafael J. Wysocki
  2025-04-30 18:48   ` Tamir Duberstein
@ 2025-04-30 18:48   ` Tamir Duberstein
  2025-04-30 18:52     ` Tamir Duberstein
  1 sibling, 1 reply; 27+ messages in thread
From: Tamir Duberstein @ 2025-04-30 18:48 UTC (permalink / raw)
  To: rjw; +Cc: linux-acpi, linux-kernel, robert.moore, saket.dumbre



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

* Re: [PATCH v1 12/19] ACPICA: Introduce ACPI_NONSTRING
  2025-04-30 18:35   ` Kees Cook
@ 2025-04-30 18:49     ` Rafael J. Wysocki
  0 siblings, 0 replies; 27+ messages in thread
From: Rafael J. Wysocki @ 2025-04-30 18:49 UTC (permalink / raw)
  To: Kees Cook; +Cc: Rafael J. Wysocki, Linux ACPI, LKML, Bob Moore, Saket Dumbre

On Wed, Apr 30, 2025 at 8:35 PM Kees Cook <kees@kernel.org> wrote:
>
> On Fri, Apr 25, 2025 at 09:27:58PM +0200, Rafael J. Wysocki wrote:
> > From: Kees Cook <kees@kernel.org>
> >
> > ACPICA commit 878823ca20f1987cba0c9d4c1056be0d117ea4fe
> >
> > In order to distinguish character arrays from C Strings (i.e. strings with
> > a terminating NUL character), add support for the "nonstring" attribute
> > provided by GCC. (A better name might be "ACPI_NONCSTRING", but that's
> > the attribute name, so stick to the existing naming convention.)
> >
> > GCC 15's -Wunterminated-string-initialization will warn about truncation
> > of the NUL byte for string initializers unless the destination is marked
> > with "nonstring". Prepare for applying this attribute to the project.
> >
> > Link: https://github.com/acpica/acpica/commit/878823ca
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Whoops, I missed adding my S-o-b to the original upstream ACPICA commit.
> Please consider this:
>
> Signed-off-by: Kees Cook <kees@kernel.org>

Added, thanks!

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

* Re: [PATCH 0/0] Cover letter only
  2025-04-30 18:48   ` [PATCH 0/0] Cover letter only Tamir Duberstein
@ 2025-04-30 18:52     ` Tamir Duberstein
  0 siblings, 0 replies; 27+ messages in thread
From: Tamir Duberstein @ 2025-04-30 18:52 UTC (permalink / raw)
  To: rjw; +Cc: linux-acpi, linux-kernel, robert.moore, saket.dumbre

Oops, apologies. Manually replying to an email I wasn't included on
proved tricky.

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

* Re: [PATCH v1 18/19] ACPICA: Replace strncpy() with memcpy()
  2025-04-25 19:32 ` [PATCH v1 18/19] ACPICA: Replace strncpy() with memcpy() Rafael J. Wysocki
@ 2025-05-07  5:42   ` kernel test robot
  0 siblings, 0 replies; 27+ messages in thread
From: kernel test robot @ 2025-05-07  5:42 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: oe-lkp, lkp, Rafael J. Wysocki, linux-acpi, acpica-devel, LKML,
	Bob Moore, Saket Dumbre, oliver.sang



Hello,

kernel test robot noticed "BUG:KASAN:global-out-of-bounds_in_acpi_ut_safe_strncpy" on:

commit: 42d0e849d2f0848ac665486c5b38b5321bce299e ("[PATCH v1 18/19] ACPICA: Replace strncpy() with memcpy()")
url: https://github.com/intel-lab-lkp/linux/commits/Rafael-J-Wysocki/ACPICA-Drop-stale-comment-about-the-header-file-content/20250426-034340
base: https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/all/1910878.atdPhlSkOF@rjwysocki.net/
patch subject: [PATCH v1 18/19] ACPICA: Replace strncpy() with memcpy()

in testcase: boot

config: x86_64-randconfig-103-20250426
compiler: gcc-12
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

(please refer to attached dmesg/kmsg for entire log/backtrace)


+--------------------------------------------------------+------------+------------+
|                                                        | 2d3714d918 | 42d0e849d2 |
+--------------------------------------------------------+------------+------------+
| BUG:KASAN:global-out-of-bounds_in_acpi_ut_safe_strncpy | 0          | 18         |
+--------------------------------------------------------+------------+------------+


If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202505071055.2de34dd7-lkp@intel.com


[ 11.237174][ T1] BUG: KASAN: global-out-of-bounds in acpi_ut_safe_strncpy (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/utnonansi.c:172) 
[   11.237174][    T1] Read of size 16 at addr ffffffffb92c19e0 by task swapper/0/1
[   11.237174][    T1]
[   11.237174][    T1] CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.15.0-rc3-00082-g42d0e849d2f0 #1 PREEMPTLAZY
[   11.237174][    T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[   11.237174][    T1] Call Trace:
[   11.237174][    T1]  <TASK>
[ 11.237174][ T1] dump_stack_lvl (kbuild/obj/consumer/x86_64-randconfig-103-20250426/lib/dump_stack.c:123) 
[ 11.237174][ T1] print_address_description+0x33/0x3d0 
[ 11.237174][ T1] print_report (kbuild/obj/consumer/x86_64-randconfig-103-20250426/mm/kasan/report.c:522) 
[ 11.237174][ T1] ? acpi_ut_safe_strncpy (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/utnonansi.c:172) 
[ 11.237174][ T1] ? kasan_addr_to_slab (kbuild/obj/consumer/x86_64-randconfig-103-20250426/mm/kasan/common.c:37) 
[ 11.237174][ T1] ? acpi_ut_safe_strncpy (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/utnonansi.c:172) 
[ 11.237174][ T1] kasan_report (kbuild/obj/consumer/x86_64-randconfig-103-20250426/mm/kasan/report.c:636) 
[ 11.237174][ T1] ? acpi_ut_safe_strncpy (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/utnonansi.c:172) 
[ 11.237174][ T1] kasan_check_range (kbuild/obj/consumer/x86_64-randconfig-103-20250426/mm/kasan/generic.c:183 kbuild/obj/consumer/x86_64-randconfig-103-20250426/mm/kasan/generic.c:189) 
[ 11.237174][ T1] __asan_memcpy (kbuild/obj/consumer/x86_64-randconfig-103-20250426/mm/kasan/shadow.c:105) 
[ 11.237174][ T1] acpi_ut_safe_strncpy (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/utnonansi.c:172) 
[ 11.237174][ T1] acpi_ps_alloc_op (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/psutils.c:122) 
[ 11.237174][ T1] acpi_ps_create_scope_op (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/psutils.c:34) 
[ 11.237174][ T1] acpi_ps_execute_table (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/psxface.c:249) 
[ 11.237174][ T1] ? acpi_ns_get_normalized_pathname (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/nsnames.c:321 (discriminator 1)) 
[ 11.237174][ T1] acpi_ns_execute_table (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/nsparse.c:120 (discriminator 5)) 
[ 11.237174][ T1] ? acpi_ns_get_attached_data (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/nsparse.c:45) 
[ 11.237174][ T1] ? acpi_ut_add_address_range (kbuild/obj/consumer/x86_64-randconfig-103-20250426/include/linux/sched.h:2268 kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/utaddress.c:56) 
[ 11.237174][ T1] ? acpi_os_signal_semaphore (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/osl.c:1334) 
[ 11.237174][ T1] ? __sanitizer_cov_trace_const_cmp4 (kbuild/obj/consumer/x86_64-randconfig-103-20250426/kernel/kcov.c:316) 
[ 11.237174][ T1] ? acpi_ut_status_exit (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/utdebug.c:474) 
[ 11.237174][ T1] acpi_ns_parse_table (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/nsparse.c:270 (discriminator 5)) 
[ 11.237174][ T1] acpi_ns_load_table (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/nsload.c:72) 
[ 11.237174][ T1] acpi_tb_load_namespace (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/tbxfload.c:159) 
[ 11.237174][ T1] ? acpi_ev_install_region_handlers (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/evhandler.c:101 (discriminator 1)) 
[ 11.237174][ T1] acpi_load_tables (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/acpica/tbxfload.c:63) 
[ 11.237174][ T1] acpi_bus_init (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/bus.c:1344) 
[ 11.237174][ T1] ? acpi_sleep_proc_init (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/bus.c:1337) 
[ 11.237174][ T1] ? kset_create_and_add (kbuild/obj/consumer/x86_64-randconfig-103-20250426/lib/kobject.c:412) 
[ 11.237174][ T1] ? __kasan_kmalloc (kbuild/obj/consumer/x86_64-randconfig-103-20250426/mm/kasan/common.c:377 kbuild/obj/consumer/x86_64-randconfig-103-20250426/mm/kasan/common.c:394) 
[ 11.237174][ T1] ? __sanitizer_cov_trace_const_cmp4 (kbuild/obj/consumer/x86_64-randconfig-103-20250426/kernel/kcov.c:316) 
[ 11.237174][ T1] acpi_init (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/acpi/bus.c:1455) 
[ 11.237174][ T1] ? acpi_arch_init+0x20/0x20 
[ 11.237174][ T1] ? fb_console_init (kbuild/obj/consumer/x86_64-randconfig-103-20250426/drivers/video/fbdev/core/fbcon.c:3368) 
[ 11.237174][ T1] ? acpi_arch_init+0x20/0x20 
[ 11.237174][ T1] do_one_initcall (kbuild/obj/consumer/x86_64-randconfig-103-20250426/init/main.c:1257) 
[ 11.237174][ T1] ? rdinit_setup (kbuild/obj/consumer/x86_64-randconfig-103-20250426/init/main.c:1303) 
[ 11.237174][ T1] ? trace_event_raw_event_initcall_level (kbuild/obj/consumer/x86_64-randconfig-103-20250426/init/main.c:1248) 
[ 11.237174][ T1] ? __kmalloc_noprof (kbuild/obj/consumer/x86_64-randconfig-103-20250426/include/trace/events/kmem.h:54 kbuild/obj/consumer/x86_64-randconfig-103-20250426/mm/slub.c:4342 kbuild/obj/consumer/x86_64-randconfig-103-20250426/mm/slub.c:4353) 
[ 11.237174][ T1] do_initcalls (kbuild/obj/consumer/x86_64-randconfig-103-20250426/init/main.c:1318 kbuild/obj/consumer/x86_64-randconfig-103-20250426/init/main.c:1335) 
[ 11.237174][ T1] kernel_init_freeable (kbuild/obj/consumer/x86_64-randconfig-103-20250426/init/main.c:1569) 
[ 11.237174][ T1] ? rest_init (kbuild/obj/consumer/x86_64-randconfig-103-20250426/init/main.c:1449) 
[ 11.237174][ T1] kernel_init (kbuild/obj/consumer/x86_64-randconfig-103-20250426/init/main.c:1459) 
[ 11.237174][ T1] ? rest_init (kbuild/obj/consumer/x86_64-randconfig-103-20250426/init/main.c:1449) 
[ 11.237174][ T1] ret_from_fork (kbuild/obj/consumer/x86_64-randconfig-103-20250426/arch/x86/kernel/process.c:153) 
[ 11.237174][ T1] ? rest_init (kbuild/obj/consumer/x86_64-randconfig-103-20250426/init/main.c:1449) 
[ 11.237174][ T1] ret_from_fork_asm (kbuild/obj/consumer/x86_64-randconfig-103-20250426/arch/x86/entry/entry_64.S:255) 
[   11.237174][    T1] RIP: 2e66:0x0
[ 11.237174][ T1] Code: Unable to access opcode bytes at 0xffffffffffffffd6.

Code starting with the faulting instruction
===========================================
[   11.237174][    T1] RSP: 0084:0000000000000000 EFLAGS: 841f0f2e660000 ORIG_RAX: 2e66000000000084
[   11.237174][    T1] RAX: 0000000000000000 RBX: 2e66000000000084 RCX: 0000000000841f0f
[   11.237174][    T1] RDX: 000000841f0f2e66 RSI: 00841f0f2e660000 RDI: 1f0f2e6600000000
[   11.237174][    T1] RBP: 1f0f2e6600000000 R08: 1f0f2e6600000000 R09: 00841f0f2e660000
[   11.237174][    T1] R10: 000000841f0f2e66 R11: 0000000000841f0f R12: 00841f0f2e660000
[   11.237174][    T1] R13: 000000841f0f2e66 R14: 0000000000841f0f R15: 2e66000000000084
[   11.237174][    T1]  </TASK>
[   11.237174][    T1]
[   11.237174][    T1] The buggy address belongs to the variable:
[ 11.237174][ T1] _acpi_module_name+0x240/0x20c0 
[   11.237174][    T1]
[   11.237174][    T1] The buggy address belongs to the physical page:
[   11.237174][    T1] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x890c1
[   11.237174][    T1] flags: 0x100000000002000(reserved|node=0|zone=1)
[   11.237174][    T1] raw: 0100000000002000 ffffea0002243048 ffffea0002243048 0000000000000000
[   11.237174][    T1] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
[   11.237174][    T1] page dumped because: kasan: bad access detected
[   11.237174][    T1] page_owner info is not present (never set?)
[   11.237174][    T1]
[   11.237174][    T1] Memory state around the buggy address:
[   11.237174][    T1]  ffffffffb92c1880: f9 f9 f9 f9 05 f9 f9 f9 f9 f9 f9 f9 00 02 f9 f9
[   11.237174][    T1]  ffffffffb92c1900: f9 f9 f9 f9 00 02 f9 f9 f9 f9 f9 f9 00 03 f9 f9
[   11.237174][    T1] >ffffffffb92c1980: f9 f9 f9 f9 07 f9 f9 f9 f9 f9 f9 f9 06 f9 f9 f9
[   11.237174][    T1]                                                        ^
[   11.237174][    T1]  ffffffffb92c1a00: f9 f9 f9 f9 07 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9
[   11.237174][    T1]  ffffffffb92c1a80: f9 f9 f9 f9 07 f9 f9 f9 f9 f9 f9 f9 07 f9 f9 f9
[   11.237174][    T1] ==================================================================


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20250507/202505071055.2de34dd7-lkp@intel.com



-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


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

* Re: [PATCH v1 03/19] ACPICA: utilities: Fix overflow check in vsnprintf()
  2025-04-25 19:21 ` [PATCH v1 03/19] ACPICA: utilities: Fix overflow check in vsnprintf() Rafael J. Wysocki
@ 2025-05-09 21:41   ` gldrk
  0 siblings, 0 replies; 27+ messages in thread
From: gldrk @ 2025-05-09 21:41 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux ACPI, LKML, Bob Moore, Saket Dumbre

Signed-off-by: gldrk <me@rarity.fan>


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

end of thread, other threads:[~2025-05-09 21:40 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-25 19:19 [PATCH v1 00/19] ACPICA: ACPICA 20250404 Rafael J. Wysocki
2025-04-25 19:20 ` [PATCH v1 01/19] ACPICA: Drop stale comment about the header file content Rafael J. Wysocki
2025-04-25 19:21 ` [PATCH v1 02/19] ACPICA: Apply pack(1) to union aml_resource Rafael J. Wysocki
2025-04-30 18:48   ` Tamir Duberstein
2025-04-30 18:48   ` [PATCH 0/0] Cover letter only Tamir Duberstein
2025-04-30 18:52     ` Tamir Duberstein
2025-04-25 19:21 ` [PATCH v1 03/19] ACPICA: utilities: Fix overflow check in vsnprintf() Rafael J. Wysocki
2025-05-09 21:41   ` gldrk
2025-04-25 19:22 ` [PATCH v1 04/19] ACPICA: Interpret SIDP structures in DMAR Rafael J. Wysocki
2025-04-25 19:23 ` [PATCH v1 05/19] ACPICA: infrastructure: Add new header and ACPI_DMT_BUF26 types Rafael J. Wysocki
2025-04-25 19:24 ` [PATCH v1 06/19] ACPICA: actbl2.h: MRRM: Add typedef and other definitions Rafael J. Wysocki
2025-04-25 19:24 ` [PATCH v1 07/19] ACPICA: actbl2: Add definitions for RIMT Rafael J. Wysocki
2025-04-25 19:25 ` [PATCH v1 08/19] ACPICA: MRRM: Some cleanups Rafael J. Wysocki
2025-04-25 19:26 ` [PATCH v1 09/19] ACPICA: Utilities: Fix spelling mistake "Incremement" -> "Increment" Rafael J. Wysocki
2025-04-25 19:26 ` [PATCH v1 10/19] ACPICA: infrastructure: Add new DMT_BUF types and shorten a long name Rafael J. Wysocki
2025-04-25 19:27 ` [PATCH v1 11/19] ACPICA: actbl2.h: ERDT: Add typedef and other definitions Rafael J. Wysocki
2025-04-25 19:27 ` [PATCH v1 12/19] ACPICA: Introduce ACPI_NONSTRING Rafael J. Wysocki
2025-04-30 18:35   ` Kees Cook
2025-04-30 18:49     ` Rafael J. Wysocki
2025-04-25 19:28 ` [PATCH v1 13/19] ACPICA: Apply ACPI_NONSTRING Rafael J. Wysocki
2025-04-25 19:29 ` [PATCH v1 14/19] ACPICA: actbl2.h: ACPI 6.5: RAS2: Rename structure and field names of the RAS2 table Rafael J. Wysocki
2025-04-25 19:29 ` [PATCH v1 15/19] ACPICA: Adjust the position of code lines Rafael J. Wysocki
2025-04-25 19:30 ` [PATCH v1 16/19] ACPICA: Avoid sequence overread in call to strncmp() Rafael J. Wysocki
2025-04-25 19:31 ` [PATCH v1 17/19] ACPICA: Apply ACPI_NONSTRING in more places Rafael J. Wysocki
2025-04-25 19:32 ` [PATCH v1 18/19] ACPICA: Replace strncpy() with memcpy() Rafael J. Wysocki
2025-05-07  5:42   ` kernel test robot
2025-04-25 19:33 ` [PATCH v1 19/19] ACPICA: Logfile: Changes for version 20250404 Rafael J. Wysocki

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).