Re: [PATCH 1/2 v2] kprobe: Do not use uaccess functions to access kernel memory that can fault

From: Steven Rostedt
Date: Fri Feb 15 2019 - 21:21:38 EST


On Fri, 15 Feb 2019 18:14:21 -0800
Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:

> > In the uprobes case, we have:
> >
> > static nokprobe_inline int
> > probe_mem_read(void *dest, void *src, size_t size)
> > {
> > void __user *vaddr = (void __force __user *)src;
> >
> > return copy_from_user(dest, vaddr, size) ? -EFAULT : 0;
> > }
> >
> > Because that is adding probes on userspace code.
> >
> >
>
> Can the kprobe case call probe_kernel_read? Maybe it does already?

Yes, the probe_mem_read() is only used in the trace_probe_tmpl.h which
for uprobes is the above "copy_from_user()" and for the kprobes case it
is probe_kernel_read().

-- Steve