RE: [PATCH 4/4] net: improve the user pointer check in init_user_sockptr

2020-07-29 Thread David Laight
From: Christoph Hellwig > Sent: 28 July 2020 17:39 > > Make sure not just the pointer itself but the whole range lies in > the user address space. For that pass the length and then use > the access_ok helper to do the check. Now that the address is never changed it is enough to check the base ad

Re: [PATCH 4/4] net: improve the user pointer check in init_user_sockptr

2020-07-28 Thread Christoph Hellwig
On Tue, Jul 28, 2020 at 01:01:11PM -0700, David Miller wrote: > From: Christoph Hellwig > Date: Tue, 28 Jul 2020 08:36:43 +0200 > > > if (get_user(len, optlen)) > > return -EFAULT; > ^^ > > - err = init_user_sockptr(&optval, user_optval); > > +

Re: [PATCH 4/4] net: improve the user pointer check in init_user_sockptr

2020-07-28 Thread David Miller
From: Christoph Hellwig Date: Tue, 28 Jul 2020 08:36:43 +0200 > if (get_user(len, optlen)) > return -EFAULT; ^^ > - err = init_user_sockptr(&optval, user_optval); > + err = init_user_sockptr(&optval, user_optval, *optlen);

Re: [PATCH 4/4] net: improve the user pointer check in init_user_sockptr

2020-07-28 Thread Jakub Kicinski
On Tue, 28 Jul 2020 17:51:40 +0200 Christoph Hellwig wrote: > On Tue, Jul 28, 2020 at 08:47:46AM -0700, Jakub Kicinski wrote: > > Appears to cause these two new warnings, sadly: > > > > net/ipv4/bpfilter/sockopt.c:68:56: warning: dereference of noderef > > expression > > net/ipv4/bpfilter/sockopt

RE: [PATCH 4/4] net: improve the user pointer check in init_user_sockptr

2020-07-28 Thread David Laight
From: Jakub Kicinski > Sent: 28 July 2020 16:48 > On Tue, 28 Jul 2020 08:36:43 +0200 Christoph Hellwig wrote: > > Make sure not just the pointer itself but the whole range lies in > > the user address space. For that pass the length and then use > > the access_ok helper to do the check. > > > > Fi

Re: [PATCH 4/4] net: improve the user pointer check in init_user_sockptr

2020-07-28 Thread Christoph Hellwig
On Tue, Jul 28, 2020 at 08:47:46AM -0700, Jakub Kicinski wrote: > On Tue, 28 Jul 2020 08:36:43 +0200 Christoph Hellwig wrote: > > Make sure not just the pointer itself but the whole range lies in > > the user address space. For that pass the length and then use > > the access_ok helper to do the c

Re: [PATCH 4/4] net: improve the user pointer check in init_user_sockptr

2020-07-28 Thread Jakub Kicinski
On Tue, 28 Jul 2020 08:36:43 +0200 Christoph Hellwig wrote: > Make sure not just the pointer itself but the whole range lies in > the user address space. For that pass the length and then use > the access_ok helper to do the check. > > Fixes: 6d04fe15f78a ("net: optimize the sockptr_t for unified