mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] dma-debug: Avoid uninitialized mapping dumps
@ 2026-11-19 13:13 Avi Weiss
  2026-11-19 13:13 ` [PATCH v2 1/2] dma-debug: Skip debugfs registration when uninitialized Avi Weiss
  2026-11-19 13:13 ` [PATCH v2 2/2] dma-debug: Remove obsolete mapping dump helper Avi Weiss
  0 siblings, 2 replies; 3+ messages in thread
From: Avi Weiss @ 2026-11-19 13:13 UTC (permalink / raw)
  To: m.szyprowski, robin.murphy; +Cc: ailiop, iommu, linux-kernel, x86, Avi Weiss

Booting with dma_debug=off leaves the DMA-debug hash buckets
uninitialized, but the debugfs mapping dump is still registered.
Reading dma-api/dump then traverses an uninitialized list and
causes a NULL pointer dereference in dump_show().

Patch 1 skips debugfs registration when DMA debugging was not
initialized. Patch 2 removes the obsolete debug_dma_dump_mappings()
helper and its only caller in the legacy AMD GART IOMMU code.

Validation on x86-64 QEMU:
- baseline with dma_debug=off - NULL dereference in dump_show()
- patched with dma_debug=off - dma-api debugfs directory absent
- patched with DMA debugging enabled - mapping dump readable
- both objects compiled successfully with W=1

Changes since v1:
- guard debugfs registration instead of the dump paths, as
  suggested by Anthony Iliopoulos
- remove the obsolete mapping dump helper and its AMD GART
  caller (due to feedback from Robin Murphy and Marek Szyprowski)

v1 discussion:
https://lore-kernel.gnuweeb.org/linux-iommu/05c05ec4-b321-49d4-acf7-b9fa4223dba9%40samsung.com/T/


Avi Weiss (2):
  dma-debug: Skip debugfs registration when uninitialized
  dma-debug: Remove obsolete mapping dump helper

 arch/x86/kernel/amd_gart_64.c |  1 -
 include/linux/dma-map-ops.h   |  4 ----
 kernel/dma/debug.c            | 40 ++++++-----------------------------
 3 files changed, 6 insertions(+), 39 deletions(-)


base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-19 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 13:13 [PATCH v2 0/2] dma-debug: Avoid uninitialized mapping dumps Avi Weiss
2026-11-19 13:13 ` [PATCH v2 1/2] dma-debug: Skip debugfs registration when uninitialized Avi Weiss
2026-11-19 13:13 ` [PATCH v2 2/2] dma-debug: Remove obsolete mapping dump helper Avi Weiss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®