[PATCH] ARM: tegra: Use io memcpy to write to iram

Aaron Kling via B4 Relay posted 1 patch 11 months ago
arch/arm/mach-tegra/reset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] ARM: tegra: Use io memcpy to write to iram
Posted by Aaron Kling via B4 Relay 11 months ago
From: Aaron Kling <webgeek1234@gmail.com>

Kasan crashes the kernel trying to check boundaries when using the
normal memcpy.

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
Change-Id: I27714f45aa6aea6a7bee048f706b14b8c7535164
---
 arch/arm/mach-tegra/reset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
index d5c805adf7a82b938bebd8941eae974cf6bcdbe3..ea706fac63587a393a17fe0f1c2ad69d6e5c14f2 100644
--- a/arch/arm/mach-tegra/reset.c
+++ b/arch/arm/mach-tegra/reset.c
@@ -63,7 +63,7 @@ static void __init tegra_cpu_reset_handler_enable(void)
 	BUG_ON(is_enabled);
 	BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
 
-	memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
+	memcpy_toio(iram_base, (void *)__tegra_cpu_reset_handler_start,
 			tegra_cpu_reset_handler_size);
 
 	err = call_firmware_op(set_cpu_boot_addr, 0, reset_address);

---
base-commit: d608703fcdd9e9538f6c7a0fcf98bf79b1375b60
change-id: 20250522-mach-tegra-kasan-fabd0253f268

Best regards,
-- 
Aaron Kling <webgeek1234@gmail.com>
Re: [PATCH] ARM: tegra: Use io memcpy to write to iram
Posted by Thierry Reding 9 months, 2 weeks ago
From: Thierry Reding <treding@nvidia.com>


On Thu, 22 May 2025 11:11:24 -0500, Aaron Kling wrote:
> Kasan crashes the kernel trying to check boundaries when using the
> normal memcpy.
> 
> 

Applied, thanks!

[1/1] ARM: tegra: Use io memcpy to write to iram
      commit: 4110a4d95bf0bebd8ccaaeb93988dc9c08bd7d6a

Best regards,
-- 
Thierry Reding <treding@nvidia.com>
Re: [PATCH] ARM: tegra: Use io memcpy to write to iram
Posted by Thierry Reding 9 months, 2 weeks ago
On Thu, May 22, 2025 at 11:11:24AM -0500, Aaron Kling via B4 Relay wrote:
> From: Aaron Kling <webgeek1234@gmail.com>
> 
> Kasan crashes the kernel trying to check boundaries when using the
> normal memcpy.
> 
> Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> ---
> Change-Id: I27714f45aa6aea6a7bee048f706b14b8c7535164
> ---
>  arch/arm/mach-tegra/reset.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Looks fine, I'll apply this later on.

Thierry
Re: [PATCH] ARM: tegra: Use io memcpy to write to iram
Posted by Aaron Kling 10 months, 3 weeks ago
On Thu, May 22, 2025 at 11:11 AM Aaron Kling via B4 Relay
<devnull+webgeek1234.gmail.com@kernel.org> wrote:
>
> From: Aaron Kling <webgeek1234@gmail.com>
>
> Kasan crashes the kernel trying to check boundaries when using the
> normal memcpy.
>
> Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> ---
> Change-Id: I27714f45aa6aea6a7bee048f706b14b8c7535164
> ---
>  arch/arm/mach-tegra/reset.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
> index d5c805adf7a82b938bebd8941eae974cf6bcdbe3..ea706fac63587a393a17fe0f1c2ad69d6e5c14f2 100644
> --- a/arch/arm/mach-tegra/reset.c
> +++ b/arch/arm/mach-tegra/reset.c
> @@ -63,7 +63,7 @@ static void __init tegra_cpu_reset_handler_enable(void)
>         BUG_ON(is_enabled);
>         BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
>
> -       memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
> +       memcpy_toio(iram_base, (void *)__tegra_cpu_reset_handler_start,
>                         tegra_cpu_reset_handler_size);
>
>         err = call_firmware_op(set_cpu_boot_addr, 0, reset_address);
>
> ---
> base-commit: d608703fcdd9e9538f6c7a0fcf98bf79b1375b60
> change-id: 20250522-mach-tegra-kasan-fabd0253f268
>
> Best regards,
> --
> Aaron Kling <webgeek1234@gmail.com>
>
>

Friendly reminder about this patch.

Sincerely,
Aaron
Re: [PATCH] ARM: tegra: Use io memcpy to write to iram
Posted by Aaron Kling 9 months, 3 weeks ago
On Wed, May 28, 2025 at 12:45 PM Aaron Kling <webgeek1234@gmail.com> wrote:
>
> On Thu, May 22, 2025 at 11:11 AM Aaron Kling via B4 Relay
> <devnull+webgeek1234.gmail.com@kernel.org> wrote:
> >
> > From: Aaron Kling <webgeek1234@gmail.com>
> >
> > Kasan crashes the kernel trying to check boundaries when using the
> > normal memcpy.
> >
> > Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> > ---
> > Change-Id: I27714f45aa6aea6a7bee048f706b14b8c7535164
> > ---
> >  arch/arm/mach-tegra/reset.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
> > index d5c805adf7a82b938bebd8941eae974cf6bcdbe3..ea706fac63587a393a17fe0f1c2ad69d6e5c14f2 100644
> > --- a/arch/arm/mach-tegra/reset.c
> > +++ b/arch/arm/mach-tegra/reset.c
> > @@ -63,7 +63,7 @@ static void __init tegra_cpu_reset_handler_enable(void)
> >         BUG_ON(is_enabled);
> >         BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
> >
> > -       memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
> > +       memcpy_toio(iram_base, (void *)__tegra_cpu_reset_handler_start,
> >                         tegra_cpu_reset_handler_size);
> >
> >         err = call_firmware_op(set_cpu_boot_addr, 0, reset_address);
> >
> > ---
> > base-commit: d608703fcdd9e9538f6c7a0fcf98bf79b1375b60
> > change-id: 20250522-mach-tegra-kasan-fabd0253f268
> >
> > Best regards,
> > --
> > Aaron Kling <webgeek1234@gmail.com>
> >
> >
>
> Friendly reminder about this patch.

Re-reminder about this patch.

Aaron