stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.1 01/24] ARM: 9290/1: uaccess: Fix KASAN false-positives
@ 2023-04-01  1:42 Sasha Levin
  2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 02/24] ARM: dts: qcom: apq8026-lg-lenok: add missing reserved memory Sasha Levin
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: Sasha Levin @ 2023-04-01  1:42 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 14eecaaf295fa..e4c2677cc1e9e 100644
--- a/arch/arm/lib/uaccess_with_memcpy.c
+++ b/arch/arm/lib/uaccess_with_memcpy.c
@@ -116,7 +116,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;
@@ -178,7 +178,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] 24+ messages in thread

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

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-01  1:42 [PATCH AUTOSEL 6.1 01/24] ARM: 9290/1: uaccess: Fix KASAN false-positives Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 02/24] ARM: dts: qcom: apq8026-lg-lenok: add missing reserved memory Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 03/24] power: supply: rk817: Fix unsigned comparison with less than zero Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 04/24] power: supply: cros_usbpd: reclassify "default case!" as debug Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 05/24] power: supply: axp288_fuel_gauge: Added check for negative values Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 06/24] selftests/bpf: Fix progs/find_vma_fail1.c build error Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 07/24] wifi: mwifiex: mark OF related data as maybe unused Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 08/24] i2c: imx-lpi2c: clean rx/tx buffers upon new message Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 09/24] i2c: hisi: Avoid redundant interrupts Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 10/24] efi: sysfb_efi: Add quirk for Lenovo Yoga Book X91F/L Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 11/24] block: ublk_drv: mark device as LIVE before adding disk Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 12/24] ACPI: video: Add backlight=native DMI quirk for Acer Aspire 3830TG Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 13/24] drm: panel-orientation-quirks: Add quirk for Lenovo Yoga Book X90F Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 14/24] hwmon: (peci/cputemp) Fix miscalculated DTS for SKX Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 15/24] hwmon: (xgene) Fix ioremap and memremap leak Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 16/24] verify_pefile: relax wrapper length check Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 17/24] asymmetric_keys: log on fatal failures in PE/pkcs7 Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 18/24] nvme: send Identify with CNS 06h only to I/O controllers Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 19/24] wifi: iwlwifi: mvm: fix mvmtxq->stopped handling Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 20/24] wifi: iwlwifi: mvm: protect TXQ list manipulation Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 21/24] drm/amdgpu: add mes resume when do gfx post soft reset Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 22/24] drm/amdgpu: Force signal hw_fences that are embedded in non-sched jobs Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 23/24] drm/amdgpu/gfx: set cg flags to enter/exit safe mode Sasha Levin
2023-04-01  1:42 ` [PATCH AUTOSEL 6.1 24/24] 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).