]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Valgrind reports INTERNAL ERROR in rt_sigsuspend syscall wrapper.
authorIvo Raisr <ivosh@ivosh.net>
Tue, 25 Apr 2017 06:44:28 +0000 (06:44 +0000)
committerIvo Raisr <ivosh@ivosh.net>
Tue, 25 Apr 2017 06:44:28 +0000 (06:44 +0000)
Fixes BZ#379094.

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

NEWS
coregrind/m_syswrap/syswrap-linux.c
memcheck/tests/x86-linux/scalar.c
memcheck/tests/x86-linux/scalar.stderr.exp

diff --git a/NEWS b/NEWS
index 24c38e03c811da220eaa73e912c8274cb2895c7e..ef90dbedd5d910ea80a509dc4026839337c729db 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -156,6 +156,7 @@ where XXXXXX is the bug number as listed below.
 377930  fcntl syscall wrapper is missing flock structure check
 378535  Valgrind reports INTERNAL ERROR in execve syscall wrapper
 378673  Update libiberty demangler
+379094  Valgrind reports INTERNAL ERROR in rt_sigsuspend syscall wrapper
 
 Release 3.12.0 (20 October 2016)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 69e4a18fd65adcf88efd816ba086d44b0299363c..85a1101c5682d90cebd8cef188c91fb4c7f3162b 100644 (file)
@@ -3995,12 +3995,16 @@ PRE(sys_rt_sigsuspend)
    PRE_REG_READ2(int, "rt_sigsuspend", vki_sigset_t *, mask, vki_size_t, size)
    if (ARG1 != (Addr)NULL) {
       PRE_MEM_READ( "rt_sigsuspend(mask)", ARG1, sizeof(vki_sigset_t) );
-      VG_(sigdelset)((vki_sigset_t*)ARG1, VG_SIGVGKILL); 
-      /* We cannot mask VG_SIGVGKILL, as otherwise this thread would not
-         be killable by VG_(nuke_all_threads_except).
-         We thus silently ignore the user request to mask this signal.
-         Note that this is similar to what is done for e.g.
-         sigprocmask (see m_signals.c calculate_SKSS_from_SCSS).  */
+      if (ML_(safe_to_deref)((vki_sigset_t *) ARG1, sizeof(vki_sigset_t))) {
+         VG_(sigdelset)((vki_sigset_t *) ARG1, VG_SIGVGKILL);
+         /* We cannot mask VG_SIGVGKILL, as otherwise this thread would not
+            be killable by VG_(nuke_all_threads_except).
+            We thus silently ignore the user request to mask this signal.
+            Note that this is similar to what is done for e.g.
+            sigprocmask (see m_signals.c calculate_SKSS_from_SCSS). */
+      } else {
+         SET_STATUS_Failure(VKI_EFAULT);
+      }
    }
 }
 
index ebf21cf9f884f542af4e973fe1f7f64f9a7e3a78..0468d9e8dc5600df5002dd05590be45e404bb433 100644 (file)
@@ -800,8 +800,8 @@ int main(void)
    SY(__NR_rt_sigqueueinfo, x0, x0+1, x0); FAIL;
 
    // __NR_rt_sigsuspend 179
-   GO(__NR_rt_sigsuspend, "ignore");
-   // (I don't know how to test this...)
+   GO(__NR_rt_sigsuspend, "2s 1m");
+   SY(__NR_rt_sigsuspend, x0 + 1, x0 + sizeof(sigset_t)); FAILx(EFAULT);
 
    // __NR_pread64 180
    GO(__NR_pread64, "5s 1m");
index b5dd8584b754fd4dc8bd1d2a37de66d0df3f329b..88ddb46b171a614f5e7f687abc8c6508cce4f977 100644 (file)
@@ -2343,8 +2343,21 @@ Syscall param rt_sigqueueinfo(uinfo) points to unaddressable byte(s)
  Address 0x........ is not stack'd, malloc'd or (recently) free'd
 
 -----------------------------------------------------
-179:  __NR_rt_sigsuspend ignore
+179:  __NR_rt_sigsuspend 2s 1m
 -----------------------------------------------------
+Syscall param rt_sigsuspend(mask) contains uninitialised byte(s)
+   ...
+   by 0x........: main (scalar.c:804)
+
+Syscall param rt_sigsuspend(size) contains uninitialised byte(s)
+   ...
+   by 0x........: main (scalar.c:804)
+
+Syscall param rt_sigsuspend(mask) points to unaddressable byte(s)
+   ...
+   by 0x........: main (scalar.c:804)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
 -----------------------------------------------------
 180:        __NR_pread64 5s 1m
 -----------------------------------------------------