[compiler-rt] r179002 - [msan] Intercept time().

Chandler Carruth chandlerc at google.com
Mon Apr 8 01:40:39 PDT 2013


Posting here as you won't get the blame email from at least one build bot
due to a bug (that I sent an email to Galina about):

http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/3551/steps/compile/logs/stdio

I think this is from your commit.


On Mon, Apr 8, 2013 at 1:25 AM, Evgeniy Stepanov
<eugeni.stepanov at gmail.com>wrote:

> Author: eugenis
> Date: Mon Apr  8 03:25:22 2013
> New Revision: 179002
>
> URL: http://llvm.org/viewvc/llvm-project?rev=179002&view=rev
> Log:
> [msan] Intercept time().
>
> Modified:
>     compiler-rt/trunk/lib/msan/tests/msan_test.cc
>
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
>
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
>
> 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=179002&r1=179001&r2=179002&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/msan/tests/msan_test.cc (original)
> +++ compiler-rt/trunk/lib/msan/tests/msan_test.cc Mon Apr  8 03:25:22 2013
> @@ -889,6 +889,14 @@ TEST(MemorySanitizer, getitimer) {
>    assert(!res);
>  }
>
> +TEST(MemorySanitizer, time) {
> +  time_t t;
> +  EXPECT_POISONED(t);
> +  time_t t2 = time(&t);
> +  assert(t2 != (time_t)-1);
> +  EXPECT_NOT_POISONED(t);
> +}
> +
>  TEST(MemorySanitizer, localtime) {
>    time_t t = 123;
>    struct tm *time = localtime(&t);
>
> 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=179002&r1=179001&r2=179002&view=diff
>
> ==============================================================================
> ---
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
> (original)
> +++
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
> Mon Apr  8 03:25:22 2013
> @@ -230,6 +230,24 @@ INTERCEPTOR(int, prctl, int option,
>  #define INIT_PRCTL
>  #endif // SANITIZER_INTERCEPT_PRCTL
>
> +
> +#if SANITIZER_INTERCEPT_TIME
> +INTERCEPTOR(unsigned long, time, unsigned long *t) {
> +  void *ctx;
> +  COMMON_INTERCEPTOR_ENTER(ctx, time, t);
> +  unsigned long res = REAL(time)(t);
> +  if (res != -1) {
> +    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, t, sizeof(*t));
> +  }
> +  return res;
> +}
> +#define INIT_TIME                                \
> +  INTERCEPT_FUNCTION(time);
> +#else
> +#define INIT_TIME
> +#endif // SANITIZER_INTERCEPT_TIME
> +
> +
>  #if SANITIZER_INTERCEPT_LOCALTIME_AND_FRIENDS
>  INTERCEPTOR(void *, localtime, unsigned long *timep) {
>    void *ctx;
> @@ -548,4 +566,5 @@ INTERCEPTOR(int, setitimer, int which, c
>    INIT_GETPWNAM_GETPWUID;
>      \
>    INIT_GETPWNAM_R_GETPWUID_R;
>      \
>    INIT_CLOCK_GETTIME;
>      \
> -  INIT_GETITIMER;
> +  INIT_GETITIMER;
>      \
> +  INIT_TIME;
>
> Modified:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=179002&r1=179001&r2=179002&view=diff
>
> ==============================================================================
> ---
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
> (original)
> +++
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
> Mon Apr  8 03:25:22 2013
> @@ -63,3 +63,4 @@
>      SI_MAC || SI_LINUX_NOT_ANDROID
>  # define SANITIZER_INTERCEPT_CLOCK_GETTIME SI_LINUX
>  # define SANITIZER_INTERCEPT_GETITIMER SI_NOT_WINDOWS
> +# define SANITIZER_INTERCEPT_TIME SI_NOT_WINDOWS
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130408/57b102a1/attachment.html>


More information about the llvm-commits mailing list