lkml.org 
[lkml]   [2020]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC] uaccess: user_access_begin_after_access_ok()
On Wed, Jun 03, 2020 at 02:23:08PM +0800, Jason Wang wrote:
> >
> > BTW now I re-read it I don't understand __vhost_get_user_slow:
> >
> >
> > static void __user *__vhost_get_user_slow(struct vhost_virtqueue *vq,
> > void __user *addr, unsigned int size,
> > int type)
> > {
> > int ret;
> >
> > ret = translate_desc(vq, (u64)(uintptr_t)addr, size, vq->iotlb_iov,
> > ARRAY_SIZE(vq->iotlb_iov),
> > VHOST_ACCESS_RO);
> >
> > ..
> > }
> >
> > how does this work? how can we cast a pointer to guest address without
> > adding any offsets?
>
>
> I'm not sure I get you here. What kind of offset did you mean?
>
> Thanks

OK so points:

1. type argument seems unused. Right?
2. Second argument to translate_desc is a GPA, isn't it?
Here we cast a userspace address to this type. What if it
matches a valid GPA by mistake?

--
MST

\
 
 \ /
  Last update: 2020-06-03 08:32    [W:0.123 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site