]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Solaris: Add ioctl wrapper for MNTIOC_GETEXTMNTENT.
authorIvo Raisr <ivosh@ivosh.net>
Fri, 23 Sep 2016 23:00:21 +0000 (23:00 +0000)
committerIvo Raisr <ivosh@ivosh.net>
Fri, 23 Sep 2016 23:00:21 +0000 (23:00 +0000)
n-i-bz

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

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

index 9e5640d22954b4ab1386b7f2b18fbbfbae32cd78..64aeb827fc33c5526c8ca2661d7498a6d36cf5b6 100644 (file)
@@ -3042,6 +3042,21 @@ PRE(sys_ioctl)
       break;
 
    /* mntio */
+   case VKI_MNTIOC_GETEXTMNTENT:
+      {
+         PRE_MEM_READ("ioctl(MNTIOC_GETEXTMNTENT)",
+                      ARG3, sizeof(struct vki_mntentbuf));
+
+         struct vki_mntentbuf *embuf = (struct vki_mntentbuf *) ARG3;
+         if (ML_(safe_to_deref(embuf, sizeof(*embuf)))) {
+            PRE_MEM_WRITE("ioctl(MNTIOC_GETEXTMNTENT, embuf->mbuf_emp)",
+                          (Addr) embuf->mbuf_emp, sizeof(struct vki_extmnttab));
+            PRE_MEM_WRITE("ioctl(MNTIOC_GETEXTMNTENT, embuf->mbuf_buf)",
+                          (Addr) embuf->mbuf_buf, embuf->mbuf_bufsize);
+         }
+      }
+      break;
+
    case VKI_MNTIOC_GETMNTANY:
       {
          PRE_MEM_READ("ioctl(MNTIOC_GETMNTANY)",
@@ -3050,13 +3065,11 @@ PRE(sys_ioctl)
          struct vki_mntentbuf *embuf = (struct vki_mntentbuf *) ARG3;
          if (ML_(safe_to_deref(embuf, sizeof(*embuf)))) {
             PRE_MEM_READ("ioctl(MNTIOC_GETMNTANY, embuf->mbuf_emp)",
-                         (Addr) embuf->mbuf_emp,
-                         sizeof(struct vki_mnttab));
+                         (Addr) embuf->mbuf_emp, sizeof(struct vki_mnttab));
             PRE_MEM_WRITE("ioctl(MNTIOC_GETMNTANY, embuf->mbuf_buf)",
-                          (Addr) embuf->mbuf_buf,
-                          embuf->mbuf_bufsize);
-            struct vki_mnttab *mnt
-               = (struct vki_mnttab *) embuf->mbuf_emp;
+                          (Addr) embuf->mbuf_buf, embuf->mbuf_bufsize);
+
+            struct vki_mnttab *mnt = (struct vki_mnttab *) embuf->mbuf_emp;
             if (ML_(safe_to_deref(mnt, sizeof(struct vki_mnttab)))) {
                if (mnt->mnt_special != NULL)
                   PRE_MEM_RASCIIZ("ioctl(MNTIOC_GETMNTANY, mnt->mnt_special)",
@@ -3331,6 +3344,32 @@ POST(sys_ioctl)
       break;
 
    /* mntio */
+   case VKI_MNTIOC_GETEXTMNTENT:
+      {
+         struct vki_mntentbuf *embuf = (struct vki_mntentbuf *) ARG3;
+         struct vki_extmnttab *mnt = (struct vki_extmnttab *) embuf->mbuf_emp;
+
+         POST_MEM_WRITE((Addr) mnt, sizeof(struct vki_extmnttab));
+         if (mnt != NULL) {
+            if (mnt->mnt_special != NULL)
+               POST_MEM_WRITE((Addr) mnt->mnt_special,
+                              VG_(strlen)(mnt->mnt_special) + 1);
+            if (mnt->mnt_mountp != NULL)
+               POST_MEM_WRITE((Addr) mnt->mnt_mountp,
+                              VG_(strlen)(mnt->mnt_mountp) + 1);
+            if (mnt->mnt_fstype != NULL)
+               POST_MEM_WRITE((Addr) mnt->mnt_fstype,
+                              VG_(strlen)(mnt->mnt_fstype) + 1);
+            if (mnt->mnt_mntopts != NULL)
+               POST_MEM_WRITE((Addr) mnt->mnt_mntopts,
+                              VG_(strlen)(mnt->mnt_mntopts) + 1);
+            if (mnt->mnt_time != NULL)
+               POST_MEM_WRITE((Addr) mnt->mnt_time,
+                              VG_(strlen)(mnt->mnt_time) + 1);
+         }
+      }
+      break;
+
    case VKI_MNTIOC_GETMNTANY:
       {
          struct vki_mntentbuf *embuf = (struct vki_mntentbuf *) ARG3;
index 113813afbf9f9c8e0046d542d4daa5e4ebee478d..002b2dfa0cbf3dc2b41fada5b26bf9070d25f028 100644 (file)
@@ -644,10 +644,12 @@ typedef struct vki_kcf_door_arg_s {
 
 
 #include <sys/mntio.h>
+#define VKI_MNTIOC_GETEXTMNTENT MNTIOC_GETEXTMNTENT
 #define VKI_MNTIOC_GETMNTANY MNTIOC_GETMNTANY
 
 
 #include <sys/mnttab.h>
+#define vki_extmnttab extmnttab
 #define vki_mntentbuf mntentbuf
 #define vki_mnttab mnttab
 
index 855c5ff94189f58e287fb48a48243605870130b7..e9e70eee56a262e095c5bcc5505e63703594be5d 100644 (file)
@@ -27,6 +27,46 @@ static void sys_ioctl_POOL_STATUSQ(void)
 }
 
 /* mntio */
+__attribute__((noinline))
+static void sys_ioctl_MNTIOC_GETEXTMNTENT(void)
+{
+   GO(SYS_ioctl, "(MNTIOC_GETEXTMNTENT) 3s 1m");
+   SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETEXTMNTENT, x0 + 1); FAIL;
+}
+
+__attribute__((noinline))
+static void sys_ioctl_MNTIOC_GETEXTMNTENT_2(void)
+{
+   struct mntentbuf embuf;
+
+   embuf.mbuf_emp = (void *) (x0 + 1);
+   embuf.mbuf_buf = (void *) (x0 + 1);
+   embuf.mbuf_bufsize = x0 + 1;
+
+   GO(SYS_ioctl, "(MNTIOC_GETEXTMNTENT) 4s 2m");
+   SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETEXTMNTENT, &embuf + x0); FAIL;
+}
+
+__attribute__((noinline))
+static void sys_ioctl_MNTIOC_GETEXTMNTENT_3(void)
+{
+   struct extmnttab mnt;
+   struct mntentbuf embuf;
+
+   mnt.mnt_special = (void *) (x0 + 1);
+   mnt.mnt_mountp = (void *) (x0 + 1);
+   mnt.mnt_fstype = (void *) (x0 + 1);
+   mnt.mnt_mntopts = (void *) (x0 + 1);
+   mnt.mnt_time = (void *) (x0 + 1);
+
+   embuf.mbuf_emp = x0 + &mnt;
+   embuf.mbuf_buf = (void *) (x0 + 1);
+   embuf.mbuf_bufsize = x0 + 1;
+
+   GO(SYS_ioctl, "(MNTIOC_GETEXTMNTENT) 5s 6m");
+   SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETEXTMNTENT, &embuf + x0); FAIL;
+}
+
 __attribute__((noinline))
 static void sys_ioctl_MNTIOC_GETMNTANY(void)
 {
@@ -484,6 +524,9 @@ int main(void)
    sys_ioctl_POOL_STATUSQ();
 
    /* mntio */
+   sys_ioctl_MNTIOC_GETEXTMNTENT();
+   sys_ioctl_MNTIOC_GETEXTMNTENT_2();
+   sys_ioctl_MNTIOC_GETEXTMNTENT_3();
    sys_ioctl_MNTIOC_GETMNTANY();
    sys_ioctl_MNTIOC_GETMNTANY_2();
    sys_ioctl_MNTIOC_GETMNTANY_3();
index 74546391b2391831cb8d6b42ca56aa1774f33b9d..2112c7d73a900ce6a6449ff715979edc84286f3b 100644 (file)
@@ -14,6 +14,66 @@ Syscall param ioctl(POOL_STATUSQ) points to unaddressable byte(s)
    ...
  Address 0x........ is not stack'd, malloc'd or (recently) free'd
 
+---------------------------------------------------------
+ 54:               SYS_ioctl (MNTIOC_GETEXTMNTENT) 3s 1m
+---------------------------------------------------------
+Syscall param ioctl(fd) contains uninitialised byte(s)
+   ...
+
+Syscall param ioctl(request) contains uninitialised byte(s)
+   ...
+
+Syscall param ioctl(arg) contains uninitialised byte(s)
+   ...
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT) points to unaddressable byte(s)
+   ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+ 54:               SYS_ioctl (MNTIOC_GETEXTMNTENT) 4s 2m
+---------------------------------------------------------
+Syscall param ioctl(fd) contains uninitialised byte(s)
+   ...
+
+Syscall param ioctl(request) contains uninitialised byte(s)
+   ...
+
+Syscall param ioctl(arg) contains uninitialised byte(s)
+   ...
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT) points to uninitialised byte(s)
+   ...
+ Address 0x........ is on thread 1's stack
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT, embuf->mbuf_emp) points to unaddressable byte(s)
+   ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT, embuf->mbuf_buf) points to unaddressable byte(s)
+   ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+ 54:               SYS_ioctl (MNTIOC_GETEXTMNTENT) 5s 6m
+---------------------------------------------------------
+Syscall param ioctl(fd) contains uninitialised byte(s)
+   ...
+
+Syscall param ioctl(request) contains uninitialised byte(s)
+   ...
+
+Syscall param ioctl(arg) contains uninitialised byte(s)
+   ...
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT) points to uninitialised byte(s)
+   ...
+ Address 0x........ is on thread 1's stack
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT, embuf->mbuf_buf) points to unaddressable byte(s)
+   ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
 ---------------------------------------------------------
  54:               SYS_ioctl (MNTIOC_GETMNTANY) 3s 1m
 ---------------------------------------------------------
@@ -343,6 +403,9 @@ Syscall param ioctl(I_STR, strioctl->ic_dp) points to unaddressable byte(s)
 ---------------------------------------------------------
  54:               SYS_ioctl (I_FIND) 3s 1m
 ---------------------------------------------------------
+
+More than 100 errors detected.  Subsequent errors
+will still be recorded, but in less detail than before.
 Syscall param ioctl(fd) contains uninitialised byte(s)
    ...
 
@@ -402,9 +465,6 @@ Syscall param ioctl(I_PEEK, strpeek->flags) points to unaddressable byte(s)
 Syscall param ioctl(fd) contains uninitialised byte(s)
    ...
 
-
-More than 100 errors detected.  Subsequent errors
-will still be recorded, but in less detail than before.
 Syscall param ioctl(request) contains uninitialised byte(s)
    ...