From: Nicholas Nethercote Date: Wed, 15 Jul 2009 06:39:15 +0000 (+0000) Subject: Add support on Darwin for mount(). Finishes off bug 198624. X-Git-Tag: svn/VALGRIND_3_5_0~386 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9ca3448218f1a7d10c2cff0496c2fe0309c9c2d9;p=thirdparty%2Fvalgrind.git Add support on Darwin for mount(). Finishes off bug 198624. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10461 --- diff --git a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h index b4c5fbf550..bd0d64c0da 100644 --- a/coregrind/m_syswrap/priv_syswrap-darwin.h +++ b/coregrind/m_syswrap/priv_syswrap-darwin.h @@ -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 diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index 4a37f4d1b8..4a9dcd9555 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -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 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index a02ad8d461..cc14c9c5d9 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -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); diff --git a/memcheck/tests/darwin/scalar.c b/memcheck/tests/darwin/scalar.c index 55ec84e815..8a5c2389e7 100644 --- a/memcheck/tests/darwin/scalar.c +++ b/memcheck/tests/darwin/scalar.c @@ -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"); diff --git a/memcheck/tests/darwin/scalar.stderr.exp b/memcheck/tests/darwin/scalar.stderr.exp index 9730999605..230809705c 100644 --- a/memcheck/tests/darwin/scalar.stderr.exp +++ b/memcheck/tests/darwin/scalar.stderr.exp @@ -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) ...