From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Andrew Jeffery <andrew@aj.id.au>,
Zev Weiss <zev@bewilderbeest.net>, Arnd Bergmann <arnd@arndb.de>,
Russell King <rmk+kernel@armlinux.org.uk>,
Sasha Levin <sashal@kernel.org>,
linux@armlinux.org.uk, akpm@linux-foundation.org,
anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 5.15 01/11] ARM: 9290/1: uaccess: Fix KASAN false-positives
Date: Fri, 31 Mar 2023 21:43:39 -0400 [thread overview]
Message-ID: <20230401014350.3357107-1-sashal@kernel.org> (raw)
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
next reply other threads:[~2023-04-01 1:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-01 1:43 Sasha Levin [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230401014350.3357107-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrew@aj.id.au \
--cc=anshuman.khandual@arm.com \
--cc=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=rmk+kernel@armlinux.org.uk \
--cc=stable@vger.kernel.org \
--cc=zev@bewilderbeest.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox