Re: [PATCH bpf v7 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-19 Thread Alexei Starovoitov
On Thu, Nov 19, 2020 at 10:40:21AM -0800, Linus Torvalds wrote: > On Thu, Nov 19, 2020 at 10:34 AM Alexei Starovoitov > wrote: > > > > ping. > > I'm ok with this series that adds explanations for why you care and > what bpf does that makes it valid. Great. > So this one you can put in the bpf

Re: [PATCH bpf v7 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-19 Thread Linus Torvalds
On Thu, Nov 19, 2020 at 10:34 AM Alexei Starovoitov wrote: > > ping. I'm ok with this series that adds explanations for why you care and what bpf does that makes it valid. So this one you can put in the bpf tree. Or, if you want me to just apply it as a series, I can do that too, I just

Re: [PATCH bpf v7 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-19 Thread Alexei Starovoitov
On Tue, Nov 17, 2020 at 12:14 PM Alexei Starovoitov wrote: > > On Tue, Nov 17, 2020 at 12:05 PM Daniel Xu wrote: > > > > This commit uses the proper word-at-a-time APIs to avoid overcopying. > > that part of the commit log is no longer correct. I can fix it up while > applying > if Linus

Re: [PATCH bpf v7 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-17 Thread Alexei Starovoitov
On Tue, Nov 17, 2020 at 12:05 PM Daniel Xu wrote: > > This commit uses the proper word-at-a-time APIs to avoid overcopying. that part of the commit log is no longer correct. I can fix it up while applying if Linus doesn't have an issue with the rest.

[PATCH bpf v7 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-17 Thread Daniel Xu
do_strncpy_from_user() may copy some extra bytes after the NUL terminator into the destination buffer. This usually does not matter for normal string operations. However, when BPF programs key BPF maps with strings, this matters a lot. A BPF program may read strings from user memory by calling