[PATCH] D17560: [MSan] fix process_vm_readv test: Exit silently if syscall is not implemeted

Mohit Bhakkad via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 00:19:26 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL261723: [MSan] fix process_vm_readv test: Exit silently if syscall is not implemeted (authored by mohit.bhakkad).

Changed prior to commit:
  http://reviews.llvm.org/D17560?vs=48883&id=48889#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17560

Files:
  compiler-rt/trunk/test/msan/Linux/process_vm_readv.cc

Index: compiler-rt/trunk/test/msan/Linux/process_vm_readv.cc
===================================================================
--- compiler-rt/trunk/test/msan/Linux/process_vm_readv.cc
+++ compiler-rt/trunk/test/msan/Linux/process_vm_readv.cc
@@ -9,26 +9,31 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <unistd.h>
+#include <errno.h>
 
 typedef ssize_t (*process_vm_readwritev_fn)(pid_t, const iovec *, unsigned long,
                                             const iovec *, unsigned long,
                                             unsigned long);
 
-int main(void) {
-  // This requires glibc 2.15.
-  process_vm_readwritev_fn libc_process_vm_readv =
-      (process_vm_readwritev_fn)dlsym(RTLD_NEXT, "process_vm_readv");
-  if (!libc_process_vm_readv) {
 // Exit with success, emulating the expected output.
+int exit_dummy()
+{
 #ifdef POSITIVE
-    printf("process_vm_readv not found!\n");
+    printf("process_vm_readv not found or not implemented!\n");
     printf(
         "WARNING: MemorySanitizer: use-of-uninitialized-value (not really)\n");
     return 1;
 #else
     return 0;
 #endif
-  }
+}
+
+int main(void) {
+  // This requires glibc 2.15.
+  process_vm_readwritev_fn libc_process_vm_readv =
+      (process_vm_readwritev_fn)dlsym(RTLD_NEXT, "process_vm_readv");
+  if (!libc_process_vm_readv)
+    return exit_dummy();
 
   process_vm_readwritev_fn process_vm_readv =
       (process_vm_readwritev_fn)dlsym(RTLD_DEFAULT, "process_vm_readv");
@@ -44,6 +49,9 @@
 
   __msan_poison(&b, sizeof(b));
   ssize_t res = process_vm_readv(getpid(), iov_b, 2, iov_a, 2, 0);
+  if (errno == ENOSYS) // Function not implemented 
+    return exit_dummy();
+
   assert(res == 30);
   __msan_check_mem_is_initialized(b + 10, 10);
   __msan_check_mem_is_initialized(b + 30, 20);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17560.48889.patch
Type: text/x-patch
Size: 1803 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160224/b8385d87/attachment.bin>


More information about the llvm-commits mailing list