staging: android: ashmem: add size field in procfs fdinfo
authorliuhailong <liuhailong@oppo.com>
Fri, 18 Jun 2021 09:50:35 +0000 (17:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Jun 2021 11:02:40 +0000 (13:02 +0200)
add this information to help user to find ashmem problem.

ashmem leak scenario:
-000|fd = ashmem_create_region
-001|mmap and pagefault
-002|munmap
-003|forget close(fd) <---- which lead to ashmem leak

Signed-off-by: liuhailong <liuhailong@oppo.com>
收件人: 刘海龙(DuckBuBee) <liuhailong@oppo.com>
Link: https://lore.kernel.org/r/20210618095035.32410-1-liuhailong@oppo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ashmem.c

index 8ee4320..ddbde3f 100644 (file)
@@ -895,6 +895,8 @@ static void ashmem_show_fdinfo(struct seq_file *m, struct file *file)
                seq_printf(m, "name:\t%s\n",
                           asma->name + ASHMEM_NAME_PREFIX_LEN);
 
+       seq_printf(m, "size:\t%zu\n", asma->size);
+
        mutex_unlock(&ashmem_mutex);
 }
 #endif