Skip to content

RFC physmem: Have flaview API check bus permission from MemTxAttrs argument

Philippe Mathieu-Daudé qemu-arm qemu-devel 2 versions – Applied

Status from this message: Applied to target-arm.next, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 RFC Latest3 patches 11 repliesApplied
  2. v2 RFC5 patches 33 repliesSuperseded

Since v1 ("hw: Forbid DMA write accesses to MMIO regions") [2] from the cover letter

- rewrite based on Peter / Stefan feedbacks

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3hw/intc/arm_gicv3: Check for !MEMTX_OK instead of MEMTX_ERRORhw/intc/arm_gicv3_redist.c+2 -22 replies
2/3softmmu/physmem: Simplify flatview_write and address_space_access_validsoftmmu/physmem.c+3 -80 replies
3/3softmmu/physmem: Introduce MemTxAttrs::memory field and MEMTX_BUS_ERRORinclude/exec/memattrs.h softmmu/physmem.c+50 -26 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchPeter XuDavid HildenbrandPeter MaydellStefan HajnocziAlexander BulekovRichard Henderson
1/3R-b R-b R-b R-b
2/3R-b R-b R-b R-b
3/3R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.

Read the v3 thread

Cover letter [RFC PATCH v3 0/3] physmem: Have flaview API check bus permission from MemTxAttrs argument

This series aim to kill a recent class of bug, the infamous "DMA reentrancy" issues found by Alexander while fuzzing.

Introduce the 'memory' field in MemTxAttrs, allowing to restrict a controller to memories (and not devices).

If a transaction permission is not allowed (for example access to device), we return the specific MEMTX_BUS_ERROR.

Permissions are checked in after the flatview is resolved, and before the access is done, in a new function: flatview_access_allowed().

Since v2 [1]:
- Addressed review comments:
- reword arm_gicv3 description (pm215)
- merged patches 3/4/5 (peterx & dhildenb)
- simplify flatview_access_allowed() logic (stefanha)
- drop MEMTXPERM enum and reword following AMBA terminology (edgar)

Since v1 ("hw: Forbid DMA write accesses to MMIO regions") [2]:
- rewrite based on Peter / Stefan feedbacks

Based on "hw: Let the DMA API take a MemTxAttrs argument" [3].

Based-on: <[email protected]>

[1] https://www.mail-archive.com/[email protected]/msg831168.html
[2] https://www.mail-archive.com/[email protected]/msg72924.html
[3] https://www.mail-archive.com/[email protected]/msg820359.html

Philippe Mathieu-Daudé (3):
hw/intc/arm_gicv3: Check for !MEMTX_OK instead of MEMTX_ERROR softmmu/physmem: Simplify flatview_write and
address_space_access_valid
softmmu/physmem: Introduce MemTxAttrs::memory field and
MEMTX_BUS_ERROR

 include/exec/memattrs.h    |  9 +++++++
 hw/intc/arm_gicv3_redist.c |  4 +--
 softmmu/physmem.c          | 54 +++++++++++++++++++++++++++++++-------
 3 files changed, 55 insertions(+), 12 deletions(-)
Signature · 1 line
2.33.1