]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Correcting sys_shmdt wrapper for MIPS Linux.
authorPetar Jovanovic <mips32r2@gmail.com>
Thu, 21 Jun 2012 17:33:35 +0000 (17:33 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Thu, 21 Jun 2012 17:33:35 +0000 (17:33 +0000)
This patch fixes incorrect handling of sys_shmdt for MIPS. Linux wrappers have
been added for sys_sigprocmask, sys_timerfd_create, sys_timerfd_gettime, and
sys_timerfd_settime on MIPS.
The bug has been reported at https://bugs.kde.org/show_bug.cgi?id=270777 as
sh_mat issue, and it can be reproduced with shmat-sample.c from
https://bugs.kde.org/show_bug.cgi?id=222545.
The change also fixes sigprocmask from memcheck tests.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12658

coregrind/m_syswrap/syswrap-linux.c
coregrind/m_syswrap/syswrap-mips32-linux.c

index 7d97b6f800554ffb9d9e47960705d46c5295ef38..d82b1f0fbbea268b2957ad451774039196b92a67 100644 (file)
@@ -2880,7 +2880,8 @@ POST(sys_sigpending)
 // This wrapper is only suitable for 32-bit architectures.
 // (XXX: so how is it that PRE(sys_sigpending) above doesn't need
 // conditional compilation like this?)
-#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux) || defined(VGP_arm_linux)
+#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux) \
+    || defined(VGP_arm_linux) || defined(VGP_mips32_linux)
 PRE(sys_sigprocmask)
 {
    vki_old_sigset_t* set;
index b5ab7c77182d28479a76150e5b71e3b4201f79eb..e4db8c6be16490b437c197fe61eb96205c72d198 100644 (file)
@@ -386,7 +386,6 @@ DECL_TEMPLATE (mips_linux, sys_semget);
 DECL_TEMPLATE (mips_linux, sys_semop);
 DECL_TEMPLATE (mips_linux, sys_semctl);
 DECL_TEMPLATE (mips_linux, sys_semtimedop);
-DECL_TEMPLATE (mips_linux, wrap_sys_shmat);
 DECL_TEMPLATE (mips_linux, sys_shmget);
 DECL_TEMPLATE (mips_linux, sys_shmdt);
 DECL_TEMPLATE (mips_linux, sys_shmctl);
@@ -866,24 +865,6 @@ PRE (sys_shmget)
   PRINT ("sys_shmget ( %ld, %ld, %ld )", ARG1, ARG2, ARG3);
   PRE_REG_READ3 (long, "shmget", vki_key_t, key, vki_size_t, size, int,
                  shmflg);
-} 
-
-PRE (wrap_sys_shmat) 
-{
-  UWord arg2tmp;
-  PRINT ("wrap_sys_shmat ( %ld, %#lx, %ld )", ARG1, ARG2, ARG3);
-  PRE_REG_READ3 (long, "shmat", int, shmid, const void *, shmaddr, int,
-                 shmflg);
-  arg2tmp = ML_ (generic_PRE_sys_shmat) (tid, ARG1, ARG2, ARG3);
-  if (arg2tmp == 0)
-    SET_STATUS_Failure (VKI_EINVAL);
-  else
-    ARG2 = arg2tmp;
-}
-
-POST (wrap_sys_shmat) 
-{
-  ML_ (generic_POST_sys_shmat) (tid, RES, ARG1, ARG2, ARG3);
 }
 
 PRE (sys_shmdt) 
@@ -1159,13 +1140,7 @@ PRE (sys_ipc)
         break;
       case VKI_SHMAT:
         {
-          UWord w;
           PRE_MEM_WRITE ("shmat(raddr)", ARG4, sizeof (Addr));
-          w = ML_ (generic_PRE_sys_shmat) (tid, ARG2, ARG5, ARG3);
-          if (w == 0)
-            SET_STATUS_Failure (VKI_EINVAL);
-          else
-            ARG5 = w;
           break;
         }
       case VKI_SHMDT:
@@ -1571,7 +1546,7 @@ static SyscallTableEntry syscall_main_table[] = {
   //..    LINXY(__NR_adjtimex,          sys_adjtimex),          // 124
   //..
   GENXY (__NR_mprotect, sys_mprotect), // 125
-  //   LINXY(__NR_sigprocmask,       sys_sigprocmask),       // 126
+  LINXY (__NR_sigprocmask, sys_sigprocmask),    // 126
   //..    // Nb: create_module() was removed 2.4-->2.6
   //..    GENX_(__NR_create_module,     sys_ni_syscall),        // 127
   //..    GENX_(__NR_init_module,       sys_init_module),       // 128
@@ -1757,6 +1732,9 @@ static SyscallTableEntry syscall_main_table[] = {
   LINXY (__NR_epoll_pwait, sys_epoll_pwait),   // 313
   LINX_ (__NR_utimensat, sys_utimensat),       // 316
   LINX_ (__NR_fallocate, sys_fallocate),       // 320
+  LINXY (__NR_timerfd_create, sys_timerfd_create),    // 321
+  LINXY (__NR_timerfd_gettime, sys_timerfd_gettime),  // 322
+  LINXY (__NR_timerfd_settime, sys_timerfd_settime),  // 323
   LINXY (__NR_signalfd4, sys_signalfd4),       // 324
   LINX_ (__NR_eventfd2, sys_eventfd2), // 325
   LINXY (__NR_pipe2, sys_pipe2),       // 328