tsan: tolerate munmap with invalid arguments
We call UnmapShadow before the actual munmap, at that point we don't yet know if the provided address/size are sane. We can't call UnmapShadow after the actual munmap becuase at that point the memory range can already be reused for something else, so we can't rely on the munmap return value to understand is the values are sane. While calling munmap with insane values (non-canonical address, negative size, etc) is an error, the kernel won't crash. We must also try to not crash as the failure mode is very confusing (paging fault inside of the runtime on some derived shadow address). Such invalid arguments are observed on Chromium tests: https://bugs.chromium.org/p/chromium/issues/detail?id=1275581 Reviewed By: melver Differential Revision: https://reviews.llvm.org/D114944
Loading
Please sign in to comment