Solaris: Add syscall wrapper for sigsendsys(108)

n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16145
This commit is contained in:
Ivo Raisr 2016-11-20 05:19:02 +00:00
parent 8e08fc91ec
commit 8f6ff4a27b
5 changed files with 70 additions and 2 deletions

View File

@ -966,6 +966,7 @@ DECL_TEMPLATE(solaris, sys_statvfs);
DECL_TEMPLATE(solaris, sys_fstatvfs);
DECL_TEMPLATE(solaris, sys_nfssys);
DECL_TEMPLATE(solaris, sys_waitid);
DECL_TEMPLATE(solaris, sys_sigsendsys);
#if defined(SOLARIS_UTIMESYS_SYSCALL)
DECL_TEMPLATE(solaris, sys_utimesys);
#endif /* SOLARIS_UTIMESYS_SYSCALL */
@ -5130,6 +5131,57 @@ POST(sys_waitid)
POST_MEM_WRITE(ARG3, sizeof(vki_siginfo_t));
}
PRE(sys_sigsendsys)
{
/* int sigsendsys(procset_t *psp, int sig); */
PRINT("sys_sigsendsys( %#lx, %ld )", ARG1, SARG2);
PRE_REG_READ2(long, "sigsendsys", vki_procset_t *, psp, int, signal);
PRE_MEM_READ("sigsendsys(psp)", ARG1, sizeof(vki_procset_t));
if (!ML_(client_signal_OK)(ARG1)) {
SET_STATUS_Failure(VKI_EINVAL);
}
if (!ML_(safe_to_deref)((void *) ARG1, sizeof(vki_procset_t))) {
SET_STATUS_Failure(VKI_EFAULT);
}
/* Exit early if there are problems. */
if (FAILURE)
return;
vki_procset_t *psp = (vki_procset_t *) ARG1;
switch (psp->p_op) {
case VKI_POP_AND:
break;
default:
VG_(unimplemented)("Syswrap of the sigsendsys call with op %u.",
psp->p_op);
}
vki_id_t pid;
if ((psp->p_lidtype == VKI_P_PID) && (psp->p_ridtype == VKI_P_ALL)) {
pid = psp->p_lid;
} else if ((psp->p_lidtype == VKI_P_ALL) && (psp->p_ridtype == VKI_P_PID)) {
pid = psp->p_rid;
} else {
VG_(unimplemented)("Syswrap of the sigsendsys call with lidtype %u and"
"ridtype %u.", psp->p_lidtype, psp->p_ridtype);
}
if (VG_(clo_trace_signals))
VG_(message)(Vg_DebugMsg, "sigsendsys: sending signal to process %u\n",
pid);
/* Handle SIGKILL specially. */
if (ARG2 == VKI_SIGKILL && ML_(do_sigkill)(pid, -1)) {
SET_STATUS_Success(0);
return;
}
/* Check to see if this gave us a pending signal. */
*flags |= SfPollAfter;
}
#if defined(SOLARIS_UTIMESYS_SYSCALL)
PRE(sys_utimesys)
{
@ -10749,6 +10801,7 @@ static SyscallTableEntry syscall_table[] = {
SOLXY(__NR_fstatvfs, sys_fstatvfs), /* 104 */
SOLXY(__NR_nfssys, sys_nfssys), /* 106 */
SOLXY(__NR_waitid, sys_waitid), /* 107 */
SOLX_(__NR_sigsendsys, sys_sigsendsys), /* 108 */
#if defined(SOLARIS_UTIMESYS_SYSCALL)
SOLX_(__NR_utimesys, sys_utimesys), /* 110 */
#endif /* SOLARIS_UTIMESYS_SYSCALL */

View File

@ -157,7 +157,7 @@
#define __NR_nfssys SYS_nfssys
#define __NR_waitid SYS_waitid
#define __NR_waitsys SYS_waitsys /* = SYS_waitid (historical) */
//#define __NR_sigsendsys SYS_sigsendsys
#define __NR_sigsendsys SYS_sigsendsys
//#define __NR_hrtsys SYS_hrtsys
#if defined(SOLARIS_UTIMESYS_SYSCALL)
#define __NR_utimesys SYS_utimesys

View File

@ -814,6 +814,7 @@ typedef struct vki_kcf_door_arg_s {
#define VKI_P_PID P_PID
#define VKI_P_PGID P_PGID
#define VKI_P_ALL P_ALL
#define VKI_POP_AND POP_AND
#define vki_procset_t procset_t

View File

@ -1934,7 +1934,8 @@ int main(void)
SY(SYS_waitid, x0 - 1, x0, x0, x0); FAIL;
/* SYS_sigsendsys 108 */
/* XXX Missing wrapper. */
GO(SYS_sigsendsys, "2s 1m");
SY(SYS_sigsendsys, x0 - 1, x0); FAIL;
/* SYS_hrtsys 109 */
/* XXX Missing wrapper. */

View File

@ -1850,6 +1850,19 @@ Syscall param waitid(infop) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
108: SYS_sigsendsys 2s 1m
---------------------------------------------------------
Syscall param sigsendsys(psp) contains uninitialised byte(s)
...
Syscall param sigsendsys(signal) contains uninitialised byte(s)
...
Syscall param sigsendsys(psp) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
111: SYS_sigresend 3s 2m
---------------------------------------------------------