Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1736345
| From | Meng Xu <mengxu.gatech@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] mpt3sas: downgrade full copy_from_user to access_ok check |
| Date | 2017-09-21 05:40 +0200 |
| Message-ID | <us0vf-3MA-1@gated-at.bofh.it> (permalink) |
| References | <urDIl-5IT-11@gated-at.bofh.it> <us0lz-3Je-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> On Sep 20, 2017, at 11:26 PM, Al Viro <viro@ZenIV.linux.org.uk> wrote: > > On Tue, Sep 19, 2017 at 11:11:11PM -0400, Meng Xu wrote: >> Since right after the user copy, we are going to >> memset(&karg, 0, sizeof(karg)), I guess an access_ok check is enough? > > access_ok() is *NOT* "will copy_from_user() succeed?" Not even close. > On a bunch of architectures (sparc64, for one) access_ok() is always > true. > > All it does is checking that address is not a kernel one - e.g. on > i386 anything in range 0..3Gb qualifies. Whether anything's mapped > at that address or not. > > Why bother with that copy_from_user() at all? The same ioctl() > proceeds to copy_to_user() on exact same range; all you get from > it is "if the area passed by caller is writable, but not readable, > fail with -EFAULT". Who cares? > > Just drop that copy_from_user() completely. Anything access_ok() > might've caught will be caught by copy_to_user() anyway. Yes, Christoph has suggested the same thing and I have submitted another patch with copy_from_user removed entirely.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] mpt3sas: downgrade full copy_from_user to access_ok check Meng Xu <mengxu.gatech@gmail.com> - 2017-09-20 05:20 +0200
Re: [PATCH] mpt3sas: downgrade full copy_from_user to access_ok check Christoph Hellwig <hch@infradead.org> - 2017-09-20 17:10 +0200
Re: [PATCH] mpt3sas: downgrade full copy_from_user to access_ok check Al Viro <viro@ZenIV.linux.org.uk> - 2017-09-21 05:30 +0200
Re: [PATCH] mpt3sas: downgrade full copy_from_user to access_ok check Meng Xu <mengxu.gatech@gmail.com> - 2017-09-21 05:40 +0200
csiph-web