Ticket #41140: valgrind-osx-106-327745.patch

File valgrind-osx-106-327745.patch, 14.5 KB (added by cooljeanius (Eric Gallager), 11 years ago)

patch from upstream bug report

  • coregrind/m_syswrap/priv_syswrap-darwin.h

    diff -Naur a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h
    a b  
    344344DECL_TEMPLATE(darwin, fchmod_extended);         // 283
    345345DECL_TEMPLATE(darwin, access_extended);         // 284
    346346DECL_TEMPLATE(darwin, settid);                  // 285
    347 // NYI gettid 286
     347DECL_TEMPLATE(darwin, gettid);                  // 286
    348348// NYI setsgroups 287
    349349// NYI getsgroups 288
    350350// NYI setwgroups 289
     
    354354// NYI identitysvc 293
    355355// NYI shared_region_check_np 294
    356356// NYI shared_region_map_np 295
     357#if DARWIN_VERS >= DARWIN_10_6
     358// NYI vm_pressure_monitor 296
     359// NYI psynch_rw_longrdlock 297
     360// NYI psynch_rw_yieldwrlock 298
     361// NYI psynch_rw_downgrade 299
     362// NYI psynch_rw_upgrade 300
     363DECL_TEMPLATE(darwin, psynch_mutexwait);       // 301
     364DECL_TEMPLATE(darwin, psynch_mutexdrop);       // 302
     365DECL_TEMPLATE(darwin, psynch_cvbroad);         // 303
     366DECL_TEMPLATE(darwin, psynch_cvsignal);        // 304
     367DECL_TEMPLATE(darwin, psynch_cvwait);          // 305
     368DECL_TEMPLATE(darwin, psynch_rw_rdlock);       // 306
     369DECL_TEMPLATE(darwin, psynch_rw_wrlock);       // 307
     370DECL_TEMPLATE(darwin, psynch_rw_unlock);       // 308
     371// NYI psynch_rw_unlock2 309
     372#else
    357373// old load_shared_file
    358374// old reset_shared_file
    359375// old new_system_shared_regions
    360376// old shared_region_map_file_np
    361377// old shared_region_make_private_np
    362 DECL_TEMPLATE(darwin, psynch_mutexwait);       // 301 // new in 10.7 ?
    363 DECL_TEMPLATE(darwin, psynch_mutexdrop);       // 302 // new in 10.7 ?
    364 DECL_TEMPLATE(darwin, psynch_cvbroad);         // 303 // new in 10.7 ?
    365 DECL_TEMPLATE(darwin, psynch_cvsignal);        // 304 // new in 10.7 ?
    366 DECL_TEMPLATE(darwin, psynch_cvwait);          // 305 // new in 10.7 ?
    367 DECL_TEMPLATE(darwin, psynch_rw_rdlock);       // 306 // new in 10.7 ?
    368 DECL_TEMPLATE(darwin, psynch_rw_wrlock);       // 307 // new in 10.7 ?
    369 DECL_TEMPLATE(darwin, psynch_rw_unlock);       // 308 // new in 10.7 ?
     378// NYI __pthread_mutex_destroy 301
     379// NYI __pthread_mutex_init 302
     380// NYI __pthread_mutex_lock 303
     381// NYI __pthread_mutex_trylock 304
     382// NYI __pthread_mutex_unlock 305
     383// NYI __pthread_cond_init 306
     384// NYI __pthread_cond_destroy 307
     385// NYI __pthread_cond_broadcast 308
    370386// NYI __pthread_cond_signal 309
     387#endif
    371388// NYI getsid 310
    372389// NYI settid_with_pid 311
    373 DECL_TEMPLATE(darwin, psynch_cvclrprepost);    // 312 // new in 10.7 ?
     390#if DARWIN_VERS >= DARWIN_10_7
     391DECL_TEMPLATE(darwin, psynch_cvclrprepost);    // 312
     392#else
     393// NYI __pthread_cond_timedwait 312
     394#endif
    374395// NYI aio_fsync 313
    375396DECL_TEMPLATE(darwin, aio_return);             // 314
    376397DECL_TEMPLATE(darwin, aio_suspend);            // 315
     
    394415DECL_TEMPLATE(darwin, __pthread_canceled);      // 333
    395416DECL_TEMPLATE(darwin, __semwait_signal);        // 334
    396417// old utrace
    397 #if DARWIN_VERS >= DARWIN_10_6
    398418DECL_TEMPLATE(darwin, proc_info);               // 336
    399 #endif
    400419DECL_TEMPLATE(darwin, sendfile);                // 337
    401420DECL_TEMPLATE(darwin, stat64);                  // 338
    402421DECL_TEMPLATE(darwin, fstat64);                 // 339
     
    417436// NYI setauid 354
    418437// NYI getaudit 355
    419438// NYI setaudit 356
    420 #if DARWIN_VERS >= DARWIN_10_7
    421439DECL_TEMPLATE(darwin, getaudit_addr)            // 357
    422 #endif
    423440// NYI setaudit_addr 358
    424441// NYI auditctl 359
    425442DECL_TEMPLATE(darwin, bsdthread_create);        // 360
     
    434451// 369
    435452// 370
    436453// 371
     454#if DARWIN_VERS >= DARWIN_10_6
    437455DECL_TEMPLATE(darwin, __thread_selfid);         // 372
     456#endif
    438457// 373
    439458// 374
    440459// 375
  • coregrind/m_syswrap/syswrap-darwin.c

    diff -Naur a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c
    a b  
    26182618         count, (Addr)p-(Addr)ARG3, ARG4);
    26192619}
    26202620
    2621 
    2622 PRE(fsgetpath)
    2623 {
    2624 #if VG_WORDSIZE == 4
    2625    PRINT("fsgetpath(%#lx, %ld, %#lx {%u,%u}, %llu)",
    2626          ARG1, ARG2, ARG3,
    2627          ((unsigned int *)ARG3)[0], ((unsigned int *)ARG3)[1],
    2628          LOHI64(ARG4, ARG5));
    2629    PRE_REG_READ5(ssize_t, "fsgetpath",
    2630                  void*,"buf", size_t,"bufsize",
    2631                  fsid_t *,"fsid",
    2632                  vki_uint32_t, "objid_low32", vki_uint32_t, "objid_high32");
    2633 #else
    2634    PRINT("fsgetpath(%#lx, %ld, %#lx {%u,%u}, %lu)",
    2635          ARG1, ARG2, ARG3,
    2636          ((unsigned int *)ARG3)[0],
    2637          ((unsigned int *)ARG3)[1], ARG4);
    2638    PRE_REG_READ4(ssize_t, "fsgetpath",
    2639                  void*,"buf", size_t,"bufsize",
    2640                  fsid_t *,"fsid", uint64_t,"objid");
    2641 #endif
    2642    PRE_MEM_READ("fsgetpath(fsid)", ARG3, sizeof(fsid_t));
    2643    PRE_MEM_WRITE("fsgetpath(buf)", ARG1, ARG2);
    2644 }
    2645 
    2646 POST(fsgetpath)
    2647 {
    2648    POST_MEM_WRITE(ARG1, RES);
    2649 }
    2650 
    2651 PRE(audit_session_self)
    2652 {
    2653   PRINT("audit_session_self()");
    2654 }
    2655 
    2656 POST(audit_session_self)
    2657 {
    2658   record_named_port(tid, RES, MACH_PORT_RIGHT_SEND, "audit-session-%p");
    2659   PRINT("audit-session %#lx", RES);
    2660 }
    2661 
    26622621PRE(exchangedata)
    26632622{
    26642623   PRINT("exchangedata(%#lx(%s), %#lx(%s), %lu)",
     
    35613520   }   
    35623521}
    35633522
     3523PRE(getaudit_addr)
     3524{
     3525   PRINT("getaudit_addr(%#lx, %lu)", ARG1, ARG2);
     3526   PRE_REG_READ1(void*, "auditinfo_addr", int, "length");
     3527   PRE_MEM_WRITE("getaudit_addr(auditinfo_addr)", ARG1, ARG2);
     3528}
     3529POST(getaudit_addr)
     3530{
     3531   POST_MEM_WRITE(ARG1, ARG2);
     3532}
     3533
    35643534
    35653535PRE(mmap)
    35663536{
     
    37793749                 uint32_t flavor, uint64_t arg,
    37803750                 user_addr_t buffer, int32_t buffersize)
    37813751*/
    3782 #if DARWIN_VERS >= DARWIN_10_6
    37833752PRE(proc_info)
    37843753{
    37853754#if VG_WORDSIZE == 4
     
    38133782#endif
    38143783}
    38153784
    3816 #endif /* DARWIN_VERS >= DARWIN_10_6 */
    38173785
    38183786/* ---------------------------------------------------------------------
    38193787   aio_*
     
    74287396//}
    74297397
    74307398
    7431 PRE(__thread_selfid)
    7432 {
    7433    PRINT("__thread_selfid ()");
    7434    PRE_REG_READ0(vki_uint64_t, "__thread_selfid");
    7435 }
    7436 
    74377399PRE(task_for_pid)
    74387400{
    74397401   PRINT("task_for_pid(%s, %ld, %#lx)", name_for_port(ARG1), ARG2, ARG3);
     
    77827744
    77837745
    77847746/* ---------------------------------------------------------------------
    7785    Added for OSX 10.7 (Lion)
     7747   Added for OSX 10.6 (Snow Leopard)
    77867748   ------------------------------------------------------------------ */
    77877749
    7788 #if DARWIN_VERS >= DARWIN_10_7
    7789 
    7790 PRE(getaudit_addr)
    7791 {
    7792    PRINT("getaudit_addr(%#lx, %lu)", ARG1, ARG2);
    7793    PRE_REG_READ1(void*, "auditinfo_addr", int, "length");
    7794    PRE_MEM_WRITE("getaudit_addr(auditinfo_addr)", ARG1, ARG2);
    7795 }
    7796 POST(getaudit_addr)
    7797 {
    7798    POST_MEM_WRITE(ARG1, ARG2);
    7799 }
     7750#if DARWIN_VERS >= DARWIN_10_6
    78007751
    78017752PRE(psynch_mutexwait)
    78027753{
     
    78677818{
    78687819}
    78697820
     7821PRE(__thread_selfid)
     7822{
     7823   PRINT("__thread_selfid ()");
     7824   PRE_REG_READ0(vki_uint64_t, "__thread_selfid");
     7825}
     7826
     7827PRE(fsgetpath)
     7828{
     7829#if VG_WORDSIZE == 4
     7830   PRINT("fsgetpath(%#lx, %ld, %#lx {%u,%u}, %llu)",
     7831         ARG1, ARG2, ARG3,
     7832         ((unsigned int *)ARG3)[0], ((unsigned int *)ARG3)[1],
     7833         LOHI64(ARG4, ARG5));
     7834   PRE_REG_READ5(ssize_t, "fsgetpath",
     7835                 void*,"buf", size_t,"bufsize",
     7836                 fsid_t *,"fsid",
     7837                 vki_uint32_t, "objid_low32", vki_uint32_t, "objid_high32");
     7838#else
     7839   PRINT("fsgetpath(%#lx, %ld, %#lx {%u,%u}, %lu)",
     7840         ARG1, ARG2, ARG3,
     7841         ((unsigned int *)ARG3)[0],
     7842         ((unsigned int *)ARG3)[1], ARG4);
     7843   PRE_REG_READ4(ssize_t, "fsgetpath",
     7844                 void*,"buf", size_t,"bufsize",
     7845                 fsid_t *,"fsid", uint64_t,"objid");
     7846#endif
     7847   PRE_MEM_READ("fsgetpath(fsid)", ARG3, sizeof(fsid_t));
     7848   PRE_MEM_WRITE("fsgetpath(buf)", ARG1, ARG2);
     7849}
     7850
     7851POST(fsgetpath)
     7852{
     7853   POST_MEM_WRITE(ARG1, RES);
     7854}
     7855
     7856PRE(audit_session_self)
     7857{
     7858  PRINT("audit_session_self()");
     7859}
     7860POST(audit_session_self)
     7861{
     7862  record_named_port(tid, RES, MACH_PORT_RIGHT_SEND, "audit-session-%p");
     7863  PRINT("audit-session %#lx", RES);
     7864}
     7865
     7866#endif /* DARWIN_VERS >= DARWIN_10_6 */
     7867
     7868
     7869/* ---------------------------------------------------------------------
     7870   Added for OSX 10.7 (Lion)
     7871   ------------------------------------------------------------------ */
     7872
     7873#if DARWIN_VERS >= DARWIN_10_7
     7874
    78707875PRE(psynch_cvclrprepost)
    78717876{
    78727877   PRINT("psynch_cvclrprepost(BOGUS)");
     
    82978302// _____(__NR_shared_region_map_np),
    82988303#if DARWIN_VERS >= DARWIN_10_6
    82998304// _____(__NR_vm_pressure_monitor),
    8300 #else
    8301    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(296)),   // old load_shared_file
    8302 #endif
    8303    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(297)),   // old reset_shared_file
    8304    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(298)),   // old new_system_shared_regions
    8305    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(299)),   // old shared_region_map_file_np
    8306    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(300)),   // old shared_region_make_private_np
     8305// _____(__NR_psynch_rw_longrdlock),
     8306// _____(__NR_psynch_rw_yieldwrlock),
     8307// _____(__NR_psynch_rw_downgrade),
     8308// _____(__NR_psynch_rw_upgrade),
    83078309   MACXY(__NR_psynch_mutexwait, psynch_mutexwait), // 301
    83088310   MACXY(__NR_psynch_mutexdrop, psynch_mutexdrop), // 302
    83098311   MACXY(__NR_psynch_cvbroad,   psynch_cvbroad),   // 303
     
    83128314   MACXY(__NR_psynch_rw_rdlock, psynch_rw_rdlock), // 306
    83138315   MACXY(__NR_psynch_rw_wrlock, psynch_rw_wrlock), // 307
    83148316   MACXY(__NR_psynch_rw_unlock, psynch_rw_unlock), // 308
    8315    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(309)),   // ???
     8317// _____(__NR_psynch_rw_unlock2),
     8318#else
     8319   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(296)),   // old load_shared_file
     8320   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(297)),   // old reset_shared_file
     8321   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(298)),   // old new_system_shared_regions
     8322   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(299)),   // old shared_region_map_file_np
     8323   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(300)),   // old shared_region_make_private_np
     8324// _____(__NR___pthread_mutex_destroy),
     8325// _____(__NR___pthread_mutex_init),
     8326// _____(__NR___pthread_mutex_lock),
     8327// _____(__NR___pthread_mutex_trylock),
     8328// _____(__NR___pthread_mutex_unlock),
     8329// _____(__NR___pthread_cond_init),
     8330// _____(__NR___pthread_cond_destroy),
     8331// _____(__NR___pthread_cond_broadcast),
     8332// _____(__NR___pthread_cond_signal),
     8333#endif
    83168334// _____(__NR_getsid),
    83178335// _____(__NR_settid_with_pid),
     8336#if DARWIN_VERS >= DARWIN_10_7
    83188337   MACXY(__NR_psynch_cvclrprepost, psynch_cvclrprepost), // 312
     8338#else
     8339   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(308)),   // old __pthread_cond_timedwait
     8340#endif
    83198341// _____(__NR_aio_fsync),
    83208342   MACXY(__NR_aio_return,     aio_return),
    83218343   MACX_(__NR_aio_suspend,    aio_suspend),
     
    83418363   MACX_(__NR___pthread_canceled,      __pthread_canceled),
    83428364   MACX_(__NR___semwait_signal,        __semwait_signal),
    83438365   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(335)),   // old utrace
    8344 #if DARWIN_VERS >= DARWIN_10_6
    83458366   MACXY(__NR_proc_info,               proc_info),  // 336
    8346 #endif
    83478367   MACXY(__NR_sendfile,    sendfile),
    83488368   MACXY(__NR_stat64,      stat64),
    83498369   MACXY(__NR_fstat64,     fstat64),
     
    83648384// _____(__NR_setauid),
    83658385// _____(__NR_getaudit),
    83668386// _____(__NR_setaudit),
    8367 #if DARWIN_VERS >= DARWIN_10_7
    83688387   MACXY(__NR_getaudit_addr, getaudit_addr),
    8369 #endif
    83708388// _____(__NR_setaudit_addr),
    83718389// _____(__NR_auditctl),
    83728390   MACXY(__NR_bsdthread_create,     bsdthread_create),   // 360
  • include/vki/vki-scnums-darwin.h

    diff -Naur a/include/vki/vki-scnums-darwin.h b/include/vki/vki-scnums-darwin.h
    a b  
    508508#define __NR_shared_region_map_np   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(295)
    509509#if DARWIN_VERS >= DARWIN_10_6
    510510#define __NR_vm_pressure_monitor    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(296)
     511#define __NR_psynch_rw_longrdlock   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(297)
     512#define __NR_psynch_rw_yieldwrlock  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(298)
     513#define __NR_psynch_rw_downgrade    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(299)
     514#define __NR_psynch_rw_upgrade      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(300)
     515#define __NR_psynch_mutexwait       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(301)
     516#define __NR_psynch_mutexdrop       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(302)
     517#define __NR_psynch_cvbroad         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(303)
     518#define __NR_psynch_cvsignal        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(304)
     519#define __NR_psynch_cvwait          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(305)
     520#define __NR_psynch_rw_rdlock       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(306)
     521#define __NR_psynch_rw_wrlock       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(307)
     522#define __NR_psynch_rw_unlock       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(308)
     523#define __NR_psynch_rw_unlock2      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(309)
    511524#else
    512525                        /* 296  old load_shared_file */
    513 #endif
    514526                        /* 297  old reset_shared_file */
    515527                        /* 298  old new_system_shared_regions */
    516528                        /* 299  old shared_region_map_file_np */
    517529                        /* 300  old shared_region_make_private_np */
    518 #define __NR_psynch_mutexwait VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(301)
    519 #define __NR_psynch_mutexdrop VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(302)
    520 #define __NR_psynch_cvbroad   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(303)
    521 #define __NR_psynch_cvsignal  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(304)
    522 #define __NR_psynch_cvwait    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(305)
    523 #define __NR_psynch_rw_rdlock VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(306)
    524 #define __NR_psynch_rw_wrlock VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(307)
    525 #define __NR_psynch_rw_unlock VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(308)
    526                         /* 309 */
     530#define __NR___pthread_mutex_destroy  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(301)
     531#define __NR___pthread_mutex_init     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(302)
     532#define __NR___pthread_mutex_lock     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(303)
     533#define __NR___pthread_mutex_trylock  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(304)
     534#define __NR___pthread_mutex_unlock   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(305)
     535#define __NR___pthread_cond_init      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(306)
     536#define __NR___pthread_cond_destroy   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(307)
     537#define __NR___pthread_cond_broadcast VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(308)
     538#define __NR___pthread_cond_signal    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(309)
     539#endif
    527540#define __NR_getsid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(310)
    528541#define __NR_settid_with_pid VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(311)
     542#if DARWIN_VERS >= DARWIN_10_7
    529543#define __NR_psynch_cvclrprepost VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(312)
     544#else
     545#define __NR___pthread_cond_timedwait VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(312)
     546#endif
    530547#define __NR_aio_fsync      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(313)
    531548#define __NR_aio_return     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(314)
    532549#define __NR_aio_suspend    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(315)