Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F81969423
D2725.id5922.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D2725.id5922.diff
View Options
Index: sys/vm/uma_core.c
===================================================================
--- sys/vm/uma_core.c
+++ sys/vm/uma_core.c
@@ -1940,6 +1940,20 @@
args.dtor = dtor;
args.uminit = uminit;
args.fini = fini;
+#ifdef INVARIANTS
+ /*
+ * If a zone is being created with an empty constructor and
+ * destructor, pass UMA constructor/destructor which checks for
+ * memory use after free.
+ */
+ if ((!(flags & UMA_ZONE_ZINIT)) && ctor == NULL && dtor == NULL &&
+ uminit == NULL && fini == NULL) {
+ args.ctor = trash_ctor;
+ args.dtor = trash_dtor;
+ args.uminit = trash_init;
+ args.fini = trash_fini;
+ }
+#endif
args.align = align;
args.flags = flags;
args.keg = NULL;
Index: sys/vm/uma_dbg.c
===================================================================
--- sys/vm/uma_dbg.c
+++ sys/vm/uma_dbg.c
@@ -69,8 +69,13 @@
for (p = mem; cnt > 0; cnt--, p++)
if (*p != uma_junk) {
+#ifdef INVARIANTS
+ panic("Memory modified after free %p(%d) val=%x @ %p\n",
+ mem, size, *p, p);
+#else
printf("Memory modified after free %p(%d) val=%x @ %p\n",
mem, size, *p, p);
+#endif
return (0);
}
return (0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 15, 6:46 AM (8 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9091502
Default Alt Text
D2725.id5922.diff (1 KB)
Attached To
Mode
D2725: Add extra INVARIANTS check for ctor/dtor
Attached
Detach File
Event Timeline
Log In to Comment