⬢ DragonFlyBSD Kernel Audit
DF-2988 / fix.diff
← back to finding ↓ download raw
--- a/sys/sys/tree.h
+++ b/sys/sys/tree.h
@@ -708,8 +708,15 @@
 /*									\
  * Issue a callback for all matching items.  The scan function must	\
  * return < 0 for items below the desired range, 0 for items within	\
- * the range, and > 0 for items beyond the range.   Any item may be	\
- * deleted while the scan is in progress.				\
+ * the range, and > 0 for items beyond the range.		\
+ *									\
+ * CONCURRENCY CONTRACT (actual): while a scan is in progress it is	\
+ * safe for the SCANNING THREAD to delete the item it is currently	\
+ * processing, and safe for ANY thread to delete items parked as a	\
+ * scan's pending-next element.  It is NOT safe for a different	\
+ * thread to delete the item another concurrent scan is currently	\
+ * processing inside its callback; concurrent scans under shared	\
+ * locks must serialize deletions exclusively.			\
  */									\
 static int								\
 name##_SCANCMP_ALL(struct type *type __unused, void *data __unused)	\