[all-commits] [llvm/llvm-project] a3a436: [ASAN] Fix validation size for dirent on FreeBSD
Justin Cady via All-commits
all-commits at lists.llvm.org
Wed Jun 7 07:59:59 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a3a4369ea100d8693d45dc21eda9c2c8171b1068
https://github.com/llvm/llvm-project/commit/a3a4369ea100d8693d45dc21eda9c2c8171b1068
Author: Justin Cady <desk at justincady.com>
Date: 2023-06-07 (Wed, 07 Jun 2023)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
M compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h
M compiler-rt/lib/sanitizer_common/sanitizer_posix.h
A compiler-rt/test/sanitizer_common/TestCases/scandir.c
Log Message:
-----------
[ASAN] Fix validation size for dirent on FreeBSD
Typically the size required to represent a dirent is stored in `d_reclen`. But
this not always the case for FreeBSD (for example, when walking a directory
over NFS).
This leads to ASAN false positives for `scandir` and similar functions. Because
ASAN uses `d_reclen` for the range to validate, it can overrun when `d_reclen` is
incorrect (too large).
This change adds `__sanitizer_dirsiz` which fixes the dirent size calculation
for FreeBSD. Other platforms continue to use `d_reclen`.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D151583
More information about the All-commits
mailing list