Skip to content

dma-debug: Avoid uninitialized mapping dumps

Avi Weiss linux-iommu lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 0 repliesNew
  2. v11 patch 4 repliesSuperseded

Changes in v2 from the cover letter

- 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)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2dma-debug: Skip debugfs registration when uninitializedkernel/dma/debug.c+6 -10 replies
2/2dma-debug: Remove obsolete mapping dump helperarch/x86/kernel/amd_gart_64.c include/linux/dma-map-ops.h kernel/dma/debug.c+0 -380 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] dma-debug: Avoid uninitialized mapping dumps

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

Signature · 1 line
2.43.0