]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Solaris: Add syscall wrapper for sigsendsys(108)
authorIvo Raisr <ivosh@ivosh.net>
Sun, 20 Nov 2016 05:19:02 +0000 (05:19 +0000)
committerIvo Raisr <ivosh@ivosh.net>
Sun, 20 Nov 2016 05:19:02 +0000 (05:19 +0000)
n-i-bz

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

coregrind/m_syswrap/syswrap-solaris.c
include/vki/vki-scnums-solaris.h
include/vki/vki-solaris.h
memcheck/tests/solaris/scalar.c
memcheck/tests/solaris/scalar.stderr.exp

index edc6672993e0454b8b069f421fe5d6c373e73687..674674f77a5fee92ba8034c5b0eddf0916e0ae68 100644 (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 */
index aba743c13e2e07602e6542fb48ae6c0bff80fd38..a788801da62515a9d85f66623482eef493e8c958 100644 (file)
 #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
index 4a74698e2c0d3d69bfd993affb785b9a9f69243e..eb6d82a8a8c359a2b180c7af6bf56ba246100679 100644 (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
 
 
index 36bd4090a2d330c1186085f7a116f66496e1c2be..c96b6626abe844a58ef4a05b2764f0767d5ab8cf 100644 (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. */
index c9c9d586256ae99dc38857886d524930aadb1e78..274345483e28fe95c22e6a66696883ece267393c 100644 (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
 ---------------------------------------------------------