diff options
author | Greg Hackmann <ghackmann@google.com> | 2019-06-13 15:34:06 -0700 |
---|---|---|
committer | Sumit Semwal <sumit.semwal@linaro.org> | 2019-06-14 15:00:50 +0530 |
commit | ed63bb1d1f8469586006a9ca63c42344401aa2ab (patch) | |
tree | 577f34abf29a23010020204e50df5a758fe7684d /include/uapi/linux/magic.h | |
parent | 51e857af9f3f1ab78be10ff6bf5c4a8a56f4e4d6 (diff) | |
download | linux-stable-ed63bb1d1f8469586006a9ca63c42344401aa2ab.tar.gz linux-stable-ed63bb1d1f8469586006a9ca63c42344401aa2ab.tar.bz2 linux-stable-ed63bb1d1f8469586006a9ca63c42344401aa2ab.zip |
dma-buf: give each buffer a full-fledged inode
By traversing /proc/*/fd and /proc/*/map_files, processes with CAP_ADMIN
can get a lot of fine-grained data about how shmem buffers are shared
among processes. stat(2) on each entry gives the caller a unique
ID (st_ino), the buffer's size (st_size), and even the number of pages
currently charged to the buffer (st_blocks / 512).
In contrast, all dma-bufs share the same anonymous inode. So while we
can count how many dma-buf fds or mappings a process has, we can't get
the size of the backing buffers or tell if two entries point to the same
dma-buf. On systems with debugfs, we can get a per-buffer breakdown of
size and reference count, but can't tell which processes are actually
holding the references to each buffer.
Replace the singleton inode with full-fledged inodes allocated by
alloc_anon_inode(). This involves creating and mounting a
mini-pseudo-filesystem for dma-buf, following the example in fs/aio.c.
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Chenbo Feng <fengc@google.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190613223408.139221-2-fengc@google.com
Diffstat (limited to 'include/uapi/linux/magic.h')
-rw-r--r-- | include/uapi/linux/magic.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h index f8c00045d537..665e18627f78 100644 --- a/include/uapi/linux/magic.h +++ b/include/uapi/linux/magic.h @@ -91,5 +91,6 @@ #define UDF_SUPER_MAGIC 0x15013346 #define BALLOON_KVM_MAGIC 0x13661366 #define ZSMALLOC_MAGIC 0x58295829 +#define DMA_BUF_MAGIC 0x444d4142 /* "DMAB" */ #endif /* __LINUX_MAGIC_H__ */ |