broken UIO functionality for mmap in linux stable

From: Norbert Ciosek
Date: Fri Apr 18 2014 - 04:06:05 EST


Hello kernel developers,

I have some problems with UIO driver.
To be exact the problem is with uio_mmap_physical function from
drivers/uio/uio.c.

Problems were introduced by commits:
b65502879556d041b45104c6a35abbbba28c8f2d
7314e613d5ff9f0934f7a0f74ed7973b903315d1

These commits added checks if address and size are page aligned.
Of course this is correct for the "mmap" call, but currently there is
no way to store offset in the UIO driver.
Function "map_offset_show" will always return/store 0 with the page
aligned addresses.

Is it possible to add additional field called "offset" to struct uio_mem?
The "addr" could be renamed to "base" and store address with page granularity.
Then this field should be checked in the "uio_mmap_physical" function
instead of "addr".

Beside of this size of the map in the device is not always page aligned.
For example in my device this value is often set to 4.
Should I change this value to be page aligned (i.e. 0x1000 in DTS) and
"remember" the correct size in the user space program which is
managing the device? Maybe there is some other way?

Pozdrawiam / Best regards,

Norbert Ciosek
--
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/