Re: [PATCH] kernel: introduce prctl(PR_LOG_UACCESS)

From
Cyrill Gorcunov <hidden>
Date
2021-09-22 06:30:20
Also in
lkml
Reply to
Peter Collingbourne, 2021-09-22
On Tue, Sep 21, 2021 at 11:18:09PM -0700, Peter Collingbourne wrote:
This patch introduces a kernel feature known as uaccess logging.
With uaccess logging, the userspace program passes the address and size
of a so-called uaccess buffer to the kernel via a prctl(). The prctl()
is a request for the kernel to log any uaccesses made during the next
syscall to the uaccess buffer. When the next syscall returns, the address
one past the end of the logged uaccess buffer entries is written to the
location specified by the third argument to the prctl(). In this way,
the userspace program may enumerate the uaccesses logged to the access
buffer to determine which accesses occurred.
...
quoted hunk ↗ jump to hunk
diff --git a/include/linux/sched.h b/include/linux/sched.h
index e12b524426b0..3fecb0487b97 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -34,6 +34,7 @@
 #include <linux/rseq.h>
 #include <linux/seqlock.h>
 #include <linux/kcsan.h>
+#include <linux/uaccess_buffer_info.h>
 #include <asm/kmap_size.h>
 
 /* task_struct member predeclarations (sorted alphabetically): */
@@ -1487,6 +1488,8 @@ struct task_struct {
 	struct callback_head		l1d_flush_kill;
 #endif
 
+	struct uaccess_buffer_info	uaccess_buffer;
+
Hi, Peter! I didn't read the patch carefully yet (will do once time permit)
but from a glance should not this member be under #ifdef CONFIG_UACCESS_BUFFER
or something? task_struct is already bloated too much :(
quoted hunk ↗ jump to hunk
+	case PR_LOG_UACCESS:
+		if (arg5)
+			return -EINVAL;
+		error = uaccess_buffer_set_logging(arg2, arg3, arg4);
+		break;
Same here (if only I didn't miss something obvious). If there is no support
for CONFIG_UACCESS_BUFFER we should return an error I guess.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (12 messages) 12 messages, 7 authors, last reply 2021-11-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help