[msan] Check qsort input.
authorEvgenii Stepanov <eugenis@google.com>
Fri, 20 Dec 2019 20:07:04 +0000 (12:07 -0800)
committerEvgenii Stepanov <eugenis@google.com>
Mon, 6 Jan 2020 23:07:02 +0000 (15:07 -0800)
commitb5e7f95cfbeb28ff8b966a2b7e38a03f32410030
treef21db342c30a91c23340f16598bcc2abe558c1ee
parent59fadc14eeb1d63177b76147b26348a106ac1f9b
[msan] Check qsort input.

Summary:
Qsort interceptor suppresses all checks by unpoisoning the data in the
wrapper of a comparator function, and then unpoisoning the output array
as well.

This change adds an explicit run of the comparator on all elements of
the input array to catch any sanitizer bugs.

Reviewers: vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D71780
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/test/msan/qsort.cpp