diff --git a/patches.kernel.org/6.2.12-075-ARM-9290-1-uaccess-Fix-KASAN-false-positives.patch b/patches.kernel.org/6.2.12-075-ARM-9290-1-uaccess-Fix-KASAN-false-positives.patch new file mode 100644 index 0000000..5990896 --- /dev/null +++ b/patches.kernel.org/6.2.12-075-ARM-9290-1-uaccess-Fix-KASAN-false-positives.patch @@ -0,0 +1,57 @@ +From: Andrew Jeffery +Date: Wed, 22 Feb 2023 00:10:14 +0100 +Subject: [PATCH] ARM: 9290/1: uaccess: Fix KASAN false-positives +References: bsc#1012628 +Patch-mainline: 6.2.12 +Git-commit: ceac10c83b330680cc01ceaaab86cd49f4f30d81 + +[ 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 +Signed-off-by: Zev Weiss +Reviewed-by: Arnd Bergmann +Signed-off-by: Russell King (Oracle) +Signed-off-by: Sasha Levin +Signed-off-by: Jiri Slaby +--- + 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 14eecaaf..e4c2677c 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.35.3 + diff --git a/series.conf b/series.conf index cf8fa3b..74c553a 100644 --- a/series.conf +++ b/series.conf @@ -2302,6 +2302,7 @@ patches.kernel.org/6.2.12-072-selftests-add-the-missing-CONFIG_IP_SCTP-in-ne.patch patches.kernel.org/6.2.12-073-net-macb-fix-a-memory-corruption-in-extended-b.patch patches.kernel.org/6.2.12-074-skbuff-Fix-a-race-between-coalescing-and-relea.patch + patches.kernel.org/6.2.12-075-ARM-9290-1-uaccess-Fix-KASAN-false-positives.patch ######################################################## # Build fixes that apply to the vanilla kernel too.