lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sat, 17 Apr 2010 21:34:32 +0300
From:	Avi Kivity <avi@...hat.com>
To:	Tom Lyon <pugs@...co.com>
CC:	mst@...hat.com, hjk@...utronix.de, gregkh@...e.de,
	chrisw@...s-sol.org, joro@...tes.org, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] drivers/uio/uio.c: DMA mapping, interrupt extensions,
 etc.

On 04/15/2010 11:55 PM, Tom Lyon wrote:
> This is the second of 2 related, but independent, patches. This is for
> uio.c, the previous is for uio_pci_generic.c.
>
> The 2 patches were previously one large patch. Changes for this version:
> - uio_pci_generic.c just gets extensions so that a single fd can be used
>    by non-privileged processes for interrupt control and mmaps
> - All of the DMA and IOMMU related stuff move to uio.c; no longer a need
>    to pass ioctls to individual uio drivers. It turns out that the code
>    is not PCI specific anyways.
> - A new ioctl to pin DMA buffers to certain IO virtual addresses for KVM.
> - New eventfd based interrupt notifications, including support for PCI
>    specific MSI and MSI-X interrupts.
> - PCI specific code to reset PCI functions before and after use
>
>
> @@ -122,4 +126,23 @@
>   #define UIO_PORT_GPIO	2
>   #define UIO_PORT_OTHER	3
>
> +#endif	/* __KERNEL__ */
> +
> +// Kernel&  User level defines for ioctls
> +
> +struct uio_dma_map {
> +	unsigned long	vaddr;
> +	unsigned long long dmaaddr;
>    

Use __u64 for both, otherwise you need to rewrite the structures in the 
kernel in case 32-bit userspace calls a 64-bit kernel.

> +	int	size;
>    

What units?  Size is probably too small.  Suggest unsigned type to avoid 
an extra check in the kernel.

> +	int	rdwr;
>    

What values can this hold?

> +};
> +
> +#define	UIO_DMA_MAP_ANYWHERE	_IOWR(';', 100, struct uio_dma_map)
>    

What does this do?  Ignore vaddr?

> +#define	UIO_DMA_MAP_IOVA	_IOWR(';', 101, struct uio_dma_map)
> +#define	UIO_DMA_UNMAP		_IOW(';', 102, struct uio_dma_map)
> +#define	UIO_DMA_MASK		_IOW(';', 103, unsigned long long)
> +#define	UIO_EVENTFD_IRQ		_IOW(';', 104, int)
> +#define	UIO_EVENTFD_MSI		_IOW(';', 105, int)
> +#define	UIO_EVENTFDS_MSIX	_IOW(';', 106, int)
>    

These three need some documentation.


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ