* 6.16-rc0/regression/bisected - commit ebf27765421c introduced a new warning KASAN: global-out-of-bounds in acpi_ut_safe_strncpy+0x1b
@ 2025-05-29 14:17 Mikhail Gavrilov
2025-05-29 15:15 ` Ahmed Salem
0 siblings, 1 reply; 3+ messages in thread
From: Mikhail Gavrilov @ 2025-05-29 14:17 UTC (permalink / raw)
To: x0rw3ll, rafael.j.wysocki, linux-acpi, Linux List Kernel Mailing,
Linux regressions mailing list
[-- Attachment #1: Type: text/plain, Size: 6383 bytes --]
Hi,
Yesterday, after booting fresh kernel feacb1774bd5,
I spotted a new error message in the kernel log with the following stack trace:
[ 3.032828] ==================================================================
[ 3.032832] BUG: KASAN: global-out-of-bounds in
acpi_ut_safe_strncpy+0x1b/0x60
[ 3.032839] Read of size 16 at addr ffffffffa9d32760 by task swapper/0/1
[ 3.032846] CPU: 16 UID: 0 PID: 1 Comm: swapper/0 Not tainted
6.15.0-feacb1774bd5+ #2 PREEMPT(lazy)
[ 3.032849] Hardware name: ASUS System Product Name/ROG STRIX
B650E-I GAMING WIFI, BIOS 3222 03/05/2025
[ 3.032850] Call Trace:
[ 3.032851] <TASK>
[ 3.032852] dump_stack_lvl+0x84/0xd0
[ 3.032855] ? acpi_ut_safe_strncpy+0x1b/0x60
[ 3.032857] print_address_description.constprop.0+0x88/0x380
[ 3.032859] ? acpi_ut_safe_strncpy+0x1b/0x60
[ 3.032861] print_report+0xfc/0x1ff
[ 3.032862] ? __virt_addr_valid+0x267/0x500
[ 3.032864] ? acpi_ut_safe_strncpy+0x1b/0x60
[ 3.032866] kasan_report+0xb1/0x170
[ 3.032867] ? acpi_ut_safe_strncpy+0x1b/0x60
[ 3.032870] kasan_check_range+0x125/0x200
[ 3.032872] __asan_memcpy+0x23/0x60
[ 3.032874] acpi_ut_safe_strncpy+0x1b/0x60
[ 3.032876] acpi_ps_alloc_op+0x151/0x2f0
[ 3.032878] ? acpi_ns_get_normalized_pathname+0x76/0x1f0
[ 3.032880] acpi_ps_create_scope_op+0x1a/0x70
[ 3.032882] acpi_ps_execute_table+0x82/0x4a0
[ 3.032884] acpi_ns_execute_table+0x53b/0x8d0
[ 3.032885] ? __pfx_acpi_ns_execute_table+0x10/0x10
[ 3.032887] ? acpi_os_signal_semaphore+0xe7/0x140
[ 3.032889] ? acpi_ut_debug_dump_buffer+0x11/0x100
[ 3.032891] ? acpi_ut_release_mutex+0x1ce/0x3a0
[ 3.032893] ? __pfx_acpi_ut_trace+0x10/0x10
[ 3.032895] ? __pfx_acpi_init+0x10/0x10
[ 3.032898] acpi_ns_parse_table+0xa5/0x130
[ 3.032899] acpi_ns_load_table+0x9d/0x3e0
[ 3.032901] acpi_tb_load_namespace+0x25d/0x790
[ 3.032902] ? acpi_ev_install_region_handlers+0xfe/0x180
[ 3.032905] ? __pfx_acpi_init+0x10/0x10
[ 3.032906] acpi_load_tables+0x76/0x110
[ 3.032908] acpi_bus_init+0x83/0x5e0
[ 3.032909] ? __pfx_acpi_bus_init+0x10/0x10
[ 3.032911] ? __pfx_up+0x10/0x10
[ 3.032913] ? __pfx_acpi_pcc_address_space_handler+0x10/0x10
[ 3.032915] ? acpi_ev_install_space_handler+0x469/0x870
[ 3.032917] ? __pfx_acpi_pcc_address_space_setup+0x10/0x10
[ 3.032918] ? acpi_os_signal_semaphore+0xe7/0x140
[ 3.032920] ? acpi_ut_release_mutex+0x1ce/0x3a0
[ 3.032922] ? __pfx_acpi_pcc_address_space_setup+0x10/0x10
[ 3.032923] ? __pfx_acpi_pcc_address_space_handler+0x10/0x10
[ 3.032924] ? acpi_install_address_space_handler_internal+0xc3/0x140
[ 3.032927] acpi_init+0x105/0x290
[ 3.032929] ? __pfx_acpi_init+0x10/0x10
[ 3.032930] ? __pfx_fbmem_init+0x10/0x10
[ 3.032931] ? fbcon_output_notifier.cold+0x4a/0x63
[ 3.032933] do_one_initcall+0xd2/0x450
[ 3.032934] ? __pfx_do_one_initcall+0x10/0x10
[ 3.032936] ? do_initcalls+0x2c/0x240
[ 3.032939] do_initcalls+0x216/0x240
[ 3.032941] kernel_init_freeable+0x299/0x2d0
[ 3.032943] ? __pfx_kernel_init+0x10/0x10
[ 3.032945] kernel_init+0x1c/0x150
[ 3.032946] ? __pfx_kernel_init+0x10/0x10
[ 3.032947] ret_from_fork+0x3ef/0x510
[ 3.032949] ? __pfx_kernel_init+0x10/0x10
[ 3.032950] ? __pfx_kernel_init+0x10/0x10
[ 3.032951] ret_from_fork_asm+0x1a/0x30
[ 3.032954] </TASK>
[ 3.033047] The buggy address belongs to the variable:
[ 3.033049] _acpi_module_name+0x240/0x20c0
[ 3.033055] The buggy address belongs to the physical page:
[ 3.033058] page: refcount:1 mapcount:0 mapping:0000000000000000
index:0x0 pfn:0x67c132
[ 3.033063] flags:
0x17ffffc0002000(reserved|node=0|zone=2|lastcpupid=0x1fffff)
[ 3.033068] raw: 0017ffffc0002000 ffffea0019f04c88 ffffea0019f04c88
0000000000000000
[ 3.033072] raw: 0000000000000000 0000000000000000 00000001ffffffff
0000000000000000
[ 3.033075] page dumped because: kasan: bad access detected
[ 3.033080] Memory state around the buggy address:
[ 3.033082] ffffffffa9d32600: f9 f9 f9 f9 05 f9 f9 f9 f9 f9 f9 f9
00 02 f9 f9
[ 3.033086] ffffffffa9d32680: f9 f9 f9 f9 00 02 f9 f9 f9 f9 f9 f9
00 03 f9 f9
[ 3.033089] >ffffffffa9d32700: f9 f9 f9 f9 07 f9 f9 f9 f9 f9 f9 f9
06 f9 f9 f9
[ 3.033092] ^
[ 3.033095] ffffffffa9d32780: f9 f9 f9 f9 07 f9 f9 f9 f9 f9 f9 f9
00 f9 f9 f9
[ 3.033098] ffffffffa9d32800: f9 f9 f9 f9 07 f9 f9 f9 f9 f9 f9 f9
07 f9 f9 f9
[ 3.033101] ==================================================================
git blame says the first bad commit is ebf27765421c:
commit ebf27765421c9238b7835d32a95e4a7fb8db26a4
Author: Ahmed Salem <x0rw3ll@gmail.com>
Date: Fri Apr 25 21:32:12 2025 +0200
ACPICA: Replace strncpy() with memcpy()
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>
Link: https://patch.msgid.link/1910878.atdPhlSkOF@rjwysocki.net
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(-)
And yes, I can confirm this catch.
The kernel with ebf27765421c reverted no longer triggers this error message.
> sh /usr/src/kernels/6.16.0-0.rc0.250528gfeacb1774bd5.5.fc43.x86_64+debug/scripts/faddr2line /lib/debug/lib/modules/6.16.0-0.rc0.250528gfeacb1774bd5.5.fc43.x86_64+debug/vmlinux acpi_ut_safe_strncpy+0x1b
acpi_ut_safe_strncpy+0x1b/0x60:
acpi_ut_safe_strncpy at drivers/acpi/acpica/utnonansi.c:172
Ahmed, Let me know if you need further logs or help reproducing.
Full hardware specs are here:
https://linux-hardware.org/?probe=1244406425
I’m also attaching build config, full bisect logs, and kernel logs
from each bisect step in archives.
--
Best Regards,
Mike Gavrilov.
[-- Attachment #2: .config.zip --]
[-- Type: application/zip, Size: 69236 bytes --]
[-- Attachment #3: bisect-log-kasan-global-out-of-bounds-in-acpi_ut_safe_strncpy.zip --]
[-- Type: application/zip, Size: 1235 bytes --]
[-- Attachment #4: dmesg.zip --]
[-- Type: application/zip, Size: 700780 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: 6.16-rc0/regression/bisected - commit ebf27765421c introduced a new warning KASAN: global-out-of-bounds in acpi_ut_safe_strncpy+0x1b
2025-05-29 14:17 6.16-rc0/regression/bisected - commit ebf27765421c introduced a new warning KASAN: global-out-of-bounds in acpi_ut_safe_strncpy+0x1b Mikhail Gavrilov
@ 2025-05-29 15:15 ` Ahmed Salem
2025-05-29 15:22 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Ahmed Salem @ 2025-05-29 15:15 UTC (permalink / raw)
To: Mikhail Gavrilov
Cc: rafael.j.wysocki, linux-acpi, Linux List Kernel Mailing,
Linux regressions mailing list
Hi Mike,
On 25/05/29 07:17PM, Mikhail Gavrilov wrote:
> Hi,
>
> Yesterday, after booting fresh kernel feacb1774bd5,
> I spotted a new error message in the kernel log with the following stack trace:
>
> [ 3.032828] ==================================================================
> [ 3.032832] BUG: KASAN: global-out-of-bounds in
> acpi_ut_safe_strncpy+0x1b/0x60
> [ 3.032839] Read of size 16 at addr ffffffffa9d32760 by task swapper/0/1
>
> [ 3.032846] CPU: 16 UID: 0 PID: 1 Comm: swapper/0 Not tainted
> 6.15.0-feacb1774bd5+ #2 PREEMPT(lazy)
> [ 3.032849] Hardware name: ASUS System Product Name/ROG STRIX
> B650E-I GAMING WIFI, BIOS 3222 03/05/2025
[snip]
> git blame says the first bad commit is ebf27765421c:
That is correct. This was a very shortsighted and uninformed commit on
my part, and we had this very same discussion on upstream ACPICA. Kernel
test robot also reported the same issue earlier[1].
The issue was that I mistakenly switched to `memcpy` in the
`acpi_ut_safe_strncpy` function in drivers/acpi/acpica/utnonansi.c, which
would have caused the buffer to be terminated one byte shorter than it
should really be. It's been rectified since, and should be pulled back
into mainline once it's cleared. I do apologize for the massive
inconvenience!
Rafael, is there a possibility this upstream commit[2] gets pulled into
mainline before the next cycle?
Link:
https://lore.kernel.org/oe-lkp/202505081033.50e45ff4-lkp@intel.com/ [1]
Link:
https://github.com/acpica/acpica/pull/1024/commits/b90d0d65ec97ff8279ad826f4102e0d31c5f662a
[2]
>
> commit ebf27765421c9238b7835d32a95e4a7fb8db26a4
> Author: Ahmed Salem <x0rw3ll@gmail.com>
> Date: Fri Apr 25 21:32:12 2025 +0200
>
> ACPICA: Replace strncpy() with memcpy()
>
> 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>
> Link: https://patch.msgid.link/1910878.atdPhlSkOF@rjwysocki.net
[snip]
> drivers/acpi/acpica/utnonansi.c | 2 +-
>
> And yes, I can confirm this catch.
> The kernel with ebf27765421c reverted no longer triggers this error message.
>
> > sh /usr/src/kernels/6.16.0-0.rc0.250528gfeacb1774bd5.5.fc43.x86_64+debug/scripts/faddr2line /lib/debug/lib/modules/6.16.0-0.rc0.250528gfeacb1774bd5.5.fc43.x86_64+debug/vmlinux acpi_ut_safe_strncpy+0x1b
> acpi_ut_safe_strncpy+0x1b/0x60:
> acpi_ut_safe_strncpy at drivers/acpi/acpica/utnonansi.c:172
>
> Ahmed, Let me know if you need further logs or help reproducing.
Thank you so much! No further action's needed on your part, and I
appreciate your effort, sincerely!
--
Best regards,
Ahmed Salem
>
> Full hardware specs are here:
> https://linux-hardware.org/?probe=1244406425
>
> I’m also attaching build config, full bisect logs, and kernel logs
> from each bisect step in archives.
>
> --
> Best Regards,
> Mike Gavrilov.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 6.16-rc0/regression/bisected - commit ebf27765421c introduced a new warning KASAN: global-out-of-bounds in acpi_ut_safe_strncpy+0x1b
2025-05-29 15:15 ` Ahmed Salem
@ 2025-05-29 15:22 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2025-05-29 15:22 UTC (permalink / raw)
To: Ahmed Salem
Cc: Mikhail Gavrilov, rafael.j.wysocki, linux-acpi,
Linux List Kernel Mailing, Linux regressions mailing list
On Thu, May 29, 2025 at 5:15 PM Ahmed Salem <x0rw3ll@gmail.com> wrote:
>
> Hi Mike,
>
> On 25/05/29 07:17PM, Mikhail Gavrilov wrote:
> > Hi,
> >
> > Yesterday, after booting fresh kernel feacb1774bd5,
> > I spotted a new error message in the kernel log with the following stack trace:
> >
> > [ 3.032828] ==================================================================
> > [ 3.032832] BUG: KASAN: global-out-of-bounds in
> > acpi_ut_safe_strncpy+0x1b/0x60
> > [ 3.032839] Read of size 16 at addr ffffffffa9d32760 by task swapper/0/1
> >
> > [ 3.032846] CPU: 16 UID: 0 PID: 1 Comm: swapper/0 Not tainted
> > 6.15.0-feacb1774bd5+ #2 PREEMPT(lazy)
> > [ 3.032849] Hardware name: ASUS System Product Name/ROG STRIX
> > B650E-I GAMING WIFI, BIOS 3222 03/05/2025
> [snip]
> > git blame says the first bad commit is ebf27765421c:
>
> That is correct. This was a very shortsighted and uninformed commit on
> my part, and we had this very same discussion on upstream ACPICA. Kernel
> test robot also reported the same issue earlier[1].
>
> The issue was that I mistakenly switched to `memcpy` in the
> `acpi_ut_safe_strncpy` function in drivers/acpi/acpica/utnonansi.c, which
> would have caused the buffer to be terminated one byte shorter than it
> should really be. It's been rectified since, and should be pulled back
> into mainline once it's cleared. I do apologize for the massive
> inconvenience!
>
> Rafael, is there a possibility this upstream commit[2] gets pulled into
> mainline before the next cycle?
>
> Link:
> https://lore.kernel.org/oe-lkp/202505081033.50e45ff4-lkp@intel.com/ [1]
> Link:
> https://github.com/acpica/acpica/pull/1024/commits/b90d0d65ec97ff8279ad826f4102e0d31c5f662a
> [2]
Sure. Thanks for the pointer.
> >
> > commit ebf27765421c9238b7835d32a95e4a7fb8db26a4
> > Author: Ahmed Salem <x0rw3ll@gmail.com>
> > Date: Fri Apr 25 21:32:12 2025 +0200
> >
> > ACPICA: Replace strncpy() with memcpy()
> >
> > 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>
> > Link: https://patch.msgid.link/1910878.atdPhlSkOF@rjwysocki.net
> [snip]
> > drivers/acpi/acpica/utnonansi.c | 2 +-
> >
> > And yes, I can confirm this catch.
> > The kernel with ebf27765421c reverted no longer triggers this error message.
> >
> > > sh /usr/src/kernels/6.16.0-0.rc0.250528gfeacb1774bd5.5.fc43.x86_64+debug/scripts/faddr2line /lib/debug/lib/modules/6.16.0-0.rc0.250528gfeacb1774bd5.5.fc43.x86_64+debug/vmlinux acpi_ut_safe_strncpy+0x1b
> > acpi_ut_safe_strncpy+0x1b/0x60:
> > acpi_ut_safe_strncpy at drivers/acpi/acpica/utnonansi.c:172
> >
> > Ahmed, Let me know if you need further logs or help reproducing.
>
> Thank you so much! No further action's needed on your part, and I
> appreciate your effort, sincerely!
>
> --
> Best regards,
> Ahmed Salem
> >
> > Full hardware specs are here:
> > https://linux-hardware.org/?probe=1244406425
> >
> > I’m also attaching build config, full bisect logs, and kernel logs
> > from each bisect step in archives.
> >
> > --
> > Best Regards,
> > Mike Gavrilov.
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-29 15:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-29 14:17 6.16-rc0/regression/bisected - commit ebf27765421c introduced a new warning KASAN: global-out-of-bounds in acpi_ut_safe_strncpy+0x1b Mikhail Gavrilov
2025-05-29 15:15 ` Ahmed Salem
2025-05-29 15:22 ` 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
all inboxes | Powered by JetHome®