kern/110662: [safe] safenet driver causes kernel panic

Sam Leffler sam at FreeBSD.org
Sun Mar 25 03:27:32 UTC 2007


Synopsis: [safe] safenet driver causes kernel panic

State-Changed-From-To: open->analyzed
State-Changed-By: sam
State-Changed-When: Sun Mar 25 03:17:47 UTC 2007
State-Changed-Why: 
The problem is reproducible.  There are several issues.  The failure
to create the bus dma tag is because there is a 4-byte alignment
requirement set for the dst dma tag and BUS_DMA_ALLOCNOW is specified.
This causes an attempt to pre-allocate a bunch of memory to the
bounce page zone which fails.  Removing BUS_DMA_ALLOCNOW does not
work however because the safe driver is not prepared for bus dma
setup requests to be deferred.  If that happens then the driver
will crash because it assumes the dma setup always succeeds and so
blindly stuffs a bogus physical address into the dma engine.

It appears the alignment requirement is actually not needed however;
though I must re-check the chip specs and code to make sure.  Applying
the following change avoids the bounce page issue and allows
cryptotest to run to completion but it likely provides only
properly-aligned dst buffers so this may just mask a problem that
will crop up for other consumers such as fast ipsec.  As I said
already I need to investigate more before committing a fix.

cvs diff: Diffing .
Index: safe.c
===================================================================
RCS file: /usr/ncvs/src/sys/dev/safe/safe.c,v
retrieving revision 1.17
diff -u -r1.17 safe.c
--- safe.c      23 Feb 2007 12:18:52 -0000      1.17
+++ safe.c      25 Mar 2007 03:23:03 -0000
@@ -298,7 +298,7 @@
                goto bad4;
        }
        if (bus_dma_tag_create(NULL,                    /* parent */
-                              sizeof(u_int32_t),       /* alignment */
+                              1,                       /* alignment */
                               SAFE_MAX_DSIZE,          /* boundary */
                               BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
                               BUS_SPACE_MAXADDR,       /* highaddr */


http://www.freebsd.org/cgi/query-pr.cgi?pr=110662


More information about the freebsd-bugs mailing list