Solaris: Add ioctl wrapper for MNTIOC_GETEXTMNTENT.

n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15981
This commit is contained in:
Ivo Raisr 2016-09-23 23:00:21 +00:00
parent 45dc581a53
commit 98273bc5f4
4 changed files with 153 additions and 9 deletions

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

View 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

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

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