From 20c04a646bcfa20d0828e0d7eae969f262718e48 Mon Sep 17 00:00:00 2001 From: Camsyn Date: Mon, 23 Jun 2025 15:21:34 +0800 Subject: [PATCH] [NFC][Sanitizer] Fix incorrect desc of [beg, end] to [beg, end) Correct the interval desc of ReleaseMemoryPagesToOS from [beg, end] to [beg, end), as it actually does. The previous incorrect description of [beg, end] might cause an incorrect invoke as follows: `ReleaseMemoryPagesToOS(0, kPageSize - 1);` --- compiler-rt/lib/sanitizer_common/sanitizer_common.h | 2 +- compiler-rt/lib/sanitizer_common/sanitizer_linux.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h index d9e7ded593fe..3f52cfcaeeca 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -166,7 +166,7 @@ uptr FindAvailableMemoryRange(uptr size, uptr alignment, uptr left_padding, // Used to check if we can map shadow memory to a fixed location. bool MemoryRangeIsAvailable(uptr range_start, uptr range_end); -// Releases memory pages entirely within the [beg, end] address range. Noop if +// Releases memory pages entirely within the [beg, end) address range. Noop if // the provided range does not contain at least one entire page. void ReleaseMemoryPagesToOS(uptr beg, uptr end); void IncreaseTotalMmap(uptr size); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.h b/compiler-rt/lib/sanitizer_common/sanitizer_linux.h index 6959f785990f..05b7d2e28a61 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.h @@ -130,7 +130,7 @@ bool LibraryNameIs(const char *full_name, const char *base_name); // Call cb for each region mapped by map. void ForEachMappedRegion(link_map *map, void (*cb)(const void *, uptr)); -// Releases memory pages entirely within the [beg, end] address range. +// Releases memory pages entirely within the [beg, end) address range. // The pages no longer count toward RSS; reads are guaranteed to return 0. // Requires (but does not verify!) that pages are MAP_PRIVATE. inline void ReleaseMemoryPagesToOSAndZeroFill(uptr beg, uptr end) {