Skip to content

[compiler-rt][Fuchsia] Propogate raw_report to UnmapOrDieVmar #82566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ uptr ReservedAddressRange::MapOrDie(uptr fixed_addr, uptr map_size,
name ? name : name_, true);
}

void UnmapOrDieVmar(void *addr, uptr size, zx_handle_t target_vmar) {
void UnmapOrDieVmar(void *addr, uptr size, zx_handle_t target_vmar,
bool raw_report) {
if (!addr || !size)
return;
size = RoundUpTo(size, GetPageSize());
Expand All @@ -301,11 +302,8 @@ void UnmapOrDieVmar(void *addr, uptr size, zx_handle_t target_vmar) {
status = _zx_vmar_unmap(_zx_vmar_root_self(),
reinterpret_cast<uintptr_t>(addr), size);
}
if (status != ZX_OK) {
Report("ERROR: %s failed to deallocate 0x%zx (%zd) bytes at address %p\n",
SanitizerToolName, size, size, addr);
CHECK("unable to unmap" && 0);
}
if (status != ZX_OK)
ReportMunmapFailureAndDie(addr, size, status, raw_report);

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

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

void UnmapOrDie(void *addr, uptr size, bool) {
UnmapOrDieVmar(addr, size, gSanitizerHeapVmar);
void UnmapOrDie(void *addr, uptr size, bool raw_report) {
UnmapOrDieVmar(addr, size, gSanitizerHeapVmar, raw_report);
}

void ReleaseMemoryPagesToOS(uptr beg, uptr end) {
Expand Down