Re: [PATCH 12/23] bpf: handle the compat string in bpf_trace_copy_string better

2020-05-28 Thread Yonghong Song
On 5/27/20 9:39 PM, Christoph Hellwig wrote: On Wed, May 27, 2020 at 07:26:30PM -0700, Yonghong Song wrote: --- a/kernel/trace/bpf_trace.c~xxx +++ a/kernel/trace/bpf_trace.c @@ -588,15 +588,22 @@ BPF_CALL_5(bpf_seq_printf, struct seq_fi } if (fmt[i] == 's') { +

Re: [PATCH 12/23] bpf: handle the compat string in bpf_trace_copy_string better

2020-05-27 Thread Christoph Hellwig
On Wed, May 27, 2020 at 07:26:30PM -0700, Yonghong Song wrote: >> --- a/kernel/trace/bpf_trace.c~xxx >> +++ a/kernel/trace/bpf_trace.c >> @@ -588,15 +588,22 @@ BPF_CALL_5(bpf_seq_printf, struct seq_fi >> } >> if (fmt[i] == 's') { >> +void *unsafe_ptr; >

Re: [PATCH 12/23] bpf: handle the compat string in bpf_trace_copy_string better

2020-05-27 Thread Yonghong Song
On 5/27/20 7:04 PM, Andrew Morton wrote: On Thu, 21 May 2020 17:22:50 +0200 Christoph Hellwig wrote: User the proper helper for kernel or userspace addresses based on TASK_SIZE instead of the dangerous strncpy_from_unsafe function. ... --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf

Re: [PATCH 12/23] bpf: handle the compat string in bpf_trace_copy_string better

2020-05-27 Thread Andrew Morton
On Thu, 21 May 2020 17:22:50 +0200 Christoph Hellwig wrote: > User the proper helper for kernel or userspace addresses based on > TASK_SIZE instead of the dangerous strncpy_from_unsafe function. > > ... > > --- a/kernel/trace/bpf_trace.c > +++ b/kernel/trace/bpf_trace.c > @@ -331,8 +331,11 @@ st

Re: [PATCH 12/23] bpf: handle the compat string in bpf_trace_copy_string better

2020-05-21 Thread Andrii Nakryiko
On Thu, May 21, 2020 at 8:24 AM Christoph Hellwig wrote: > > User the proper helper for kernel or userspace addresses based on > TASK_SIZE instead of the dangerous strncpy_from_unsafe function. > > Signed-off-by: Christoph Hellwig > --- Acked-by: Andrii Nakryiko > kernel/trace/bpf_trace.c | 7

[PATCH 12/23] bpf: handle the compat string in bpf_trace_copy_string better

2020-05-21 Thread Christoph Hellwig
User the proper helper for kernel or userspace addresses based on TASK_SIZE instead of the dangerous strncpy_from_unsafe function. Signed-off-by: Christoph Hellwig --- kernel/trace/bpf_trace.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/trace/bpf_trace.c b/k