[compiler-rt] [Sanitizers][Apple] Fix logic bugs that break RestrictMemoryToMaxAddress (PR #124712)

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 12:11:05 PST 2025


================
@@ -1203,7 +1203,7 @@ uptr MapDynamicShadow(uptr shadow_size_bytes, uptr shadow_scale,
   const uptr left_padding =
----------------
delcypher wrote:

`left_padding` now looks unused. However, it looks like this might need passing to `FindAvailableMemoryRange` instead of `granularity` (because the parameter is called `left_padding`).

I think `left_padding` and `granularity` end up being the same at runtime because the assignment is basically

```
const uptr left_padding = Max<uptr>(granularity, 1);
```

and `granularity` is `GetPageSize()` which will always be bigger than 1 because the page size is 4K or 16K for Apple platforms.



https://github.com/llvm/llvm-project/pull/124712


More information about the llvm-commits mailing list