lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 12 Jun 2020 17:02:02 +0900
From:   Hyesoo Yu <hyesoo.yu@...sung.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Hyesoo Yu <hyesoo.yu@...sung.com>,
        Sumit Semwal <sumit.semwal@...aro.org>,
        linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        linaro-mm-sig@...ts.linaro.org, linux-kernel@...r.kernel.org
Subject: [PATCH] dma-buf: support to walk the list of dmabuf for debug

Let's support debugging function to show exporter
detail information. The exporter don't need to manage
the lists for debugging because all dmabuf list are
managed on dmabuf framework.

That supports to walk the dmabuf list and show the
detailed information for exporter by passed function
implemented from exporter.

That helps to show exporter detail information.
For example, ION may show the buffer flag, heap name,
or the name of process to request allocation.

Change-Id: I670f04dda4a0870081e1b0fd96b9185b48b9dd15
Signed-off-by: Hyesoo Yu <hyesoo.yu@...sung.com>
---
 drivers/dma-buf/dma-buf.c | 30 ++++++++++++++++++++++++++++++
 include/linux/dma-buf.h   |  2 ++
 2 files changed, 32 insertions(+)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 01ce125f8e8d..002bd3ac636e 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -1254,6 +1254,36 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
 }
 EXPORT_SYMBOL_GPL(dma_buf_vunmap);
 
+int dma_buf_exp_show(struct seq_file *s,
+		     int (*it)(struct seq_file *s, struct dma_buf *dmabuf))
+{
+	int ret;
+	struct dma_buf *buf_obj;
+
+	ret = mutex_lock_interruptible(&db_list.lock);
+	if (ret)
+		return ret;
+
+	list_for_each_entry(buf_obj, &db_list.head, list_node) {
+		ret = mutex_lock_interruptible(&buf_obj->lock);
+		if (ret) {
+			seq_puts(s,
+				 "\tERROR locking buffer object: skipping\n");
+			continue;
+		}
+
+		ret = it(s, buf_obj);
+		mutex_unlock(&buf_obj->lock);
+		if (ret)
+			break;
+	}
+	mutex_unlock(&db_list.lock);
+
+	return 0;
+
+}
+EXPORT_SYMBOL_GPL(dma_buf_exp_show);
+
 #ifdef CONFIG_DEBUG_FS
 static int dma_buf_debug_show(struct seq_file *s, void *unused)
 {
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index ab0c156abee6..b5c0a10b4eb3 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -502,4 +502,6 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,
 		 unsigned long);
 void *dma_buf_vmap(struct dma_buf *);
 void dma_buf_vunmap(struct dma_buf *, void *vaddr);
+int dma_buf_exp_show(struct seq_file *s,
+		     int (*it)(struct seq_file *s, struct dma_buf *dmabuf));
 #endif /* __DMA_BUF_H__ */
-- 
2.27.0

Powered by blists - more mailing lists