fdmem: always map dmabuf with PROT_WRITE

This is to enable zero copy inference on dmabufs. Gasket kernel driver
requires all user pointers passed to it to be writable in
drivers/staging/gasket/gasket_page_table.c gasket_perform_mapping
even if it's not actually writing to the buffer. If we map a buffer
with GST_MAP_READ it'll be mmapped with PROT_READ and gasket will
error out with -EFAULT.

While a more correct solution is to fix the gasket driver the needed
linux/mm APIs aren't there in the current version of the kernel.
We'd need
which is for a much later kernel version.

This change may look dangerous but what it really does is to make
dmabuf protection equal to buffers allocated by the system memory
allocator; i.e. even if you map a buffer with GST_MAP_READ only
you can, but should not, write to it.

BUG: 142164990

Change-Id: Ie615f923c44969a3606d8856311ffe853a0dd742
3 files changed