Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gax-c <zichenxie0106@gmail.com>
To: catalin.marinas@arm.com, will@kernel.org, robin.murphy@arm.com,
	mark.rutland@arm.com
Cc: linux-arm-kernel@lists.infradead.org, chenyuan0y@gmail.com,
	zzjas98@gmail.com, Zichen Xie <zichenxie0106@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH] arm64: uaccess: Restrict user access to kernel memory in __copy_user_flushcache()
Date: Fri, 15 Nov 2024 14:52:07 -0600	[thread overview]
Message-ID: <20241115205206.17678-1-zichenxie0106@gmail.com> (raw)

From: Zichen Xie <zichenxie0106@gmail.com>

raw_copy_from_user() do not call access_ok(), so this code allowed
userspace to access any virtual memory address. Change it to
copy_from_user().

Fixes: 9e94fdade4d8 ("arm64: uaccess: simplify __copy_user_flushcache()")
Signed-off-by: Zichen Xie <zichenxie0106@gmail.com>
Cc: stable@vger.kernel.org
---
 arch/arm64/lib/uaccess_flushcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/lib/uaccess_flushcache.c b/arch/arm64/lib/uaccess_flushcache.c
index 7510d1a23124..fb138a3934db 100644
--- a/arch/arm64/lib/uaccess_flushcache.c
+++ b/arch/arm64/lib/uaccess_flushcache.c
@@ -24,7 +24,7 @@ unsigned long __copy_user_flushcache(void *to, const void __user *from,
 {
 	unsigned long rc;
 
-	rc = raw_copy_from_user(to, from, n);
+	rc = copy_from_user(to, from, n);
 
 	/* See above */
 	dcache_clean_pop((unsigned long)to, (unsigned long)to + n - rc);
-- 
2.34.1



             reply	other threads:[~2024-11-15 20:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15 20:52 Gax-c [this message]
2024-11-18 11:56 ` [PATCH] arm64: uaccess: Restrict user access to kernel memory in __copy_user_flushcache() Will Deacon
2024-11-18 13:07   ` Mark Rutland

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=20241115205206.17678-1-zichenxie0106@gmail.com \
    --to=zichenxie0106@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=chenyuan0y@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    --cc=zzjas98@gmail.com \
    /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