All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing/syscalls: use copy_from_user for the faultable syscall buffer
@ 2026-10-16  3:33 Haoran Wang
  0 siblings, 0 replies; only message in thread
From: Haoran Wang @ 2026-10-16  3:33 UTC (permalink / raw)
  To: rostedt, mhiramat
  Cc: linux-kernel, linux-trace-kernel, mathieu.desnoyers,
	haoranwangsec

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Haoran Wang <haoranwangsec@gmail.com>
Date: Thu, 16 Oct 2026 10:00:00 +0800
Subject: [PATCH] tracing/syscalls: use copy_from_user for the faultable syscall buffer

syscall_copy_user_array() copies the buffer argument of faultable
syscalls (write, pwrite64, ...) with __copy_from_user(), which skips
access_ok(). Use copy_from_user() instead so a non-user address is
rejected and the entry is recorded as faulted.

It could be a security concern for machines that trust perf a bit too
much.

Signed-off-by: Haoran Wang <haoranwangsec@gmail.com>
---
 kernel/trace/trace_syscalls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -682,7 +682,7 @@
 
 	for (int i = 0; i < args->uargs; i++, buf += SYSCALL_FAULT_ARG_SZ) {
 		ptr = (char __user *)args->ptr_array[i];
-		ret = __copy_from_user(buf, ptr, size);
+		ret = copy_from_user(buf, ptr, size);
 		args->read[i] = ret ? -1 : size;
 	}
 	return 0;
-- 
2.43.0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-16  3:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16  3:33 [PATCH] tracing/syscalls: use copy_from_user for the faultable syscall buffer Haoran Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.