Date: Sat, 11 Apr 2009 02:37:17 GMT From: Jason Harmening <jason.harmening@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: amd64/133592: busdma incorrectly calculates bounce buffer requirements for userspace buffers Message-ID: <200904110237.n3B2bHvE015726@www.freebsd.org> Resent-Message-ID: <200904110240.n3B2e1Bi071356@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904110237.n3B2bHvE015726>