Title: [199934] trunk/Source/bmalloc
- Revision
- 199934
- Author
- gga...@apple.com
- Date
- 2016-04-22 16:25:54 -0700 (Fri, 22 Apr 2016)
Log Message
bmalloc: Constify introspect function pointer table
https://bugs.webkit.org/show_bug.cgi?id=156936
Reviewed by Michael Saboff.
* bmalloc/Zone.cpp:
(bmalloc::Zone::Zone): Declaring this function pointer table const puts
it in the read-only section of the binary, providing a little hardening
against overwriting the function pointers at runtime. (We have to
const_cast when assigning because the API declares a pointer to non-const,
but we happen to know it will never try to write through that pointer.
This is not my favorite API.)
Modified Paths
Diff
Modified: trunk/Source/bmalloc/ChangeLog (199933 => 199934)
--- trunk/Source/bmalloc/ChangeLog 2016-04-22 23:10:27 UTC (rev 199933)
+++ trunk/Source/bmalloc/ChangeLog 2016-04-22 23:25:54 UTC (rev 199934)
@@ -1,3 +1,18 @@
+2016-04-22 Geoffrey Garen <gga...@apple.com>
+
+ bmalloc: Constify introspect function pointer table
+ https://bugs.webkit.org/show_bug.cgi?id=156936
+
+ Reviewed by Michael Saboff.
+
+ * bmalloc/Zone.cpp:
+ (bmalloc::Zone::Zone): Declaring this function pointer table const puts
+ it in the read-only section of the binary, providing a little hardening
+ against overwriting the function pointers at runtime. (We have to
+ const_cast when assigning because the API declares a pointer to non-const,
+ but we happen to know it will never try to write through that pointer.
+ This is not my favorite API.)
+
2016-04-19 Geoffrey Garen <gga...@apple.com>
bmalloc: fix up overflow checks
Modified: trunk/Source/bmalloc/bmalloc/Zone.cpp (199933 => 199934)
--- trunk/Source/bmalloc/bmalloc/Zone.cpp 2016-04-22 23:10:27 UTC (rev 199933)
+++ trunk/Source/bmalloc/bmalloc/Zone.cpp 2016-04-22 23:25:54 UTC (rev 199934)
@@ -104,7 +104,7 @@
// The memory analysis API requires the contents of this struct to be a static
// constant in the program binary. The leaks process will load this struct
// out of the program binary (and not out of the running process).
-static malloc_introspection_t zoneIntrospect = {
+static const malloc_introspection_t zoneIntrospect = {
.enumerator = bmalloc::enumerator,
.good_size = bmalloc::good_size,
.check = bmalloc::check,
@@ -119,7 +119,7 @@
{
malloc_zone_t::size = &bmalloc::zoneSize;
malloc_zone_t::zone_name = "WebKit Malloc";
- malloc_zone_t::introspect = &bmalloc::zoneIntrospect;
+ malloc_zone_t::introspect = const_cast<malloc_introspection_t*>(&bmalloc::zoneIntrospect);
malloc_zone_t::version = 4;
malloc_zone_register(this);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes