kprof: use parsecmd() instead of strncmp on user pointers
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 2 May 2019 03:09:45 +0000 (23:09 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 2 May 2019 03:13:35 +0000 (23:13 -0400)
commit1f0ded4d14f196c6e9d8430a5e2317e7bcc407c4
tree85049c40938ddd761aaad8c95aea74255d7a627c
parent71cfd5f4c02100c5e2f39e19570016c62f08e9ea
kprof: use parsecmd() instead of strncmp on user pointers

The string passed to error("%s") was a user pointer.  We shouldn't even
be using manual strncmps and whatnot on user pointers - they might be
able to give us a pointer right below ULIM.

One fix for the strncmp checks would be to use MIN(write_amt,
static_len), since we know sys_write() made sure write_amt bytes were
valid.

But since we already called parsecmd(), let's just use it.

Reported-by: syzbot+75a997a9a55827b3871d@syzkaller.appspotmail.com
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/dev/kprof.c