[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181102114635.hi3q53kzmz4qljsf@lakrids.cambridge.arm.com>
Date: Fri, 2 Nov 2018 11:46:36 +0000
From: Mark Rutland <mark.rutland@....com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Kees Cook <keescook@...omium.org>, mst@...hat.com,
kvm@...r.kernel.org, virtualization@...ts.linux-foundation.org,
netdev@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
bijan.mottahedeh@...cle.com, gedwards@....com, joe@...ches.com,
lenaic@...ard.fr, liang.z.li@...el.com, mhocko@...nel.org,
mhocko@...e.com, stefanha@...hat.com, wei.w.wang@...el.com
Subject: Re: [PULL] vhost: cleanups and fixes
On Thu, Nov 01, 2018 at 04:06:19PM -0700, Linus Torvalds wrote:
> On Thu, Nov 1, 2018 at 4:00 PM Kees Cook <keescook@...omium.org> wrote:
> >
> > + memset(&rsp, 0, sizeof(rsp));
> > + rsp.response = VIRTIO_SCSI_S_FUNCTION_REJECTED;
> > + resp = vq->iov[out].iov_base;
> > + ret = __copy_to_user(resp, &rsp, sizeof(rsp));
> >
> > Is it actually safe to trust that iov_base has passed an earlier
> > access_ok() check here? Why not just use copy_to_user() instead?
>
> Good point.
>
> We really should have removed those double-underscore things ages ago.
FWIW, on arm64 we always check/sanitize the user address as a result of
our sanitization of speculated values. Almost all of our uaccess
routines have an explicit access_ok().
All our uaccess routines mask the user pointer based on addr_limit,
which prevents speculative or architectural uaccess to kernel addresses
when addr_limit it USER_DS:
4d8efc2d5ee4c9cc ("arm64: Use pointer masking to limit uaccess speculation")
We also inhibit speculative stores to addr_limit being forwarded under
speculation:
c2f0ad4fc089cff8 ("arm64: uaccess: Prevent speculative use of the current addr_limit")
... and given all that, we folded explicit access_ok() checks into
__{get,put}_user():
84624087dd7e3b48 ("arm64: uaccess: Don't bother eliding access_ok checks in __{get, put}_user")
IMO we could/should do the same for __copy_{to,from}_user().
Thanks,
Mark.
Powered by blists - more mailing lists