Re: [PATCH bpf-next] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-04 Thread Daniel Xu
On Wed Nov 4, 2020 at 2:36 PM PST, Daniel Borkmann wrote: > On 11/4/20 9:18 PM, Daniel Xu wrote: > > On Wed Nov 4, 2020 at 8:24 AM PST, Daniel Borkmann wrote: > >> On 11/4/20 3:29 AM, Daniel Xu wrote: > >>> do_strncpy_from_user() may copy some extra bytes after the NUL > >>> terminator into the

Re: [PATCH bpf-next] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-04 Thread Daniel Borkmann
On 11/4/20 9:18 PM, Daniel Xu wrote: On Wed Nov 4, 2020 at 8:24 AM PST, Daniel Borkmann wrote: On 11/4/20 3:29 AM, Daniel Xu wrote: 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.

Re: [PATCH bpf-next] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-04 Thread Daniel Xu
Hi Daniel, On Wed Nov 4, 2020 at 8:24 AM PST, Daniel Borkmann wrote: > On 11/4/20 3:29 AM, Daniel Xu wrote: > > 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

Re: [PATCH bpf-next] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-04 Thread Daniel Borkmann
On 11/4/20 3:29 AM, Daniel Xu wrote: 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

[PATCH bpf-next] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator

2020-11-03 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