From: Petar Jovanovic Date: Thu, 21 Jun 2012 17:33:35 +0000 (+0000) Subject: Correcting sys_shmdt wrapper for MIPS Linux. X-Git-Tag: svn/VALGRIND_3_8_0~210 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac1b8d6512d6935c6e358b2e029415846fca3b16;p=thirdparty%2Fvalgrind.git Correcting sys_shmdt wrapper for MIPS Linux. 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 --- diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 7d97b6f800..d82b1f0fbb 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -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; diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index b5ab7c7718..e4db8c6be1 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -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