Re: [PATCH net] KEYS: DNS: fix parsing multiple options

2018-06-25 Thread Eric Biggers
On Thu, Jun 14, 2018 at 05:14:30PM +0100, David Howells wrote: > The fix seems to work, but the use of kstrtoul(): > > ret = kstrtoul(eq, 10, &derrno); > > is incorrect since the buffer can't been modified to block out the next > argument if there is one, so the following fails: > >

Re: [PATCH net] KEYS: DNS: fix parsing multiple options

2018-06-14 Thread David Howells
Simon Horman wrote: > > - eq = memchr(opt, '=', opt_len) ?: end; > > + eq = memchr(opt, '=', opt_len) ?: next_opt; > > opt_nlen = eq - opt; > > eq++; > > It seems risky to advance eq++ in the case there the value is empt

Re: [PATCH net] KEYS: DNS: fix parsing multiple options

2018-06-14 Thread David Howells
The fix seems to work, but the use of kstrtoul(): ret = kstrtoul(eq, 10, &derrno); is incorrect since the buffer can't been modified to block out the next argument if there is one, so the following fails: perl -e 'print "#dnserror=1#", "\x00" x 1' | keyctl padd dns_resolv

Re: [PATCH net] KEYS: DNS: fix parsing multiple options

2018-06-11 Thread Simon Horman
On Mon, Jun 11, 2018 at 10:57:42AM -0700, Eric Biggers wrote: > Hi Simon, > > On Mon, Jun 11, 2018 at 11:40:23AM +0200, Simon Horman wrote: > > On Fri, Jun 08, 2018 at 09:20:37AM -0700, Eric Biggers wrote: > > > From: Eric Biggers > > > > > > My recent fix for dns_resolver_preparse() printing ve

Re: [PATCH net] KEYS: DNS: fix parsing multiple options

2018-06-11 Thread Eric Biggers
Hi Simon, On Mon, Jun 11, 2018 at 11:40:23AM +0200, Simon Horman wrote: > On Fri, Jun 08, 2018 at 09:20:37AM -0700, Eric Biggers wrote: > > From: Eric Biggers > > > > My recent fix for dns_resolver_preparse() printing very long strings was > > incomplete, as shown by syzbot which still managed t

Re: [PATCH net] KEYS: DNS: fix parsing multiple options

2018-06-11 Thread Simon Horman
On Fri, Jun 08, 2018 at 09:20:37AM -0700, Eric Biggers wrote: > From: Eric Biggers > > My recent fix for dns_resolver_preparse() printing very long strings was > incomplete, as shown by syzbot which still managed to hit the > WARN_ONCE() in set_precision() by adding a crafted "dns_resolver" key:

[PATCH net] KEYS: DNS: fix parsing multiple options

2018-06-08 Thread Eric Biggers
From: Eric Biggers My recent fix for dns_resolver_preparse() printing very long strings was incomplete, as shown by syzbot which still managed to hit the WARN_ONCE() in set_precision() by adding a crafted "dns_resolver" key: precision 50001 too large WARNING: CPU: 7 PID: 864 at lib/vspri