[compiler-rt] r180090 - [msan] Allow clock_getres(, 0).
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Tue Apr 23 04:48:31 PDT 2013
Author: eugenis
Date: Tue Apr 23 06:48:31 2013
New Revision: 180090
URL: http://llvm.org/viewvc/llvm-project?rev=180090&view=rev
Log:
[msan] Allow clock_getres(, 0).
Modified:
compiler-rt/trunk/lib/msan/tests/msan_test.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
Modified: compiler-rt/trunk/lib/msan/tests/msan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/msan_test.cc?rev=180090&r1=180089&r2=180090&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/msan_test.cc (original)
+++ compiler-rt/trunk/lib/msan/tests/msan_test.cc Tue Apr 23 06:48:31 2013
@@ -880,6 +880,18 @@ TEST(MemorySanitizer, clock_gettime) {
EXPECT_NOT_POISONED(tp.tv_nsec);
}
+TEST(MemorySanitizer, clock_getres) {
+ struct timespec tp;
+ EXPECT_POISONED(tp.tv_sec);
+ EXPECT_POISONED(tp.tv_nsec);
+ assert(0 == clock_getres(CLOCK_REALTIME, 0));
+ EXPECT_POISONED(tp.tv_sec);
+ EXPECT_POISONED(tp.tv_nsec);
+ assert(0 == clock_getres(CLOCK_REALTIME, &tp));
+ EXPECT_NOT_POISONED(tp.tv_sec);
+ EXPECT_NOT_POISONED(tp.tv_nsec);
+}
+
TEST(MemorySanitizer, getitimer) {
struct itimerval it1, it2;
int res;
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=180090&r1=180089&r2=180090&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Tue Apr 23 06:48:31 2013
@@ -492,7 +492,7 @@ INTERCEPTOR(int, clock_getres, u32 clk_i
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, clock_getres, clk_id, tp);
int res = REAL(clock_getres)(clk_id, tp);
- if (!res) {
+ if (!res && tp) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, tp, struct_timespec_sz);
}
return res;
More information about the llvm-commits
mailing list