stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.15 01/11] ARM: 9290/1: uaccess: Fix KASAN false-positives
@ 2023-04-01  1:43 Sasha Levin
  2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 02/11] power: supply: cros_usbpd: reclassify "default case!" as debug Sasha Levin
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Sasha Levin @ 2023-04-01  1:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Andrew Jeffery, Zev Weiss, Arnd Bergmann, Russell King,
	Sasha Levin, linux, akpm, anshuman.khandual, linux-arm-kernel

From: Andrew Jeffery <andrew@aj.id.au>

[ Upstream commit ceac10c83b330680cc01ceaaab86cd49f4f30d81 ]

__copy_to_user_memcpy() and __clear_user_memset() had been calling
memcpy() and memset() respectively, leading to false-positive KASAN
reports when starting userspace:

    [   10.707901] Run /init as init process
    [   10.731892] process '/bin/busybox' started with executable stack
    [   10.745234] ==================================================================
    [   10.745796] BUG: KASAN: user-memory-access in __clear_user_memset+0x258/0x3ac
    [   10.747260] Write of size 2687 at addr 000de581 by task init/1

Use __memcpy() and __memset() instead to allow userspace access, which
is of course the intent of these functions.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/lib/uaccess_with_memcpy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c
index 106f83a5ea6d2..35e03f6a62127 100644
--- a/arch/arm/lib/uaccess_with_memcpy.c
+++ b/arch/arm/lib/uaccess_with_memcpy.c
@@ -121,7 +121,7 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n)
 			tocopy = n;
 
 		ua_flags = uaccess_save_and_enable();
-		memcpy((void *)to, from, tocopy);
+		__memcpy((void *)to, from, tocopy);
 		uaccess_restore(ua_flags);
 		to += tocopy;
 		from += tocopy;
@@ -188,7 +188,7 @@ __clear_user_memset(void __user *addr, unsigned long n)
 			tocopy = n;
 
 		ua_flags = uaccess_save_and_enable();
-		memset((void *)addr, 0, tocopy);
+		__memset((void *)addr, 0, tocopy);
 		uaccess_restore(ua_flags);
 		addr += tocopy;
 		n -= tocopy;
-- 
2.39.2


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

end of thread, other threads:[~2023-04-01  2:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-01  1:43 [PATCH AUTOSEL 5.15 01/11] ARM: 9290/1: uaccess: Fix KASAN false-positives Sasha Levin
2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 02/11] power: supply: cros_usbpd: reclassify "default case!" as debug Sasha Levin
2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 03/11] wifi: mwifiex: mark OF related data as maybe unused Sasha Levin
2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 04/11] i2c: imx-lpi2c: clean rx/tx buffers upon new message Sasha Levin
2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 05/11] i2c: hisi: Avoid redundant interrupts Sasha Levin
2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 06/11] efi: sysfb_efi: Add quirk for Lenovo Yoga Book X91F/L Sasha Levin
2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 07/11] drm: panel-orientation-quirks: Add quirk for Lenovo Yoga Book X90F Sasha Levin
2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 08/11] verify_pefile: relax wrapper length check Sasha Levin
2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 09/11] asymmetric_keys: log on fatal failures in PE/pkcs7 Sasha Levin
2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 10/11] wifi: iwlwifi: mvm: fix mvmtxq->stopped handling Sasha Levin
2023-04-01  1:43 ` [PATCH AUTOSEL 5.15 11/11] ACPI: resource: Add Medion S17413 to IRQ override quirk Sasha Levin

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