Re: get_user_pages and pinning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cengiz

> I don't have an answer to your question because your sentences are too long and I couldn't understand the thing you are asking.
 A clearer picture below.
1) There is a user program that allocates memory using malloc. It does
not initialize the memory.
2) It uses an ioctl to pass a pointer to different areas of this
allocated memory to a driver controlling a device.
3) The device is supposed to fill the buffer that this pointer points
to with requested data.
4) The driver pins the pages that the pointer points to in memory
using get_user_pages.
5) The driver gets the physical (bus) address of this buffer using
kernel apis such as dma_map_sg and queues up the DMA.
6) Inspecting the bus address returned by kernel apis shows that the
same address is returned for different locations in the buffer.
7) So the DMA fails (rather the device sends the data but it is over
writing the same location)
8) It looks like the memory isn't actually allocated by malloc. Not a surprise.
9) It will ideally allocate memory when a write to the memory location occurs.
10) But the write is happening not from user space but by DMA from a device.

So the question is what should happen if the memory isn't actually
allocated. Should get_user_pages check?
It doesn't seem to be doing so.  Can it?

S

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux