Module Name:    src
Committed By:   riastradh
Date:           Sun Mar  2 01:23:11 UTC 2025

Modified Files:
        src/sys/arch/riscv/riscv: bus_dma.c

Log Message:
riscv/bus_dma: Handle pmap_extract failure.

That is, when the va is not mapped in the pmap.

Otherwise this trips over uninitialized memory, e.g.:

[   1.0000000] panic: kernel diagnostic assertion "(vaddr & PAGE_MASK) == 
(curaddr & PAGE_MASK)" failed: file 
"/tmp/build/2025.02.22.19.09.05-riscv-riscv64/src/sys/arch/riscv/riscv/bus_dma.c",
 line 1568 va 0xffffffc000a01718 curaddr 0x1

https://releng.netbsd.org/b5reports/riscv-riscv64/2025/2025.02.22.19.09.05/install.log

Perhaps the caller should guarantee that the va is valid, but

(a) for some reason this doesn't work when the va is on the stack,
(b) this is not documented in bus_dma(9), and
(c) if pmap_extract failure should lead to panic then it should do so
    intentionally instead of accidentally tripping over a subsequent
    assertion.

XXX Do this consistently across bus_dma implementations.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/riscv/riscv/bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to