search for: put_user

Displaying 20 results from an estimated 263 matches for "put_user".

2010 Oct 28
1
[PATCH] xen: xenfs: privcmd: check put_user() return code
put_user() may fail. In this case propagate error code from privcmd_ioctl_mmap_batch(). Signed-off-by: Vasiliy Kulikov <segooon at gmail.com> --- Compile tested. drivers/xen/xenfs/privcmd.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/xen/xenfs/privcmd.c...
2010 Oct 28
1
[PATCH] xen: xenfs: privcmd: check put_user() return code
put_user() may fail. In this case propagate error code from privcmd_ioctl_mmap_batch(). Signed-off-by: Vasiliy Kulikov <segooon at gmail.com> --- Compile tested. drivers/xen/xenfs/privcmd.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/xen/xenfs/privcmd.c...
2015 Jan 14
1
[PULL] uaccess: fix sparse warning on get/put_user for bitwise types
...rnel/git/mst/vhost.git tags/uaccess_for_upstream for you to fetch changes up to 0795cb1b46e7938ed679ccd48f933e75272b30e3: sparc32: nocheck uaccess coding style tweaks (2015-01-13 15:24:14 +0200) ---------------------------------------------------------------- uaccess: fix sparse warning on get/put_user for bitwise types At the moment, if p and x are both tagged as bitwise types, some of get_user(x, p), put_user(x, p), __get_user(x, p), __put_user(x, p) might produce a sparse warning on many architectures. This is a false positive: *p on these architectures is loaded into long (typically using as...
2015 Jan 14
1
[PULL] uaccess: fix sparse warning on get/put_user for bitwise types
...rnel/git/mst/vhost.git tags/uaccess_for_upstream for you to fetch changes up to 0795cb1b46e7938ed679ccd48f933e75272b30e3: sparc32: nocheck uaccess coding style tweaks (2015-01-13 15:24:14 +0200) ---------------------------------------------------------------- uaccess: fix sparse warning on get/put_user for bitwise types At the moment, if p and x are both tagged as bitwise types, some of get_user(x, p), put_user(x, p), __get_user(x, p), __put_user(x, p) might produce a sparse warning on many architectures. This is a false positive: *p on these architectures is loaded into long (typically using as...
2007 May 04
1
[PATCH 1/3] Documentation and example updates
1) Example code: old libc headers don't have SIOCBRADDIF, and old zlibs don't have gzdirect() -- it's a sanity check anyway. 2) Some people don't build in their source directories, so .config isn't there (thanks to Tony Breeds <tony@bakeyournoodle.com>). 3) Point out that guest and host kernel are usually the same. 4) Set the "no checksum" option on the
2007 May 04
1
[PATCH 1/3] Documentation and example updates
1) Example code: old libc headers don't have SIOCBRADDIF, and old zlibs don't have gzdirect() -- it's a sanity check anyway. 2) Some people don't build in their source directories, so .config isn't there (thanks to Tony Breeds <tony@bakeyournoodle.com>). 3) Point out that guest and host kernel are usually the same. 4) Set the "no checksum" option on the
2019 May 13
5
[PATCH net] vhost: don't use kmap() to log dirty pages
...p using userspace virtual address. Fortunately, futex has arch_futex_atomic_op_inuser() which could be used for setting a bit to user. Note there're several cases that futex helper can fail e.g a page fault or the arch that doesn't have the support. For those cases, a simplified get_user()/put_user() pair protected by a global mutex is provided as a fallback. The fallback may lead false positive that userspace may see more dirty pages. Cc: Christoph Hellwig <hch at infradead.org> Cc: James Bottomley <James.Bottomley at HansenPartnership.com> Cc: Andrea Arcangeli <aarcange at r...
2019 May 13
5
[PATCH net] vhost: don't use kmap() to log dirty pages
...p using userspace virtual address. Fortunately, futex has arch_futex_atomic_op_inuser() which could be used for setting a bit to user. Note there're several cases that futex helper can fail e.g a page fault or the arch that doesn't have the support. For those cases, a simplified get_user()/put_user() pair protected by a global mutex is provided as a fallback. The fallback may lead false positive that userspace may see more dirty pages. Cc: Christoph Hellwig <hch at infradead.org> Cc: James Bottomley <James.Bottomley at HansenPartnership.com> Cc: Andrea Arcangeli <aarcange at r...
2011 Jun 21
1
[PATCH 1/2] vhost: init used ring after backend was set
...ost.c +++ b/drivers/vhost/vhost.c @@ -578,15 +578,14 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) return 0; } -static int init_used(struct vhost_virtqueue *vq, - struct vring_used __user *used) +int init_used(struct vhost_virtqueue *vq) { - int r = put_user(vq->used_flags, &used->flags); + int r = put_user(vq->used_flags, &vq->used->flags); if (r) return r; vq->signalled_used_valid = false; - return get_user(vq->last_used_idx, &used->idx); + return get_user(vq->last_used_idx, &vq->used->idx);...
2011 Jun 21
1
[PATCH 1/2] vhost: init used ring after backend was set
...ost.c +++ b/drivers/vhost/vhost.c @@ -578,15 +578,14 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) return 0; } -static int init_used(struct vhost_virtqueue *vq, - struct vring_used __user *used) +int init_used(struct vhost_virtqueue *vq) { - int r = put_user(vq->used_flags, &used->flags); + int r = put_user(vq->used_flags, &vq->used->flags); if (r) return r; vq->signalled_used_valid = false; - return get_user(vq->last_used_idx, &used->idx); + return get_user(vq->last_used_idx, &vq->used->idx);...
2011 Jun 16
1
[PATCH] vhost: set dirty log when updating flags of used ring
.../vhost.c index 2ab2912..7c46aed 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -573,8 +573,10 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) static int init_used(struct vhost_virtqueue *vq, struct vring_used __user *used) { - int r = put_user(vq->used_flags, &used->flags); + int r; + vq->used = used; + r = vhost_update_used_flags(vq); if (r) return r; return get_user(vq->last_used_idx, &used->idx); @@ -700,7 +702,6 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) vq-&gt...
2011 Jun 16
1
[PATCH] vhost: set dirty log when updating flags of used ring
.../vhost.c index 2ab2912..7c46aed 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -573,8 +573,10 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) static int init_used(struct vhost_virtqueue *vq, struct vring_used __user *used) { - int r = put_user(vq->used_flags, &used->flags); + int r; + vq->used = used; + r = vhost_update_used_flags(vq); if (r) return r; return get_user(vq->last_used_idx, &used->idx); @@ -700,7 +702,6 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) vq-&gt...
2007 Apr 18
1
[rfc][patch][linux] ioctl32() compat plumbing for xen calls
...ed long arg) +{ + int ret; + + switch (cmd) { + case IOCTL_PRIVCMD_MMAP_32: { + struct privcmd_mmap *p; + struct privcmd_mmap_32 *p32; + struct privcmd_mmap_32 n32; + + p32 = compat_ptr(arg); + p = compat_alloc_user_space(sizeof(*p)); + if (copy_from_user(&n32, p32, sizeof(n32)) || + put_user(n32.num, &p->num) || + put_user(n32.dom, &p->dom) || + put_user(compat_ptr(n32.entry), &p->entry)) + return -EFAULT; + + ret = sys_ioctl(fd, IOCTL_PRIVCMD_MMAP, (unsigned long)p); + } + break; + case IOCTL_PRIVCMD_MMAPBATCH_32: { + struct privcmd_mmapbatch *p;...
2019 May 07
4
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...arch that has virtually tagged caches. The way to fix is to keep using userspace virtual address. Fortunately, futex has a cmpxchg to userspace memory helper futex_atomic_cmpxchg_inatomic(). So switch to use it to exchange the userspace bitmap with zero, set the bit and then write it back through put_user(). Note: there're archs (few non popular ones) that don't implement futex helper, we can't log dirty pages. We can fix them on top or simply disable LOG_ALL features of vhost. Cc: Christoph Hellwig <hch at infradead.org> Cc: James Bottomley <James.Bottomley at HansenPartnersh...
2019 May 07
4
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...arch that has virtually tagged caches. The way to fix is to keep using userspace virtual address. Fortunately, futex has a cmpxchg to userspace memory helper futex_atomic_cmpxchg_inatomic(). So switch to use it to exchange the userspace bitmap with zero, set the bit and then write it back through put_user(). Note: there're archs (few non popular ones) that don't implement futex helper, we can't log dirty pages. We can fix them on top or simply disable LOG_ALL features of vhost. Cc: Christoph Hellwig <hch at infradead.org> Cc: James Bottomley <James.Bottomley at HansenPartnersh...
2010 Mar 03
1
[RFC][ PATCH 1/3] vhost-net: support multiple buffer heads in receiver
...t iovec *heads, int count) { struct vring_used_elem *used; + int i; - /* The virtqueue contains a ring of used buffers. Get a pointer to the - * next entry in that used ring. */ - used = &vq->used->ring[vq->last_used_idx % vq->num]; - if (put_user(head, &used->id)) { - vq_err(vq, "Failed to write used id"); - return -EFAULT; - } - if (put_user(len, &used->len)) { - vq_err(vq, "Failed to write used len"); - return -EFAULT; + for (i=0; i...
2010 Mar 03
1
[RFC][ PATCH 1/3] vhost-net: support multiple buffer heads in receiver
...t iovec *heads, int count) { struct vring_used_elem *used; + int i; - /* The virtqueue contains a ring of used buffers. Get a pointer to the - * next entry in that used ring. */ - used = &vq->used->ring[vq->last_used_idx % vq->num]; - if (put_user(head, &used->id)) { - vq_err(vq, "Failed to write used id"); - return -EFAULT; - } - if (put_user(len, &used->len)) { - vq_err(vq, "Failed to write used len"); - return -EFAULT; + for (i=0; i...
2009 Jan 24
5
[LLVMdev] inline asm semantics: output constraint width smaller than input
...6,7 +176,7 @@ extern int __get_user_bad(void); break; \ } \ (x) = (__typeof__(*(ptr)))__val_gu; \ - __ret_gu; \ + (int)__ret_gu; \ }) #define __put_user_x(size, x, ptr, __ret_pu) \ @@ -239,11 +239,13 @@ extern void __put_user_8(void); */ #define put_user(x, ptr) \ ({ \ - int __ret_pu; \ + __typeof__(*(ptr)) __ret_pu; \ __typeof__(*(ptr)...
2014 Dec 01
0
[PATCH v8 32/50] vhost: switch to __get/__put_user exclusively
Most places in vhost can use __get/__put_user rather than get/put_user since addresses are pre-validated. This should be good for performance, but this also will help make code sparse-clean: get/put_user macros don't play well with __virtioXX bitwise tags. Switch to get/put_user to __ variants everywhere in vhost. There's one exception...
2014 Dec 01
0
[PATCH v8 32/50] vhost: switch to __get/__put_user exclusively
Most places in vhost can use __get/__put_user rather than get/put_user since addresses are pre-validated. This should be good for performance, but this also will help make code sparse-clean: get/put_user macros don't play well with __virtioXX bitwise tags. Switch to get/put_user to __ variants everywhere in vhost. There's one exception...