Author: avg
Date: Fri Sep 11 20:43:14 2015
New Revision: 287684
URL: https://svnweb.freebsd.org/changeset/base/287684

Log:
  6091 avl_add doesn't assert on non-debug builds
  
  illumos/illumos-gate@faa2b6be2fc102adf9ed584fc1a667b4ddf50d78
  
  https://www.illumos.org/issues/6091
    Long story short, avl_add's use of ASSERT(0) can cause really strange 
looking
    crashes on non-debug builds of libavl.so because ASSERTs turn into no-ops.
    ...
  
  Reviewed by: Andy Stormont <[email protected]>
  Reviewed by: Matthew Ahrens <[email protected]>
  Reviewed by: Steve Dougherty <[email protected]>
  Approved by: Dan McDonald <[email protected]>
  Author: Josef 'Jeff' Sipek <[email protected]>

Modified:
  vendor-sys/illumos/dist/common/avl/avl.c

Modified: vendor-sys/illumos/dist/common/avl/avl.c
==============================================================================
--- vendor-sys/illumos/dist/common/avl/avl.c    Fri Sep 11 20:39:41 2015        
(r287683)
+++ vendor-sys/illumos/dist/common/avl/avl.c    Fri Sep 11 20:43:14 2015        
(r287684)
@@ -25,6 +25,7 @@
 
 /*
  * Copyright (c) 2014 by Delphix. All rights reserved.
+ * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  */
 
 /*
@@ -635,14 +636,17 @@ avl_add(avl_tree_t *tree, void *new_node
        /*
         * This is unfortunate.  We want to call panic() here, even for
         * non-DEBUG kernels.  In userland, however, we can't depend on anything
-        * in libc or else the rtld build process gets confused.  So, all we can
-        * do in userland is resort to a normal ASSERT().
+        * in libc or else the rtld build process gets confused.
+        * Thankfully, rtld provides us with its own assfail() so we can use
+        * that here.  We use assfail() directly to get a nice error message
+        * in the core - much like what panic() does for crashdumps.
         */
        if (avl_find(tree, new_node, &where) != NULL)
 #ifdef _KERNEL
                panic("avl_find() succeeded inside avl_add()");
 #else
-               ASSERT(0);
+               (void) assfail("avl_find() succeeded inside avl_add()",
+                   __FILE__, __LINE__);
 #endif
        avl_insert(tree, new_node, where);
 }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to