diff mbox series

[2/2] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up

Message ID 20190806030718.29048-3-luaraneda@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series ARM: zynq: smp improvements | expand

Commit Message

Luis Araneda Aug. 6, 2019, 3:07 a.m. UTC
This fixes a kernel panic (read overflow) on memcpy when
FORTIFY_SOURCE is enabled.

The computed size of memcpy args are:
- p_size (dst): 4294967295 = (size_t) -1
- q_size (src): 1
- size (len): 8

Additionally, the memory is marked as __iomem, so one of
the memcpy_* functions should be used for read/write

Signed-off-by: Luis Araneda <luaraneda@gmail.com>
---
 arch/arm/mach-zynq/platsmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg Kroah-Hartman Aug. 6, 2019, 5:17 a.m. UTC | #1
On Mon, Aug 05, 2019 at 11:07:18PM -0400, Luis Araneda wrote:
> This fixes a kernel panic (read overflow) on memcpy when
> FORTIFY_SOURCE is enabled.
> 
> The computed size of memcpy args are:
> - p_size (dst): 4294967295 = (size_t) -1
> - q_size (src): 1
> - size (len): 8
> 
> Additionally, the memory is marked as __iomem, so one of
> the memcpy_* functions should be used for read/write
> 
> Signed-off-by: Luis Araneda <luaraneda@gmail.com>
> ---
>  arch/arm/mach-zynq/platsmp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>
Michal Simek Aug. 6, 2019, 6:41 a.m. UTC | #2
On 06. 08. 19 5:07, Luis Araneda wrote:
> This fixes a kernel panic (read overflow) on memcpy when
> FORTIFY_SOURCE is enabled.
> 
> The computed size of memcpy args are:
> - p_size (dst): 4294967295 = (size_t) -1
> - q_size (src): 1
> - size (len): 8
> 
> Additionally, the memory is marked as __iomem, so one of
> the memcpy_* functions should be used for read/write
> 
> Signed-off-by: Luis Araneda <luaraneda@gmail.com>
> ---
>  arch/arm/mach-zynq/platsmp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
> index 38728badabd4..a10085be9073 100644
> --- a/arch/arm/mach-zynq/platsmp.c
> +++ b/arch/arm/mach-zynq/platsmp.c
> @@ -57,7 +57,7 @@ int zynq_cpun_start(u32 address, int cpu)
>  			* 0x4: Jump by mov instruction
>  			* 0x8: Jumping address
>  			*/
> -			memcpy((__force void *)zero, &zynq_secondary_trampoline,
> +			memcpy_toio(zero, &zynq_secondary_trampoline,
>  							trampoline_size);
>  			writel(address, zero + trampoline_size);
>  

I would consider this one as stable material. Please also add there link
to the patch which this patch fixes.

M
Luis Araneda Aug. 6, 2019, 12:49 p.m. UTC | #3
Hi Michal,

On Tue, Aug 6, 2019 at 2:42 AM Michal Simek <michal.simek@xilinx.com> wrote:
> On 06. 08. 19 5:07, Luis Araneda wrote:
> > This fixes a kernel panic (read overflow) on memcpy when
> > FORTIFY_SOURCE is enabled.
> >
> > The computed size of memcpy args are:
> > - p_size (dst): 4294967295 = (size_t) -1
> > - q_size (src): 1
> > - size (len): 8
> >
> > Additionally, the memory is marked as __iomem, so one of
> > the memcpy_* functions should be used for read/write
> >
> > Signed-off-by: Luis Araneda <luaraneda@gmail.com>
[...]
> I would consider this one as stable material. Please also add there link
> to the patch which this patch fixes.

I'm dropping stable CC (for now), as I'm not sure I completely
understood the process for inclusion in stable trees.
Do I have to wait for the patch to be on Linus' tree before CCing stable?

As for the link which this patch fixes, you mean
aa7eb2bb4e4a22e41bbe4612ff46e5885b13c33e (arm: zynq: Add smp support)?
where you added SMP support for zynq.

Thanks,
Luis Araneda.
Michal Simek Aug. 8, 2019, 9:19 a.m. UTC | #4
On 06. 08. 19 14:49, Luis Araneda wrote:
> Hi Michal,
> 
> On Tue, Aug 6, 2019 at 2:42 AM Michal Simek <michal.simek@xilinx.com> wrote:
>> On 06. 08. 19 5:07, Luis Araneda wrote:
>>> This fixes a kernel panic (read overflow) on memcpy when
>>> FORTIFY_SOURCE is enabled.
>>>
>>> The computed size of memcpy args are:
>>> - p_size (dst): 4294967295 = (size_t) -1
>>> - q_size (src): 1
>>> - size (len): 8
>>>
>>> Additionally, the memory is marked as __iomem, so one of
>>> the memcpy_* functions should be used for read/write
>>>
>>> Signed-off-by: Luis Araneda <luaraneda@gmail.com>
> [...]
>> I would consider this one as stable material. Please also add there link
>> to the patch which this patch fixes.
> 
> I'm dropping stable CC (for now), as I'm not sure I completely
> understood the process for inclusion in stable trees.
> Do I have to wait for the patch to be on Linus' tree before CCing stable?

just put Cc: to commit message and they will pick it up.

> 
> As for the link which this patch fixes, you mean
> aa7eb2bb4e4a22e41bbe4612ff46e5885b13c33e (arm: zynq: Add smp support)?
> where you added SMP support for zynq.

yes but make sha1 only 12char long.

M
diff mbox series

Patch

diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 38728badabd4..a10085be9073 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -57,7 +57,7 @@  int zynq_cpun_start(u32 address, int cpu)
 			* 0x4: Jump by mov instruction
 			* 0x8: Jumping address
 			*/
-			memcpy((__force void *)zero, &zynq_secondary_trampoline,
+			memcpy_toio(zero, &zynq_secondary_trampoline,
 							trampoline_size);
 			writel(address, zero + trampoline_size);