amd64/133592: busdma incorrectly calculates bounce buffer
requirements for userspace buffers
Jason Harmening
jason.harmening at gmail.com
Fri Apr 10 19:40:02 PDT 2009
>Number: 133592
>Category: amd64
>Synopsis: busdma incorrectly calculates bounce buffer requirements for userspace buffers
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-amd64
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Apr 11 02:40:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Jason Harmening
>Release: 7.2-PRERELEASE
>Organization:
>Environment:
FreeBSD CORONA 7.2-PRERELEASE FreeBSD 7.2-PRERELEASE #2: Sat Mar 21 00:30:34 CDT 2009 jason at CORONA:/usr/obj/usr/src/sys/CUSTOM amd64
>Description:
The _bus_dmamap_load_buffer function in sys/amd64/amd64/busdma_machdep.c takes a pmap_t param indicating the address space of the buffer (NULL => KVA space). When calculating the number of bounce buffers to reserve, it always calls pmap_kextract() to get the physical address, when it should call pmap_extract() if pmap != NULL.
The problem exists in both 7-STABLE and 8-CURRENT--the attached patch is against 7-STABLE.
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
--- busdma_machdep.c.bkp 2009-04-10 21:27:51.000000000 -0500
+++ busdma_machdep.c 2009-04-10 21:30:58.000000000 -0500
@@ -602,7 +602,10 @@
vendaddr = (vm_offset_t)buf + buflen;
while (vaddr < vendaddr) {
- paddr = pmap_kextract(vaddr);
+ if (pmap)
+ paddr = pmap_extract(pmap, vaddr);
+ else
+ paddr = pmap_kextract(vaddr);
if (run_filter(dmat, paddr) != 0)
map->pagesneeded++;
vaddr += PAGE_SIZE;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-amd64
mailing list