Re: [PATCH 1/1] Userspace I/O (UIO): Add support for userspace DMA (corrected)

From: Edward Estabrook
Date: Thu Dec 04 2008 - 00:35:01 EST


> Anyway, what about 64bit processors? What happens if they try to use a
> valid address in this range?
>
> Is this value always an "invalid" value for all arches that Linux runs
> on?

Yes. I have run this on 64-bit systems.

The offset parameter in UIO is used to specify the memory-mapping index
of interest, where offset = N * getpagesize().

In include/linux/uio_driver.h we had:
#define MAX_UIO_MAPS 5

so assuming a page size of 4k the maximum legal value was 0x5000.

This logic is equally true on in any architecture.

With the dynamic DMA allocation one can now have an arbitrarily large
number of mappings. This magic number simply reduces the theoretical limit
to the number of distinct mappings to of 1,048,574.

Note that even if the in-kernel driver-stub choose to overload the mmap method
both the original code and these modifications would error out on any value
which did not correlate with a valid memory-mapping index number before
handing control to the overloaded implementation.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/