Skip to content

Commit 8dd765a

Browse files
vireshkjgross1
authored andcommitted
xen: Make struct privcmd_irqfd's layout architecture independent
Using indirect pointers in an ioctl command argument means that the layout is architecture specific, in particular we can't use the same one from 32-bit compat tasks. The general recommendation is to have __u64 members and use u64_to_user_ptr() to access it from the kernel if we are unable to avoid the pointers altogether. Fixes: f8941e6 ("xen: privcmd: Add support for irqfd") Reported-by: Arnd Bergmann <arnd@kernel.org> Closes: https://lore.kernel.org/all/268a2031-63b8-4c7d-b1e5-8ab83ca80b4a@app.fastmail.com/ Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/a4ef0d4a68fc858b34a81fd3f9877d9b6898eb77.1697439990.git.viresh.kumar@linaro.org Signed-off-by: Juergen Gross <jgross@suse.com>
1 parent d3a2b6b commit 8dd765a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/xen/privcmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ static int privcmd_irqfd_assign(struct privcmd_irqfd *irqfd)
935935
return -ENOMEM;
936936
dm_op = kirqfd + 1;
937937

938-
if (copy_from_user(dm_op, irqfd->dm_op, irqfd->size)) {
938+
if (copy_from_user(dm_op, u64_to_user_ptr(irqfd->dm_op), irqfd->size)) {
939939
ret = -EFAULT;
940940
goto error_kfree;
941941
}

include/uapi/xen/privcmd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ struct privcmd_mmap_resource {
102102
#define PRIVCMD_IRQFD_FLAG_DEASSIGN (1 << 0)
103103

104104
struct privcmd_irqfd {
105-
void __user *dm_op;
105+
__u64 dm_op;
106106
__u32 size; /* Size of structure pointed by dm_op */
107107
__u32 fd;
108108
__u32 flags;

0 commit comments

Comments
 (0)