Auto merge of #18668 - bholley:mprotect_diagnostics, r=Manishearth

Add mprotect diagnostics for HashMap crash

https://bugzilla.mozilla.org/show_bug.cgi?id=1403397

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18668)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-09-28 19:10:46 -05:00 committed by GitHub
commit 5d2ac4aa2e
17 changed files with 451 additions and 9 deletions

View file

@ -17,6 +17,7 @@ gecko_debug = ["style/gecko_debug"]
atomic_refcell = "0.1"
cssparser = "0.21.1"
env_logger = {version = "0.4", default-features = false} # disable `regex` to reduce code size
hashglobe = {path = "../../components/hashglobe"}
libc = "0.2"
log = {version = "0.3.5", features = ["release_max_level_info"]}
malloc_size_of = {path = "../../components/malloc_size_of"}

View file

@ -181,6 +181,10 @@ pub extern "C" fn Servo_Initialize(dummy_url_data: *mut URLExtraData) {
// Initialize the dummy url data
unsafe { DUMMY_URL_DATA = dummy_url_data; }
// Set the system page size.
let page_size = unsafe { bindings::Gecko_GetSystemPageSize() };
::hashglobe::SYSTEM_PAGE_SIZE.store(page_size, ::std::sync::atomic::Ordering::Relaxed);
}
#[no_mangle]
@ -4052,3 +4056,9 @@ pub extern "C" fn Servo_HasPendingRestyleAncestor(element: RawGeckoElementBorrow
}
false
}
#[no_mangle]
pub extern "C" fn Servo_CorruptRuleHashAndCrash(set: RawServoStyleSetBorrowed, index: usize) {
let per_doc_data = PerDocumentStyleData::from_ffi(set).borrow();
per_doc_data.stylist.corrupt_rule_hash_and_crash(index);
}

View file

@ -6,6 +6,7 @@
extern crate cssparser;
extern crate env_logger;
extern crate hashglobe;
extern crate libc;
#[macro_use] extern crate log;
extern crate malloc_size_of;