Valgrind reports INTERNAL ERROR in rt_sigsuspend syscall wrapper.

Fixes BZ#379094.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16311
This commit is contained in:
Ivo Raisr 2017-04-25 06:44:28 +00:00
parent 9b7384ae67
commit e8a32aa888
4 changed files with 27 additions and 9 deletions

1
NEWS
View File

@ -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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View 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);
}
}
}

View 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");

View 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
-----------------------------------------------------