[patch] Debugging the ZDB debugger.

Zaphod Beeblebrox zbeeble at gmail.com
Sat Nov 22 02:11:01 UTC 2014


Obviously I don't know the ramifications here, but this patch fixes
things.  If you don't want to read it, the jist is that dl_phys is null and
this function would like to dereference it.

Now my next question is: how badly damaged is the zfs filesystem that
causes this?  From looking in from the outside, it works find save claming
to have two files with errors.

(in case everyone needs catching up, -dd works -ddd or -dddd crashes
without this patch)

Index: cddl/contrib/opensolaris/cmd/zdb/zdb.c
===================================================================
--- cddl/contrib/opensolaris/cmd/zdb/zdb.c      (revision 274527)
+++ cddl/contrib/opensolaris/cmd/zdb/zdb.c      (working copy)
@@ -1461,11 +1461,15 @@
        if (dump_opt['d'] < 3)
                return;

-       zdb_nicenum(dl->dl_phys->dl_used, bytes);
-       zdb_nicenum(dl->dl_phys->dl_comp, comp);
-       zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp);
-       (void) printf("\n    Deadlist: %s (%s/%s comp)\n",
-           bytes, comp, uncomp);
+       if(dl->dl_phys) {
+           zdb_nicenum(dl->dl_phys->dl_used, bytes);
+           zdb_nicenum(dl->dl_phys->dl_comp, comp);
+           zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp);
+           (void) printf("\n    Deadlist: %s (%s/%s comp)\n",
+                         bytes, comp, uncomp);
+       } else {
+           (void) printf("\n    Deadlist: __really_dead__\n");
+       }

        if (dump_opt['d'] < 4)
                return;


More information about the freebsd-hackers mailing list