]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix unhandled syscall: unix:132 (mkfifo) on OS X. bz#212291.
authorRhys Kidd <rhyskidd@gmail.com>
Sat, 16 May 2015 14:48:08 +0000 (14:48 +0000)
committerRhys Kidd <rhyskidd@gmail.com>
Sat, 16 May 2015 14:48:08 +0000 (14:48 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15242

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

diff --git a/NEWS b/NEWS
index 40cf7ce75df4d53065b0b36cbb9a40cd53854062..b3e2c4c913286e29e59f5617e33ead58a7340632 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -76,6 +76,8 @@ where XXXXXX is the bug number as listed below.
 201435  Fix Darwin: -v does not show kernel version
 211256  Fixed an outdated comment regarding the default platform.
 211926  Avoid compilation warnings in valgrind.h with -pedantic
+212291  Fix unhandled syscall: unix:132 (mkfifo) on OS X
+        == 263119
 226609  Crediting upstream authors in man page
 231257  Valgrind omits path when executing script from shebang line
 254164  OS X task_info: UNKNOWN task message [id 3405, to mach_task_self(), 
index e6cff5e5ac946baf264c0c920bef508855573cf6..d2c7f0e195ad99ed97113d32e56ab4bdab615fcd 100644 (file)
@@ -189,7 +189,7 @@ DECL_TEMPLATE(darwin, getsockopt);              // 118
 // old truncate
 // old ftruncate
 // GEN flock 131
-// NYI mkfifo 132
+DECL_TEMPLATE(darwin, mkfifo);                  // 132
 DECL_TEMPLATE(darwin, sendto);                  // 133
 DECL_TEMPLATE(darwin, shutdown);                // 134
 DECL_TEMPLATE(darwin, socketpair);              // 135
index 299e7be57ab14da7e7ebb3a295613ad791ff23f3..1ce574ef50f77804b241ed927d7e697189bb4570 100644 (file)
@@ -3590,6 +3590,25 @@ POST(accept)
    SET_STATUS_from_SysRes(r);
 }
 
+PRE(mkfifo)
+{
+   *flags |= SfMayBlock;
+   PRINT("mkfifo ( %#lx(%s), %ld )",ARG1,(char *)ARG1,(vki_mode_t)ARG2);
+   PRE_REG_READ2(long, "mkfifo", const char *, path, vki_mode_t, mode);
+   PRE_MEM_RASCIIZ( "mkfifo(path)", ARG1 );
+}
+
+POST(mkfifo)
+{
+   vg_assert(SUCCESS);
+   if (!ML_(fd_allowed)(RES, "mkfifo", tid, True)) {
+      VG_(close)(RES);
+      SET_STATUS_Failure( VKI_EMFILE );
+   } else {
+      if (VG_(clo_track_fds))
+         ML_(record_fd_open_with_given_name)(tid, RES, (Char*)ARG1);
+   }
+}
 
 PRE(sendto)
 {
@@ -9479,7 +9498,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(129)),   // old truncate
    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(130)),   // old ftruncate
    GENX_(__NR_flock,       sys_flock), 
-// _____(__NR_mkfifo), 
+   MACX_(__NR_mkfifo,      mkfifo),
    MACX_(__NR_sendto,      sendto), 
    MACX_(__NR_shutdown,    shutdown), 
    MACXY(__NR_socketpair,  socketpair), 
index 6834e2810ff2a9bed1bd0cdfd6a932a60ba8d759..1304a7d2be24d567da9d5eb336aeb9b1b79819f2 100644 (file)
@@ -259,7 +259,10 @@ int main(void)
    GO_UNIMP(130, "old ftruncate");
 
    // __NR_flock 131
-   // __NR_mkfifo 132
+
+   GO(__NR_mkfifo, 132, "2s 1m");
+   SY(__NR_mkfifo, x0, x0); FAIL;
+
    // __NR_sendto 133
    // __NR_shutdown 134
    // __NR_socketpair 135
index 001cc737b06ad7eac09bc7e5470a4c9ce18945ef..f8b547cca4784117c07e8ab921dc26d660ab6b8f 100644 (file)
@@ -384,6 +384,19 @@ Syscall param socketcall.getsockopt(optlen) points to unaddressable byte(s)
 -----------------------------------------------------
 -----------------------------------------------------
 (130):           old ftruncate
+-----------------------------------------------------
+-----------------------------------------------------
+x2000084(132):         __NR_mkfifo 2s 1m
+-----------------------------------------------------
+Syscall param mkfifo(mode) contains uninitialised byte(s)
+   ...
+   by 0x........: main (in ./scalar)
+
+Syscall param mkfifo(path) points to unaddressable byte(s)
+   ...
+   by 0x........: main (in ./scalar)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
 -----------------------------------------------------
 -----------------------------------------------------
 (141):           old getpeername