Re: [PATCH] xtensa: fix {get,put}_user() for 64bit values

2019-10-10 Thread Max Filippov
On Thu, Oct 10, 2019 at 7:29 AM Al Viro wrote: > Hmm... Looking at __get_user_size(), we have retval = 0; very early > in it. So I wonder if it should simply be > #define __get_user_size(x, ptr, size, retval) \ > do {

Re: [PATCH] xtensa: fix {get,put}_user() for 64bit values

2019-10-10 Thread Al Viro
On Wed, Oct 09, 2019 at 07:11:40PM -0700, Max Filippov wrote: > > I don't have > > xtensa cross-toolchain at the moment, so I can't check it easily; > > what does =r constraint generate in such case? > > Lower register of the register pair. OK... > > Another thing is, you want to zero it on fai

Re: [PATCH] xtensa: fix {get,put}_user() for 64bit values

2019-10-09 Thread Max Filippov
On Wed, Oct 9, 2019 at 6:56 PM Al Viro wrote: > > On Wed, Oct 09, 2019 at 06:38:12PM -0700, Max Filippov wrote: > > > There's also the following code in the callers of this macro, e.g. in > > __get_user_nocheck: > > > > long __gu_err, __gu_val;\ > >

Re: [PATCH] xtensa: fix {get,put}_user() for 64bit values

2019-10-09 Thread Al Viro
On Wed, Oct 09, 2019 at 06:38:12PM -0700, Max Filippov wrote: > There's also the following code in the callers of this macro, e.g. in > __get_user_nocheck: > > long __gu_err, __gu_val;\ > __get_user_size(__gu_val, (ptr), (size), __gu_err); \ >

Re: [PATCH] xtensa: fix {get,put}_user() for 64bit values

2019-10-09 Thread Max Filippov
On Wed, Oct 9, 2019 at 12:21 PM Al Viro wrote: > > First of all, on short copies __copy_{to,from}_user() return the amount > of bytes left uncopied, *not* -EFAULT. get_user() and put_user() are > expected to return -EFAULT on failure. > > Another problem is get_user(v32, (__u64 __user *)p); that

[PATCH] xtensa: fix {get,put}_user() for 64bit values

2019-10-09 Thread Al Viro
First of all, on short copies __copy_{to,from}_user() return the amount of bytes left uncopied, *not* -EFAULT. get_user() and put_user() are expected to return -EFAULT on failure. Another problem is get_user(v32, (__u64 __user *)p); that should fetch 64bit value and the assign it to v32, truncati