Skip to contentSkip to conversation

bpf-handle-the-compat-string-in-bpf_trace_copy_string-better.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jun 10, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: bpf: handle the compat string in bpf_trace_copy_string better
has been removed from the -mm tree. Its filename was
bpf-handle-the-compat-string-in-bpf_trace_copy_string-better.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: bpf: handle the compat string in bpf_trace_copy_string better

User the proper helper for kernel or userspace addresses based on TASK_SIZE instead of the dangerous strncpy_from_unsafe function.

Cc Alexei Starovoitov <[email protected]>
Cc Daniel Borkmann <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Thomas Gleixner <[email protected]>

---

 kernel/trace/bpf_trace.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/trace/bpf_trace.c renamed from kernel/trace/bpf_trace.c~bpf-handle-the-compat-string-in-bpf_trace_copy_string-better +5 -2
@@ -334,8 +334,11 @@ static void bpf_trace_copy_string(char *
 	switch (fmt_ptype) {
 	case 's':
 #ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
-		strncpy_from_unsafe(buf, unsafe_ptr, bufsz);
-		break;
+		if ((unsigned long)unsafe_ptr < TASK_SIZE) {
+			strncpy_from_user_nofault(buf, user_ptr, bufsz);
+			break;
+		}
+		fallthrough;
 #endif
 	case 'k':
 		strncpy_from_kernel_nofault(buf, unsafe_ptr, bufsz);

_

Patches currently in -mm which might be from [email protected] are

amdgpu-a-null-mm-does-not-mean-a-thread-is-a-kthread.patch kernel-move-use_mm-unuse_mm-to-kthreadc.patch kernel-move-use_mm-unuse_mm-to-kthreadc-v2.patch kernel-better-document-the-use_mm-unuse_mm-api-contract.patch kernel-better-document-the-use_mm-unuse_mm-api-contract-v2.patch kernel-set-user_ds-in-kthread_use_mm.patch