]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add support on Darwin for mount(). Finishes off bug 198624.
authorNicholas Nethercote <njn@valgrind.org>
Wed, 15 Jul 2009 06:39:15 +0000 (06:39 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Wed, 15 Jul 2009 06:39:15 +0000 (06:39 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10461

coregrind/m_syswrap/priv_syswrap-darwin.h
coregrind/m_syswrap/syswrap-darwin.c
coregrind/m_syswrap/syswrap-linux.c
memcheck/tests/darwin/scalar.c
memcheck/tests/darwin/scalar.stderr.exp

index b4c5fbf5508fa80af3f87477356d0183e38cd089..bd0d64c0da47f86b2eb00fb2e77de10b7d909a41 100644 (file)
@@ -221,7 +221,7 @@ DECL_TEMPLATE(darwin, gethostuuid);             // 142
 // 164
 // NYI quotactl 165
 // old exportfs
-// NYI mount 167
+DECL_TEMPLATE(darwin, mount);                   // 167
 // old ustat
 DECL_TEMPLATE(darwin, csops);                   // 169
 // old table
index 4a37f4d1b88099295c27b6b4d95950c9bf5e6b20..4a9dcd95559f21cda44ea7d93d212be370d35074 100644 (file)
@@ -2114,6 +2114,21 @@ POST(getfsstat64)
    }
 }
 
+PRE(mount)
+{
+   // Nb: depending on 'flags', the 'type' and 'data' args may be ignored.
+   // We are conservative and check everything, except the memory pointed to
+   // by 'data'.
+   *flags |= SfMayBlock;
+   PRINT("sys_mount( %#lx(%s), %#lx(%s), %#lx, %#lx )",
+         ARG1,(Char*)ARG1, ARG2,(Char*)ARG2, ARG3, ARG4);
+   PRE_REG_READ4(long, "mount",
+                 const char *, type, const char *, dir,
+                 int, flags, void *, data);
+   PRE_MEM_RASCIIZ( "mount(type)", ARG1);
+   PRE_MEM_RASCIIZ( "mount(dir)", ARG2);
+}
+
 
 static void scan_attrlist(ThreadId tid, struct vki_attrlist *attrList, 
                           void *attrBuf, SizeT attrBufSize, 
@@ -7261,7 +7276,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(164)),   // ???
 // _____(__NR_quotactl), 
    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(166)),   // old exportfs
-// _____(__NR_mount), 
+   MACX_(__NR_mount,       mount), 
    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(168)),   // old ustat
    MACXY(__NR_csops,       csops),                 // code-signing ops
    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(170)),   // old table
index a02ad8d461c6a201cb7aa4f2065d5dc29cdec0bb..cc14c9c5d973d73f88012c6a2c82b71fe5bd6984 100644 (file)
@@ -387,7 +387,8 @@ PRE(sys_mount)
    // We are conservative and check everything, except the memory pointed to
    // by 'data'.
    *flags |= SfMayBlock;
-   PRINT( "sys_mount( %#lx, %#lx, %#lx, %#lx, %#lx )" ,ARG1,ARG2,ARG3,ARG4,ARG5);
+   PRINT("sys_mount( %#lx(%s), %#lx(%s), %#lx(%s), %#lx, %#lx )",
+         ARG1,(Char*)ARG1, ARG2,(Char*)ARG2, ARG3,(Char*)ARG3, ARG4, ARG5);
    PRE_REG_READ5(long, "mount",
                  char *, source, char *, target, char *, type,
                  unsigned long, flags, void *, data);
index 55ec84e815a2786732363047beb9c95850fbc991..8a5c2389e77d3ccf1b3db386bf77990bc9e82696 100644 (file)
@@ -315,7 +315,8 @@ int main(void)
 
    GO_UNIMP(166, "old exportfs");
 
-   // __NR_mount 167
+   GO(__NR_mount, 167, "4s 2m");
+   SY(__NR_mount, x0, x0, x0, x0); FAIL;
 
    GO_UNIMP(168, "old ustat");
 
index 97309996052f08487661183c204cc81257ca97de..230809705c1d92c3316820f0d58f54147e6f1713 100644 (file)
@@ -424,6 +424,29 @@ Syscall param socketcall.getsockopt(optlen) points to unaddressable byte(s)
 (166):           old exportfs
 -----------------------------------------------------
 -----------------------------------------------------
+x20000a7(167):          __NR_mount 4s 2m
+-----------------------------------------------------
+
+Syscall param mount(type) contains uninitialised byte(s)
+   ...
+
+Syscall param mount(dir) contains uninitialised byte(s)
+   ...
+
+Syscall param mount(flags) contains uninitialised byte(s)
+   ...
+
+Syscall param mount(data) contains uninitialised byte(s)
+   ...
+
+Syscall param mount(type) points to unaddressable byte(s)
+   ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param mount(dir) points to unaddressable byte(s)
+   ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
 (168):           old ustat
 -----------------------------------------------------
 -----------------------------------------------------
@@ -610,6 +633,9 @@ Syscall param sem_post(sem) contains uninitialised byte(s)
 x2000113(275):       __NR_sem_init 3s 1m
 -----------------------------------------------------
 
+More than 100 errors detected.  Subsequent errors
+will still be recorded, but in less detail than before.
+
 Syscall param sem_init(sem) contains uninitialised byte(s)
    ...
 
@@ -636,9 +662,6 @@ Syscall param sem_destroy(sem) points to unaddressable byte(s)
 x2000117(279):  __NR_stat_extended 4s 4m
 -----------------------------------------------------
 
-More than 100 errors detected.  Subsequent errors
-will still be recorded, but in less detail than before.
-
 Syscall param stat_extended(file_name) contains uninitialised byte(s)
    ...