⬢ DragonFlyBSD Kernel Audit
DF-4637 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/disk/vpo/vpoio.c
+++ b/sys/dev/disk/vpo/vpoio.c
@@ -55,9 +55,16 @@
  * active polling on nACK. I've tried this but it leads to unreliable
  * transfers
  */
-#define VP0_SELTMO		5000	/* select timeout */
-#define VP0_FAST_SPINTMO	500000	/* wait status timeout */
-#define VP0_LOW_SPINTMO		5000000	/* wait status timeout */
+/* SECURITY: these ceilings are iterations of a no-sleep port-I/O spin
+ * (MS_BRSET/MS_DBRA microseq) executed under vpo_intr's critical section
+ * (vpo.c). A device that withholds nBUSY pins the CPU with interrupts
+ * masked for the full budget. Short-term mitigation: 10x cut. Proper fix:
+ * drop the crit_enter() wrapper and make vpoio_wait() interruptible
+ * (see the ppb_poll_device stub below).
+ */
+#define VP0_SELTMO		500	/* select timeout */
+#define VP0_FAST_SPINTMO	50000	/* wait status timeout */
+#define VP0_LOW_SPINTMO		500000	/* wait status timeout */
 
 /*
  * Actually, VP0 timings are more accurate (about few 16MHZ cycles),