Skip to content

Commit a976e3c

Browse files
authored
[compiler-rt][Fuchsia] Propogate raw_report to UnmapOrDieVmar (#82566)
As of #77488, UnmapOrDie now accepts raw_report which allows the program to crash without calling Report(). We should propogate this value through UnmapOrDieVmar and have that call ReportMunmapFailureAndDie which uses `raw_report`.
1 parent d62ca8d commit a976e3c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ uptr ReservedAddressRange::MapOrDie(uptr fixed_addr, uptr map_size,
288288
name ? name : name_, true);
289289
}
290290

291-
void UnmapOrDieVmar(void *addr, uptr size, zx_handle_t target_vmar) {
291+
void UnmapOrDieVmar(void *addr, uptr size, zx_handle_t target_vmar,
292+
bool raw_report) {
292293
if (!addr || !size)
293294
return;
294295
size = RoundUpTo(size, GetPageSize());
@@ -301,11 +302,8 @@ void UnmapOrDieVmar(void *addr, uptr size, zx_handle_t target_vmar) {
301302
status = _zx_vmar_unmap(_zx_vmar_root_self(),
302303
reinterpret_cast<uintptr_t>(addr), size);
303304
}
304-
if (status != ZX_OK) {
305-
Report("ERROR: %s failed to deallocate 0x%zx (%zd) bytes at address %p\n",
306-
SanitizerToolName, size, size, addr);
307-
CHECK("unable to unmap" && 0);
308-
}
305+
if (status != ZX_OK)
306+
ReportMunmapFailureAndDie(addr, size, status, raw_report);
309307

310308
DecreaseTotalMmap(size);
311309
}
@@ -327,7 +325,8 @@ void ReservedAddressRange::Unmap(uptr addr, uptr size) {
327325
}
328326
// Partial unmapping does not affect the fact that the initial range is still
329327
// reserved, and the resulting unmapped memory can't be reused.
330-
UnmapOrDieVmar(reinterpret_cast<void *>(addr), size, vmar);
328+
UnmapOrDieVmar(reinterpret_cast<void *>(addr), size, vmar,
329+
/*raw_report=*/false);
331330
}
332331

333332
// This should never be called.
@@ -413,8 +412,8 @@ void *MmapAlignedOrDieOnFatalError(uptr size, uptr alignment,
413412
return reinterpret_cast<void *>(addr);
414413
}
415414

416-
void UnmapOrDie(void *addr, uptr size, bool) {
417-
UnmapOrDieVmar(addr, size, gSanitizerHeapVmar);
415+
void UnmapOrDie(void *addr, uptr size, bool raw_report) {
416+
UnmapOrDieVmar(addr, size, gSanitizerHeapVmar, raw_report);
418417
}
419418

420419
void ReleaseMemoryPagesToOS(uptr beg, uptr end) {

0 commit comments

Comments
 (0)