From: Julian Seward Date: Thu, 2 Sep 2010 22:42:14 +0000 (+0000) Subject: darwin: support sys_open_extended, sys_removexattr, sys_fremovexattr. X-Git-Tag: svn/VALGRIND_3_6_0~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=371f1ef15eb29b789ae9d4be5434aff5a8df6beb;p=thirdparty%2Fvalgrind.git darwin: support sys_open_extended, sys_removexattr, sys_fremovexattr. open_extended has the same kludge as chmod_extended/fchmod_extended. Fixes #246549. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11332 --- diff --git a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h index 17ffcc6897..ec99d8b65f 100644 --- a/coregrind/m_syswrap/priv_syswrap-darwin.h +++ b/coregrind/m_syswrap/priv_syswrap-darwin.h @@ -295,8 +295,8 @@ DECL_TEMPLATE(darwin, getxattr); // 234 DECL_TEMPLATE(darwin, fgetxattr); // 235 DECL_TEMPLATE(darwin, setxattr); // 236 DECL_TEMPLATE(darwin, fsetxattr); // 237 -// NYI removexattr 238 -// NYI fremovexattr 239 +DECL_TEMPLATE(darwin, removexattr); // 238 +DECL_TEMPLATE(darwin, fremovexattr); // 239 DECL_TEMPLATE(darwin, listxattr); // 240 DECL_TEMPLATE(darwin, flistxattr); // 241 DECL_TEMPLATE(darwin, fsctl); // 242 @@ -334,7 +334,7 @@ DECL_TEMPLATE(darwin, sem_post); // 273 // NYI sem_getvalue 274 DECL_TEMPLATE(darwin, sem_init); // 275 DECL_TEMPLATE(darwin, sem_destroy); // 276 -// NYI open_extended 277 +DECL_TEMPLATE(darwin, open_extended) // 277 // NYI umask_extended 278 DECL_TEMPLATE(darwin, stat_extended); // 279 DECL_TEMPLATE(darwin, lstat_extended); // 280 diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index d2c46d83c8..2a929c1bb3 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -1773,6 +1773,27 @@ PRE(fsetxattr) } +PRE(removexattr) +{ + PRINT( "removexattr ( %#lx(%s), %#lx(%s), %ld )", + ARG1, (HChar*)ARG1, ARG2, (HChar*)ARG2, ARG3 ); + PRE_REG_READ3(int, "removexattr", + const char*, "path", char*, "attrname", int, "options"); + PRE_MEM_RASCIIZ( "removexattr(path)", ARG1 ); + PRE_MEM_RASCIIZ( "removexattr(attrname)", ARG2 ); +} + + +PRE(fremovexattr) +{ + PRINT( "fremovexattr ( %ld, %#lx(%s), %ld )", + ARG1, ARG2, (HChar*)ARG2, ARG3 ); + PRE_REG_READ3(int, "fremovexattr", + int, "fd", char*, "attrname", int, "options"); + PRE_MEM_RASCIIZ( "removexattr(attrname)", ARG2 ); +} + + PRE(listxattr) { PRINT( "listxattr ( %#lx(%s), %#lx, %lu, %ld )", @@ -2011,7 +2032,7 @@ PRE(fchmod_extended) chmod_extended is broken in the same way. */ PRINT("fchmod_extended ( %ld, %ld, %ld, %ld, %#lx )", ARG1, ARG2, ARG3, ARG4, ARG5); - PRE_REG_READ5(long, "fchmod", + PRE_REG_READ5(long, "fchmod_extended", unsigned int, fildes, uid_t, uid, gid_t, gid, @@ -2030,7 +2051,7 @@ PRE(chmod_extended) fchmod_extended is broken in the same way. */ PRINT("chmod_extended ( %#lx(%s), %ld, %ld, %ld, %#lx )", ARG1, ARG1 ? (HChar*)ARG1 : "(null)", ARG2, ARG3, ARG4, ARG5); - PRE_REG_READ5(long, "chmod", + PRE_REG_READ5(long, "chmod_extended", unsigned int, fildes, uid_t, uid, gid_t, gid, @@ -2044,6 +2065,28 @@ PRE(chmod_extended) sizeof(struct vki_kauth_filesec) ); } +PRE(open_extended) +{ + /* DDD: Note: this is not really correct. Handling of + {,f}chmod_extended is broken in the same way. */ + PRINT("open_extended ( %#lx(%s), 0x%lx, %ld, %ld, %ld, %#lx )", + ARG1, ARG1 ? (HChar*)ARG1 : "(null)", + ARG2, ARG3, ARG4, ARG5, ARG6); + PRE_REG_READ6(long, "open_extended", + char*, path, + int, flags, + uid_t, uid, + gid_t, gid, + vki_mode_t, mode, + void* /*really,user_addr_t*/, xsecurity); + PRE_MEM_RASCIIZ("open_extended(path)", ARG1); + /* DDD: relative to the xnu sources (kauth_copyinfilesec), this + is just way wrong. [The trouble is with the size, which depends on a + non-trival kernel computation] */ + if (ARG6) + PRE_MEM_READ( "open_extended(xsecurity)", ARG6, + sizeof(struct vki_kauth_filesec) ); +} // This is a ridiculous syscall. Specifically, the 'entries' argument points // to a buffer that contains one or more 'accessx_descriptor' structs followed @@ -7802,8 +7845,8 @@ const SyscallTableEntry ML_(syscall_table)[] = { MACXY(__NR_fgetxattr, fgetxattr), MACX_(__NR_setxattr, setxattr), MACX_(__NR_fsetxattr, fsetxattr), -// _____(__NR_removexattr), -// _____(__NR_fremovexattr), + MACX_(__NR_removexattr, removexattr), + MACX_(__NR_fremovexattr, fremovexattr), MACXY(__NR_listxattr, listxattr), // 240 MACXY(__NR_flistxattr, flistxattr), MACXY(__NR_fsctl, fsctl), @@ -7845,7 +7888,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { // _____(__NR_sem_getvalue), MACXY(__NR_sem_init, sem_init), MACX_(__NR_sem_destroy, sem_destroy), -// _____(__NR_open_extended), + MACX_(__NR_open_extended, open_extended), // 277 // _____(__NR_umask_extended), MACXY(__NR_stat_extended, stat_extended), MACXY(__NR_lstat_extended, lstat_extended), // 280