From: Len Baker <hidden> Date: 2021-08-08 12:50:51
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. So use strscpy() or memcpy() as a safe
replacement.
This is a task of the KSPP [1].
Changelog v1 -> v2
- Change the "area_name_size" variable for a shorter name (Geert
Uytterhoeven).
- Add the "Reviewed-by: Geert Uytterhoeven" tag.
- Use the memcpy function instead of strscpy function when the
size of the destination buffer cannot be obtained with "sizeof"
(David Laight, Robin Murphy).
Changelog v2 -> v3
- Remove the "Reviewed-by: Geert Uytterhoeven" tag since the code
has changed after the v1 review (use of memcpy instead of
strscpy).
Changelog v3 -> v4
- Split the changes in 3 commits (Bjorn Andersson).
- Don't break a long line (Bjorn Andersson).
- Reword the commit when used the memcpy function (Bjorn Andersson)
The previous version can be found here [2].
[1] https://github.com/KSPP/linux/issues/88
[2] https://lore.kernel.org/linux-hardening/20210801131958.6144-1-len.baker@gmx.com/
Len Baker (3):
drivers/soc/qcom: Prefer strscpy over strcpy
drivers/soc/renesas: Prefer memcpy over strcpy
drivers/soc/ti: Prefer strscpy over strcpy
drivers/soc/qcom/pdr_interface.c | 12 ++++++------
drivers/soc/renesas/r8a779a0-sysc.c | 6 ++++--
drivers/soc/renesas/rcar-sysc.c | 6 ++++--
drivers/soc/ti/knav_dma.c | 2 +-
4 files changed, 15 insertions(+), 11 deletions(-)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Len Baker <hidden> Date: 2021-08-08 13:50:43
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. The safe replacement is strscpy().
This is a previous step in the path to remove the strcpy() function
entirely from the kernel.
Signed-off-by: Len Baker <redacted>
---
drivers/soc/qcom/pdr_interface.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
From: Len Baker <hidden> Date: 2021-08-08 14:50:48
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. So, use memcpy() as a safe replacement.
This is a previous step in the path to remove the strcpy() function
entirely from the kernel.
Signed-off-by: Len Baker <redacted>
---
drivers/soc/renesas/r8a779a0-sysc.c | 6 ++++--
drivers/soc/renesas/rcar-sysc.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. So, use memcpy() as a safe replacement.
This is a previous step in the path to remove the strcpy() function
entirely from the kernel.
Signed-off-by: Len Baker <redacted>
---
drivers/soc/renesas/r8a779a0-sysc.c | 6 ++++--
drivers/soc/renesas/rcar-sysc.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
And similar for the second hunk.
MfG,
Bernd
--
Bernd Petrovitsch Email : bernd@petrovitsch.priv.at
There is NO CLOUD, just other people's computers. - FSFE
LUGA : http://www.luga.at
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Len Baker <hidden> Date: 2021-08-08 15:50:49
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. The safe replacement is strscpy().
This is a previous step in the path to remove the strcpy() function
entirely from the kernel.
Signed-off-by: Len Baker <redacted>
---
drivers/soc/ti/knav_dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Hi,
Le 08/08/2021 à 17:35, Bernd Petrovitsch a écrit :
Hi all!
On 08/08/2021 14:50, Len Baker wrote:
quoted
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. So, use memcpy() as a safe replacement.
This is a previous step in the path to remove the strcpy() function
entirely from the kernel.
Signed-off-by: Len Baker <redacted>
---
drivers/soc/renesas/r8a779a0-sysc.c | 6 ++++--
drivers/soc/renesas/rcar-sysc.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
From: Len Baker <hidden> Date: 2021-08-10 16:00:48
Hi,
On Sun, Aug 08, 2021 at 07:06:30PM +0200, Christophe JAILLET wrote:
Hi,
Le 08/08/2021 à 17:35, Bernd Petrovitsch a écrit :
quoted
Hi all!
On 08/08/2021 14:50, Len Baker wrote:
quoted
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. So, use memcpy() as a safe replacement.
This is a previous step in the path to remove the strcpy() function
entirely from the kernel.
Signed-off-by: Len Baker <redacted>
---
drivers/soc/renesas/r8a779a0-sysc.c | 6 ++++--
drivers/soc/renesas/rcar-sysc.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
On Sun, Aug 8, 2021 at 4:50 PM Len Baker [off-list ref] wrote:
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. So, use memcpy() as a safe replacement.
This is a previous step in the path to remove the strcpy() function
entirely from the kernel.
Signed-off-by: Len Baker <redacted>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-devel for v5.15.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel