Page MenuHomeFreeBSD

D48075.diff
No OneTemporary

D48075.diff

diff --git a/sys/kern/kern_osd.c b/sys/kern/kern_osd.c
--- a/sys/kern/kern_osd.c
+++ b/sys/kern/kern_osd.c
@@ -180,6 +180,18 @@
osdm[type].osd_destructors[slot - 1] = NULL;
OSD_DEBUG("Slot deregistration (type=%u, slot=%u).", type, slot);
+#ifdef INVARIANTS
+ /*
+ * We trash the slot's osd_methods upon deregistration so that we take
+ * a fault if something calls them, rather than potentially
+ * inadvertently executing some arbitrary function if another module's
+ * been mapped over the one that deregistered.
+ */
+ for (u_int method = 0; method < osdm[type].osd_nmethods; method++) {
+ OSD_METHOD(osdm[type], slot, method) = (void *)0xdeadc0de;
+ }
+#endif
+
rm_wunlock(&osdm[type].osd_object_lock);
sx_xunlock(&osdm[type].osd_module_lock);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 16, 6:36 AM (17 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34338785
Default Alt Text
D48075.diff (769 B)

Event Timeline