Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Unverified Commit 02ebd373 authored by Greg Hackmann's avatar Greg Hackmann Committed by Michael Bestas
Browse files

fixup! 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: default avatarGreg Hackmann <ghackmann@google.com>
Signed-off-by: default avatarChenbo Feng <fengc@google.com>

Bug: 63860998
Bug: 124522014
[mikeioannina]: Reapply after bad upstream merge.
Change-Id: I3d4eb5491ed13b0d616cbc7cbb3d8bb9473006f5

Change-Id: I3b3e111caeab46ddd543d5b879b65856e42dfb64
parent 20764bbb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment