|
From: <sv...@va...> - 2010-09-02 22:42:23
|
Author: sewardj
Date: 2010-09-02 23:42:14 +0100 (Thu, 02 Sep 2010)
New Revision: 11332
Log:
darwin: support sys_open_extended, sys_removexattr, sys_fremovexattr.
open_extended has the same kludge as chmod_extended/fchmod_extended.
Fixes #246549.
Modified:
trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
trunk/coregrind/m_syswrap/syswrap-darwin.c
Modified: trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
===================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-darwin.h 2010-09-02 17:06:49 UTC (rev 11331)
+++ trunk/coregrind/m_syswrap/priv_syswrap-darwin.h 2010-09-02 22:42:14 UTC (rev 11332)
@@ -295,8 +295,8 @@
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 @@
// 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
Modified: trunk/coregrind/m_syswrap/syswrap-darwin.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-darwin.c 2010-09-02 17:06:49 UTC (rev 11331)
+++ trunk/coregrind/m_syswrap/syswrap-darwin.c 2010-09-02 22:42:14 UTC (rev 11332)
@@ -1773,6 +1773,27 @@
}
+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 @@
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 @@
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 @@
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 @@
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 @@
// _____(__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
|