You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(83) |
Oct
(89) |
Nov
(97) |
Dec
(30) |
| 2024 |
Jan
(25) |
Feb
(73) |
Mar
(76) |
Apr
(122) |
May
(46) |
Jun
(44) |
Jul
(27) |
Aug
(30) |
Sep
(33) |
Oct
(67) |
Nov
(91) |
Dec
(70) |
| 2025 |
Jan
(44) |
Feb
(36) |
Mar
(85) |
Apr
(100) |
May
(138) |
Jun
(55) |
Jul
(107) |
Aug
(96) |
Sep
(151) |
Oct
(129) |
Nov
(102) |
Dec
(12) |
|
From: Paul F. <pa...@so...> - 2025-12-05 21:08:57
|
https://sourceware.org/cgit/valgrind/commit/?id=46bc7241a79e68663b707b40b1866cc8303924c3 commit 46bc7241a79e68663b707b40b1866cc8303924c3 Author: Paul Floyd <pj...@wa...> Date: Fri Dec 5 21:59:34 2025 +0100 Darwin: also clean up client stack creation Make stringbase and strtab be based off clstack_end + 1 rather than clstack_end. clstack_end is the address of the last byte of the stack, not one past the end of the stack. That means that it is not word aligned. Adding 1 makes the calculation word aligned. Depending on the length of the string table with rounding it could happen that the executable_path pointer would overwrite the start of argv[0] in the string table. I think that that there are supposed to be 0-16 bytes between the end of the pointers and the string table (or is that ELF?). Diff: --- coregrind/m_initimg/initimg-darwin.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/coregrind/m_initimg/initimg-darwin.c b/coregrind/m_initimg/initimg-darwin.c index 3ddc9806c6..0befeaef39 100644 --- a/coregrind/m_initimg/initimg-darwin.c +++ b/coregrind/m_initimg/initimg-darwin.c @@ -360,16 +360,8 @@ Addr setup_client_stack( void* init_sp, stringsize += VG_(strlen)(*cpp) + 1; } - // @todo PJF there is a bug in the size calculation or rounding - // somewhere. This should be "+= 2" (one of the pointer to exec - // path and one for the terminating NULL pointer). When I run - // "./tests/vg_regtest none/tests" from a Korn shell script - // then the allexec32/64 tests fail because they print out "argv[0]". - // I think that what happens is that writing to "ptr" overwrites the - // start of strtab resulting in the argv[0] the exe name being a - // string starting with 8 \0s (not tested) - /* Darwin executable_path + NULL */ - auxsize += 3 * sizeof(Word); + /* NULL separator and executable path */ + auxsize += 2 * sizeof(HChar **); if (info->executable_path) { stringsize += 1 + VG_(strlen)(info->executable_path); } @@ -395,7 +387,7 @@ Addr setup_client_stack( void* init_sp, client_SP = VG_ROUNDDN(client_SP, 32); /* make stack 32 byte aligned */ /* base of the string table (aligned) */ - stringbase = strtab = (HChar *)clstack_end + stringbase = strtab = (HChar *)clstack_end + 1 - VG_ROUNDUP(stringsize, sizeof(int)); /* The max stack size */ |
|
From: Paul F. <pa...@so...> - 2025-12-05 20:46:52
|
https://sourceware.org/cgit/valgrind/commit/?id=7769d95480ec28e2ebcf475d04a5b495d5502e59 commit 7769d95480ec28e2ebcf475d04a5b495d5502e59 Author: Paul Floyd <pj...@wa...> Date: Fri Dec 5 21:44:56 2025 +0100 FreeBSD: a bit of cleaning of client stack creation Remove some commented out rounding Make stringbase point to a word boundary, not one before Diff: --- coregrind/m_initimg/initimg-freebsd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index 09f3dda847..cd127736ce 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -473,17 +473,14 @@ static Addr setup_client_stack(const void* init_sp, break; case VKI_AT_CANARYLEN: canarylen = cauxv->u.a_val; - /*VG_ROUNDUP(stringsize, sizeof(Word));*/ stringsize += canarylen; break; case VKI_AT_PAGESIZESLEN: pagesizeslen = cauxv->u.a_val; - /*VG_ROUNDUP(stringsize, sizeof(Word));*/ stringsize += pagesizeslen; break; #if 0 case VKI_AT_TIMEKEEP: - /*VG_ROUNDUP(stringsize, sizeof(Word));*/ stringsize += sizeof(struct vki_vdso_timehands); break; #endif @@ -519,7 +516,7 @@ static Addr setup_client_stack(const void* init_sp, client_SP = VG_ROUNDDN(client_SP, 16); /* make stack 16 byte aligned */ /* base of the string table (aligned) */ - stringbase = strtab = (HChar *)clstack_end + stringbase = strtab = (HChar *)clstack_end + 1 - VG_ROUNDUP(stringsize, sizeof(int)); clstack_start = VG_PGROUNDDN(client_SP); |
|
From: Paul F. <pa...@so...> - 2025-12-05 12:50:14
|
https://sourceware.org/cgit/valgrind/commit/?id=19054d9a8fe14c6b20f989c2c8ff3d7eea8ce40a commit 19054d9a8fe14c6b20f989c2c8ff3d7eea8ce40a Author: Paul Floyd <pj...@wa...> Date: Fri Dec 5 13:47:19 2025 +0100 Darwin: no need to turn off alignment assert in leak check Mixed up 2 files with previous commit. This also contains a missing proto and the previous commit fixes issues with badly formed segments. Needs more investigation. Diff: --- coregrind/m_debuginfo/priv_readmacho.h | 3 +++ memcheck/mc_main.c | 14 -------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/coregrind/m_debuginfo/priv_readmacho.h b/coregrind/m_debuginfo/priv_readmacho.h index 5ff5d048ce..c945d9b185 100644 --- a/coregrind/m_debuginfo/priv_readmacho.h +++ b/coregrind/m_debuginfo/priv_readmacho.h @@ -37,6 +37,9 @@ it. Also count the number of RW segements. */ extern Bool ML_(check_macho_and_get_rw_loads)( Int fd, Int* rw_loads ); +/* Same as above, but reads from memory instead of a file descriptor. */ +extern Bool ML_(check_macho_and_get_rw_loads_from_memory)( const void* buf, SizeT size, Int* rw_loads ); + /* The central function for reading Mach-O debug info. For the object/exe specified by the DebugInfo, find Mach-O sections, then read the symbols, line number info, file name info, CFA (stack-unwind diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index d4ac9fc202..d6c14923c5 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -5893,21 +5893,7 @@ Bool MC_(is_within_valid_secondary) ( Addr a ) Bool MC_(is_valid_aligned_word) ( Addr a ) { tl_assert(sizeof(UWord) == 4 || sizeof(UWord) == 8); -#if defined(VGO_darwin) - // on Darwin some of the memcheck/tests/leak-autofreepool-* - // tests are failing here. VALGRIND_MALLOCLIKE_BLOCK is passed - // an address that is not word aligned. But that's also the case - // on other platforms, on FreeBSD leak-autofreepool 0 uses addresses - // that are only 2 aligned. The problem is more likely that Darwin - // should not be looking at this chunk of memory. - if (!VG_IS_WORD_ALIGNED(a) && VG_(clo_verbosity) > 1) - { - VG_(printf)("In %s, invariant violation, pointer %p should be word aligned\n", __func__, (void*)a); - MC_(pp_describe_addr) (VG_(current_DiEpoch)(), a); - } -#else tl_assert(VG_IS_WORD_ALIGNED(a)); -#endif if (get_vabits8_for_aligned_word32 (a) != VA_BITS8_DEFINED) return False; if (sizeof(UWord) == 8) { |
|
From: Paul F. <pa...@so...> - 2025-12-05 12:45:56
|
https://sourceware.org/cgit/valgrind/commit/?id=a68eb0348e8ee91411898bd2e3d74205e41fb5b1 commit a68eb0348e8ee91411898bd2e3d74205e41fb5b1 Author: Paul Floyd <pj...@wa...> Date: Fri Dec 5 13:44:41 2025 +0100 Darwin: add a couple of missing function prototypes Diff: --- coregrind/m_aspacemgr/aspacemgr-linux.c | 55 +++++++++++++++++++++++++++++++-- coregrind/m_debuginfo/priv_image.h | 2 ++ 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index d5715c4448..3bc5cb0441 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -864,6 +864,7 @@ static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot, #if defined(VGO_darwin) // GrP fixme kernel info doesn't have dev/inode + // FIXME PJF but now ino is being used for vm tag cmp_devino = False; // GrP fixme V and kernel don't agree on offsets @@ -1473,8 +1474,9 @@ static void add_segment ( const NSegment* seg ) Addr sEnd = seg->end; #if defined(VGO_darwin) - // FIXME: the cast is unfortunate but I don't want to change every callsite to call 2 functions - fill_segment((NSegment*) (Addr) seg); + // FIXME: adding for all segments causes some failures and alignment crashes in leak check + // need to debug more + //fill_segment((NSegment*) (Addr) seg); #endif aspacem_assert(sStart <= sEnd); @@ -1611,6 +1613,10 @@ static void read_maps_callback ( Addr addr, SizeT len, UInt prot, seg.fnIdx = ML_(am_allocate_segname)( filename ); if (0) show_nsegment( 2,0, &seg ); +#if defined(VGO_darwin) + // FIXME this is the one that causes problems with leak checks + //fill_segment( &seg ); +#endif add_segment( &seg ); } @@ -1923,10 +1929,16 @@ Addr VG_(am_startup) ( Addr sp_at_startup ) if (aspacem_cStart > Addr_MIN) { init_resvn(&seg, Addr_MIN, aspacem_cStart-1); +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment(&seg); } if (aspacem_maxAddr < Addr_MAX) { init_resvn(&seg, aspacem_maxAddr+1, Addr_MAX); +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment(&seg); } @@ -1936,6 +1948,9 @@ Addr VG_(am_startup) ( Addr sp_at_startup ) valgrind allocations at the boundary, this is kind of necessary in order to get it to start allocating in the right place. */ init_resvn(&seg, aspacem_vStart, aspacem_vStart + VKI_PAGE_SIZE - 1); +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment(&seg); VG_(am_show_nsegments)(2, "Initial layout"); @@ -2323,6 +2338,9 @@ VG_(am_notify_client_mmap)( Addr a, SizeT len, UInt prot, UInt flags, seg.isFF = (flags & VKI_MAP_FIXED); #endif } +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment( &seg ); AM_SANITY_CHECK; return needDiscard; @@ -2354,6 +2372,9 @@ VG_(am_notify_client_shmat)( Addr a, SizeT len, UInt prot ) seg.hasR = toBool(prot & VKI_PROT_READ); seg.hasW = toBool(prot & VKI_PROT_WRITE); seg.hasX = toBool(prot & VKI_PROT_EXEC); +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment( &seg ); AM_SANITY_CHECK; return needDiscard; @@ -2454,6 +2475,9 @@ Bool VG_(am_notify_munmap)( Addr start, SizeT len ) else seg.kind = SkFree; +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment( &seg ); /* Unmapping could create two adjacent free segments, so a preen is @@ -2565,6 +2589,9 @@ SysRes VG_(am_mmap_named_file_fixed_client_flags) } #if defined(VGO_freebsd) seg.isFF = (flags & VKI_MAP_FIXED); +#endif +#if defined(VGO_darwin) + fill_segment( &seg ); #endif add_segment( &seg ); @@ -2624,6 +2651,9 @@ SysRes VG_(am_mmap_anon_fixed_client) ( Addr start, SizeT length, UInt prot ) seg.hasR = toBool(prot & VKI_PROT_READ); seg.hasW = toBool(prot & VKI_PROT_WRITE); seg.hasX = toBool(prot & VKI_PROT_EXEC); +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment( &seg ); AM_SANITY_CHECK; @@ -2683,6 +2713,9 @@ static SysRes am_mmap_anon_float_client ( SizeT length, Int prot, Bool isCH ) seg.hasW = toBool(prot & VKI_PROT_WRITE); seg.hasX = toBool(prot & VKI_PROT_EXEC); seg.isCH = isCH; +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment( &seg ); AM_SANITY_CHECK; @@ -2785,6 +2818,9 @@ SysRes VG_(am_mmap_anon_float_valgrind)( SizeT length ) seg.hasR = True; seg.hasW = True; seg.hasX = True; +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment( &seg ); AM_SANITY_CHECK; @@ -2877,6 +2913,9 @@ static SysRes VG_(am_mmap_file_float_valgrind_flags) ( SizeT length, UInt prot, } #if defined(VGO_freebsd) seg.isFF = (flags & VKI_MAP_FIXED); +#endif +#if defined(VGO_darwin) + fill_segment( &seg ); #endif add_segment( &seg ); @@ -3099,6 +3138,9 @@ Bool VG_(am_create_reservation) ( Addr start, SizeT length, reservation. */ seg.end = end1; seg.smode = smode; +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment( &seg ); AM_SANITY_CHECK; @@ -3272,6 +3314,9 @@ const NSegment *VG_(am_extend_map_client)( Addr addr, SizeT delta ) NSegment seg_copy = *seg; seg_copy.end += delta; +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment( &seg_copy ); if (0) @@ -3345,6 +3390,9 @@ Bool VG_(am_relocate_nooverlap_client)( /*OUT*/Bool* need_discard, } seg.start = new_addr; seg.end = new_addr + new_len - 1; +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment( &seg ); /* Create a free hole in the old location. */ @@ -3360,6 +3408,9 @@ Bool VG_(am_relocate_nooverlap_client)( /*OUT*/Bool* need_discard, else seg.kind = SkFree; +#if defined(VGO_darwin) + fill_segment( &seg ); +#endif add_segment( &seg ); AM_SANITY_CHECK; diff --git a/coregrind/m_debuginfo/priv_image.h b/coregrind/m_debuginfo/priv_image.h index 90de98dfc5..56dfbb85d3 100644 --- a/coregrind/m_debuginfo/priv_image.h +++ b/coregrind/m_debuginfo/priv_image.h @@ -61,6 +61,8 @@ DiImage* ML_(img_from_local_file)(const HChar* fullpath); DiImage* ML_(img_from_fd)(Int fd, const HChar* fullpath); +DiImage* ML_(img_from_memory)(Addr a, SizeT len, const HChar* fullpath); + /* Create an image by connecting to a Valgrind debuginfo server (auxprogs/valgrind-di-server.c). |filename| contains the object name to ask for; it must be a plain filename, not absolute, not a |
|
From: Florian K. <fk...@so...> - 2025-12-04 20:39:02
|
https://sourceware.org/cgit/valgrind/commit/?id=b08a821fc0b6030f49e80be759cf6907f7a62ce0 commit b08a821fc0b6030f49e80be759cf6907f7a62ce0 Author: Florian Krohm <fl...@ei...> Date: Thu Dec 4 20:38:24 2025 +0000 arm: Remove global arm_hwcaps and one FIXME. Followup to cd9d7d0d2edeef5ef37582c6d6fa55ca3c3bcccd Diff: --- VEX/priv/host_arm_defs.c | 4 +++- VEX/priv/host_arm_defs.h | 3 --- VEX/priv/host_arm_isel.c | 3 --- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/VEX/priv/host_arm_defs.c b/VEX/priv/host_arm_defs.c index a838565a20..3ca8b22a5d 100644 --- a/VEX/priv/host_arm_defs.c +++ b/VEX/priv/host_arm_defs.c @@ -39,7 +39,7 @@ #include "host_generic_regs.h" #include "host_arm_defs.h" -UInt arm_hwcaps = 0; +static UInt arm_hwcaps; /* --------- Registers. --------- */ @@ -3080,6 +3080,8 @@ Int emit_ARMInstr ( /*MB_MOD*/Bool* is_profInc, vassert(mode64 == False); vassert(0 == (((HWord)buf) & 3)); + arm_hwcaps = archinfo_host->hwcaps; + switch (i->tag) { case ARMin_Alu: { UInt instr, subopc; diff --git a/VEX/priv/host_arm_defs.h b/VEX/priv/host_arm_defs.h index d6dbc4ee27..b8399075d9 100644 --- a/VEX/priv/host_arm_defs.h +++ b/VEX/priv/host_arm_defs.h @@ -32,9 +32,6 @@ #include "libvex.h" // VexArch #include "host_generic_regs.h" // HReg -extern UInt arm_hwcaps; - - /* --------- Registers. --------- */ #define ST_IN static inline diff --git a/VEX/priv/host_arm_isel.c b/VEX/priv/host_arm_isel.c index 90bc699fc4..71bf871c4f 100644 --- a/VEX/priv/host_arm_isel.c +++ b/VEX/priv/host_arm_isel.c @@ -6553,9 +6553,6 @@ HInstrArray* iselSB_ARM ( const IRSB* bb, /* guard against unexpected space regressions */ vassert(sizeof(ARMInstr) <= 28); - /* hwcaps should not change from one ISEL call to another. */ - arm_hwcaps = hwcaps_host; // JRS 2012 Mar 31: FIXME (RM) - /* Make up an initial environment to use. */ env = LibVEX_Alloc_inline(sizeof(ISelEnv)); env->vreg_ctr = 0; |
|
From: Martin C. <mc...@so...> - 2025-12-04 13:01:56
|
https://sourceware.org/cgit/valgrind/commit/?id=37d9e2085e0ac28a3fa807670c1055bdadb5f773 commit 37d9e2085e0ac28a3fa807670c1055bdadb5f773 Author: Martin Cermak <mc...@re...> Date: Thu Dec 4 14:00:59 2025 +0100 Add ARG4 checks for quotactl and quotactl_fd syswraps ARG4 can point to different things of varion sizes based on the cmd arg. Handle all the possible options and provide missing checks. https://bugs.kde.org/show_bug.cgi?id=509634 Diff: --- NEWS | 1 + coregrind/m_syswrap/syswrap-amd64-linux.c | 4 +- coregrind/m_syswrap/syswrap-arm-linux.c | 4 +- coregrind/m_syswrap/syswrap-arm64-linux.c | 4 +- coregrind/m_syswrap/syswrap-linux.c | 131 +++++++++++++++++++++++++-- coregrind/m_syswrap/syswrap-mips32-linux.c | 4 +- coregrind/m_syswrap/syswrap-mips64-linux.c | 8 +- coregrind/m_syswrap/syswrap-nanomips-linux.c | 2 +- coregrind/m_syswrap/syswrap-ppc32-linux.c | 4 +- coregrind/m_syswrap/syswrap-ppc64-linux.c | 4 +- coregrind/m_syswrap/syswrap-riscv64-linux.c | 4 +- coregrind/m_syswrap/syswrap-s390x-linux.c | 4 +- coregrind/m_syswrap/syswrap-x86-linux.c | 4 +- include/vki/vki-linux.h | 51 +++++++++++ 14 files changed, 199 insertions(+), 30 deletions(-) diff --git a/NEWS b/NEWS index 6068d611d4..0731634f8c 100644 --- a/NEWS +++ b/NEWS @@ -256,6 +256,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 509572 s390x: Overhaul BFP testsuite 509590 Run the LTP tests with LTP_QUIET 509567 unhandled amd64-linux syscall: 443 (quotactl_fd) +509634 Add ARG4 checks for quotactl and quotactl_fd syswraps 509642 Add missing ppc64-linux syswraps 509643 Add missing s390x-linux syswraps 510169 Update the LTP version in valgrind testsuite to 20250930 diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 5dccb47b3e..a6e76690ad 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -684,7 +684,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_delete_module, sys_delete_module), // 176 // (__NR_get_kernel_syms, sys_ni_syscall), // 177 // (__NR_query_module, sys_ni_syscall), // 178 - LINX_(__NR_quotactl, sys_quotactl), // 179 + LINXY(__NR_quotactl, sys_quotactl), // 179 // (__NR_nfsservctl, sys_nfsservctl), // 180 // (__NR_getpmsg, sys_ni_syscall), // 181 @@ -896,7 +896,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 - LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 + LINXY(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index af3ec18ddf..b7860710c4 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -708,7 +708,7 @@ static SyscallTableEntry syscall_main_table[] = { //zz //zz // Nb: get_kernel_syms() was removed 2.4-->2.6 // GENX_(__NR_get_kernel_syms, sys_ni_syscall), // 130 - LINX_(__NR_quotactl, sys_quotactl), // 131 + LINXY(__NR_quotactl, sys_quotactl), // 131 GENX_(__NR_getpgid, sys_getpgid), // 132 GENX_(__NR_fchdir, sys_fchdir), // 133 //zz // (__NR_bdflush, sys_bdflush), // 134 */Linux @@ -1068,7 +1068,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), // 439 LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 - LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 + LINXY(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index 05a39ed07f..890bb7b8f9 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -608,7 +608,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_(__NR_close, sys_close), // 57 LINX_(__NR_vhangup, sys_vhangup), // 58 LINXY(__NR_pipe2, sys_pipe2), // 59 - LINX_(__NR_quotactl, sys_quotactl), // 60 + LINXY(__NR_quotactl, sys_quotactl), // 60 GENXY(__NR_getdents64, sys_getdents64), // 61 LINX_(__NR_lseek, sys_lseek), // 62 GENXY(__NR_read, sys_read), // 63 @@ -847,7 +847,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 - LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 + LINXY(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index e17aff6a43..3bfbef7614 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2655,19 +2655,19 @@ PRE(sys_io_destroy) } static -void common_pre_io_getevents(ThreadId tid, UWord a1, UWord a2, UWord a3, UWord a4, UWord a5, UWord a6, UWord* flags, const HChar* funtion_name) +void common_pre_io_getevents(ThreadId tid, UWord a1, UWord a2, UWord a3, UWord a4, UWord a5, UWord a6, UWord* flags, const HChar* function_name) { HChar buf[25]; *flags |= SfMayBlock; PRINT("sys_%s ( %llu, %lld, %lld, %#" FMT_REGWORD "x, %#" - FMT_REGWORD "x )", funtion_name, + FMT_REGWORD "x )", function_name, (ULong)a1,(Long)a2,(Long)a3,a4,a5); if (a3 > 0) { - VG_(snprintf)(buf, 25, "%s(events)", funtion_name); + VG_(snprintf)(buf, 25, "%s(events)", function_name); PRE_MEM_WRITE( buf, a4, sizeof(struct vki_io_event)*a3 ); } if (a5 != 0) { - VG_(snprintf)(buf, 25, "%s(timeout)", funtion_name); + VG_(snprintf)(buf, 25, "%s(timeout)", function_name); PRE_MEM_READ( buf, a5, sizeof(struct vki_timespec)); } @@ -2688,7 +2688,7 @@ PRE(sys_io_getevents) } static -void common_post_sys_io_events(ThreadId tid, UWord a4, SyscallStatus* status, const HChar* funtion_name) +void common_post_sys_io_events(ThreadId tid, UWord a4, SyscallStatus* status, const HChar* function_name) { Int i; vg_assert(SUCCESS); @@ -2736,7 +2736,7 @@ void common_post_sys_io_events(ThreadId tid, UWord a4, SyscallStatus* status, co default: VG_(message)(Vg_DebugMsg, "Warning: unhandled %s opcode: %u\n", - funtion_name, + function_name, cb->aio_lio_opcode); break; } @@ -4125,14 +4125,124 @@ POST(sys_dup3) ML_(record_fd_open_named)(tid, RES); } +static +void common_pre_quotactl_p4_check(ThreadId tid, Int subop, Int a4, SyscallStatus* status, const HChar* function_name) +{ + HChar buf[25]; + VG_(snprintf)(buf, sizeof(buf), "%s(addr)", function_name); + switch (subop) { + case VKI_Q_QUOTAON: + // The addr argument points to the pathname of a file + // containing the quotas for the filesystem. + PRE_MEM_RASCIIZ( buf, a4 ); + break; + case VKI_Q_QUOTAOFF: + // The addr and id arguments are ignored. + break; + case VKI_Q_GETQUOTA: + // Get disk quota limits and current usage for user or group id. The + // addr argument is a pointer to a dqblk structure defined in + // <sys/quota.h> as follows: + if (a4 != 0) + PRE_MEM_WRITE(buf, a4, sizeof(struct vki_dqblk)); + break; + case VKI_Q_GETNEXTQUOTA: + // The addr argument is a pointer to a nextdqblk structure + // whose fields are as for the dqblk, except for the addition + // of a dqb_id field that is used to return the ID for which + // quota information is being returned: + if (a4 != 0) + PRE_MEM_WRITE(buf, a4, sizeof(struct vki_nextdqblk)); + break; + case VKI_Q_SETQUOTA: + // Set quota information for user or group id, using the + // information supplied in the dqblk structure pointed to by + // addr. + if (a4 != 0) + PRE_MEM_READ(buf, a4, sizeof(struct vki_dqblk)); + break; + case VKI_Q_GETINFO: + // The addr argument should be a pointer to a dqinfo structure. + if (a4 != 0) + PRE_MEM_WRITE(buf, a4, sizeof(struct vki_dqinfo)); + break; + case VKI_Q_SETINFO: + // The addr argument should be a pointer to a dqinfo structure + if (a4 != 0) + PRE_MEM_READ(buf, a4, sizeof(struct vki_dqinfo)); + break; + case VKI_Q_GETFMT: + // The addr argument should be a pointer to a 4-byte buffer where the + // format number will be stored. + if (a4 != 0) + PRE_MEM_WRITE(buf, a4, 4); + break; + case VKI_Q_SYNC: + // The addr and id arguments are ignored. + break; + // case VKI_Q_GETSTATS: was only supported up to Linux 2.4.21 - skipping) + default: + return; + } +} + +static +void common_post_quotactl_p4_check(ThreadId tid, Int subop, Int a4, const HChar* function_name) +{ + switch (subop) { + case VKI_Q_GETQUOTA: + // Get disk quota limits and current usage for user or group id. The + // addr argument is a pointer to a dqblk structure defined in + // <sys/quota.h> as follows: + if (a4 != 0) + POST_MEM_WRITE(a4, sizeof(struct vki_dqblk)); + break; + case VKI_Q_GETNEXTQUOTA: + // The addr argument is a pointer to a nextdqblk structure + // whose fields are as for the dqblk, except for the addition + // of a dqb_id field that is used to return the ID for which + // quota information is being returned: + if (a4 != 0) + POST_MEM_WRITE(a4, sizeof(struct vki_nextdqblk)); + break; + case VKI_Q_GETINFO: + // The addr argument should be a pointer to a dqinfo structure. + if (a4 != 0) + POST_MEM_WRITE(a4, sizeof(struct vki_dqinfo)); + break; + case VKI_Q_GETFMT: + // The addr argument should be a pointer to a 4-byte buffer where the + // format number will be stored. + if (a4 != 0) + POST_MEM_WRITE(a4, 4); + break; + // case VKI_Q_GETSTATS: was only supported up to Linux 2.4.21 - skipping) + default: + return; + } +} + + PRE(sys_quotactl) { + // SYSCALL_DEFINE4(quotactl, + // unsigned int, cmd, + // const char __user *, special, + // qid_t, id, + // void __user *, addr) + Int subop = ARG1 >> VKI_SUBCMDSHIFT; PRINT("sys_quotactl (0x%" FMT_REGWORD "x, %#" FMT_REGWORD "x, 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1, ARG2, ARG3, ARG4); PRE_REG_READ4(long, "quotactl", unsigned int, cmd, const char *, special, vki_qid_t, id, void *, addr); PRE_MEM_RASCIIZ( "quotactl(special)", ARG2 ); + common_pre_quotactl_p4_check(tid, subop, ARG4, status, "quotactl"); +} +POST(sys_quotactl) +{ + Int subop = ARG1 >> VKI_SUBCMDSHIFT; + common_post_quotactl_p4_check(tid, subop, ARG4, "quotactl"); } PRE(sys_quotactl_fd) @@ -4142,13 +4252,20 @@ PRE(sys_quotactl_fd) // unsigned int, cmd, // qid_t, id, // void __user *, addr) - PRINT("sys_quotactl (0x%" FMT_REGWORD "x, 0x%#" FMT_REGWORD "x, 0x%" + Int subop = ARG2 >> VKI_SUBCMDSHIFT; + PRINT("sys_quotactl_fd (0x%" FMT_REGWORD "x, 0x%#" FMT_REGWORD "x, 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1, ARG2, ARG3, ARG4); PRE_REG_READ4(long, "quotactl_fd", unsigned int, fd, unsigned int, cmd, vki_qid_t, id, void *, addr); if (!ML_(fd_allowed)(ARG1, "quotactl_fd", tid, False)) SET_STATUS_Failure( VKI_EBADF ); + common_pre_quotactl_p4_check(tid, subop, ARG4, status, "quotactl_fd"); +} +POST(sys_quotactl_fd) +{ + Int subop = ARG2 >> VKI_SUBCMDSHIFT; + common_post_quotactl_p4_check(tid, subop, ARG4, "quotactl_fd"); } PRE(sys_waitid) diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 1262449250..5541f4c723 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -896,7 +896,7 @@ static SyscallTableEntry syscall_main_table[] = { //.. GENX_(__NR_init_module, sys_init_module), // 128 //.. // (__NR_delete_module, sys_delete_module), // 129 //.. GENX_(__NR_get_kernel_syms, sys_ni_syscall), // 130 - //.. LINX_(__NR_quotactl, sys_quotactl), // 131 + LINXY (__NR_quotactl, sys_quotactl), // 131 GENX_ (__NR_getpgid, sys_getpgid), // 132 GENX_ (__NR_fchdir, sys_fchdir), // 133 //.. // (__NR_bdflush, sys_bdflush), // 134 @@ -1178,7 +1178,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 - LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 + LINXY(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), // 446 diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index f39bb58cc1..57a522d87a 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -644,7 +644,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_ (__NR_delete_module, sys_delete_module), GENX_ (__NR_get_kernel_syms, sys_ni_syscall), GENX_ (__NR_query_module, sys_ni_syscall), - LINX_ (__NR_quotactl, sys_quotactl), + LINXY (__NR_quotactl, sys_quotactl), /* GENX_(__NR_nfsservctl,sys_nfsservctl), */ GENXY (__NR_getpmsg, sys_getpmsg), GENX_ (__NR_putpmsg, sys_putpmsg), @@ -799,9 +799,9 @@ static SyscallTableEntry syscall_main_table[] = { LINXY (__NR_listmount, sys_listmount), LINX_ (__NR_mseal, sys_mseal), LINX_ (__NR_futex_waitv, sys_futex_waitv), - LINX_ (__NR_quotactl_fd, sys_quotactl_fd), - LINXY(__NR_file_getattr, sys_file_getattr), - LINX_(__NR_file_setattr, sys_file_setattr), + LINXY (__NR_quotactl_fd, sys_quotactl_fd), + LINXY (__NR_file_getattr, sys_file_getattr), + LINX_ (__NR_file_setattr, sys_file_setattr), }; SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index 00bd2e756e..ac4d6aa7e6 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -592,7 +592,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_ (__NR_close, sys_close), LINX_ (__NR_vhangup, sys_vhangup), LINXY (__NR_pipe2, sys_pipe2), - LINX_ (__NR_quotactl, sys_quotactl), + LINXY (__NR_quotactl, sys_quotactl), GENXY (__NR_getdents64, sys_getdents64), LINXY (__NR__llseek, sys_llseek), GENXY (__NR_read, sys_read), diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 99f71b7a66..d3b84a57d5 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -770,7 +770,7 @@ static SyscallTableEntry syscall_table[] = { //.. //.. // Nb: get_kernel_syms() was removed 2.4-->2.6 //.. GENX_(__NR_get_kernel_syms, sys_ni_syscall), // 130 -//.. LINX_(__NR_quotactl, sys_quotactl), // 131 + LINXY(__NR_quotactl, sys_quotactl), // 131 GENX_(__NR_getpgid, sys_getpgid), // 132 GENX_(__NR_fchdir, sys_fchdir), // 133 //.. // (__NR_bdflush, sys_bdflush), // 134 */Linux @@ -1076,7 +1076,7 @@ static SyscallTableEntry syscall_table[] = { LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441 LINX_ (__NR_mount_setattr, sys_mount_setattr), // 442 - LINX_ (__NR_quotactl_fd, sys_quotactl_fd), // 443 + LINXY (__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index e8996b6b78..56b16bb8fb 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -757,7 +757,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_delete_module, sys_delete_module), // 129 // _____(__NR_get_kernel_syms, sys_get_kernel_syms), // 130 - LINX_(__NR_quotactl, sys_quotactl), // 131 + LINXY(__NR_quotactl, sys_quotactl), // 131 GENX_(__NR_getpgid, sys_getpgid), // 132 GENX_(__NR_fchdir, sys_fchdir), // 133 // _____(__NR_bdflush, sys_bdflush), // 134 @@ -1054,7 +1054,7 @@ static SyscallTableEntry syscall_table[] = { LINXY (__NR_epoll_pwait2, sys_epoll_pwait2), // 441 LINX_ (__NR_mount_setattr, sys_mount_setattr), // 442 - LINX_ (__NR_quotactl_fd, sys_quotactl_fd), // 443 + LINXY (__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index 3dbae3cb67..3774c797e8 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -368,7 +368,7 @@ static SyscallTableEntry syscall_main_table[] = { GENX_(__NR_close, sys_close), /* 57 */ LINX_(__NR_vhangup, sys_vhangup), /* 58 */ LINXY(__NR_pipe2, sys_pipe2), /* 59 */ - LINX_(__NR_quotactl, sys_quotactl), /* 60 */ + LINXY(__NR_quotactl, sys_quotactl), /* 60 */ GENXY(__NR_getdents64, sys_getdents64), /* 61 */ LINX_(__NR_lseek, sys_lseek), /* 62 */ GENXY(__NR_read, sys_read), /* 63 */ @@ -598,7 +598,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_faccessat2, sys_faccessat2), /* 439 */ LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), /* 441 */ LINX_(__NR_mount_setattr, sys_mount_setattr), /* 442 */ - LINX_(__NR_quotactl_fd, sys_quotactl_fd), /* 443 */ + LINXY(__NR_quotactl_fd, sys_quotactl_fd), /* 443 */ LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), /* 444 */ LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), /* 445 */ LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), /* 446 */ diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index d96adecde3..8d45a55b11 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -568,7 +568,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_delete_module, sys_delete_module), // 129 GENX_(130, sys_ni_syscall), /* unimplemented (by the kernel) */ // 130 - LINX_(__NR_quotactl, sys_quotactl), // 131 + LINXY(__NR_quotactl, sys_quotactl), // 131 GENX_(__NR_getpgid, sys_getpgid), // 132 GENX_(__NR_fchdir, sys_fchdir), // 133 // ?????(__NR_bdflush, ), // 134 @@ -887,7 +887,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 - LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 + LINXY(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index a83c02b046..b6224321f3 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1316,7 +1316,7 @@ static SyscallTableEntry syscall_table[] = { //zz //zz // Nb: get_kernel_syms() was removed 2.4-->2.6 GENX_(__NR_get_kernel_syms, sys_ni_syscall), // 130 - LINX_(__NR_quotactl, sys_quotactl), // 131 + LINXY(__NR_quotactl, sys_quotactl), // 131 GENX_(__NR_getpgid, sys_getpgid), // 132 GENX_(__NR_fchdir, sys_fchdir), // 133 //zz // (__NR_bdflush, sys_bdflush), // 134 */Linux @@ -1677,7 +1677,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_epoll_pwait2, sys_epoll_pwait2), // 441 LINX_(__NR_mount_setattr, sys_mount_setattr), // 442 - LINX_(__NR_quotactl_fd, sys_quotactl_fd), // 443 + LINXY(__NR_quotactl_fd, sys_quotactl_fd), // 443 LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444 LINX_(__NR_landlock_add_rule, sys_landlock_add_rule), // 445 diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 48aacea22f..e0636378c4 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -5610,6 +5610,57 @@ struct vki_file_attr { __vki_u32 fa_cowextsize; /* CoW extsize field value (get/set) */ }; +//---------------------------------------------------------------------- +// From uapi/linux/mount.h +//---------------------------------------------------------------------- + +#define VKI_SUBCMDMASK 0x00ff +#define VKI_SUBCMDSHIFT 8 + +#define VKI_Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */ +#define VKI_Q_QUOTAON 0x800002 /* turn quotas on */ +#define VKI_Q_QUOTAOFF 0x800003 /* turn quotas off */ +#define VKI_Q_GETFMT 0x800004 /* get quota format used on given filesystem */ +#define VKI_Q_GETINFO 0x800005 /* get information about quota files */ +#define VKI_Q_SETINFO 0x800006 /* set information about quota files */ +#define VKI_Q_GETQUOTA 0x800007 /* get user quota structure */ +#define VKI_Q_SETQUOTA 0x800008 /* set user quota structure */ +#define VKI_Q_GETNEXTQUOTA 0x800009 /* get disk limits and usage >= ID */ + +struct vki_dqblk + { + __vki_u64 dqb_bhardlimit; /* absolute limit on disk quota blocks alloc */ + __vki_u64 dqb_bsoftlimit; /* preferred limit on disk quota blocks */ + __vki_u64 dqb_curspace; /* current quota block count */ + __vki_u64 dqb_ihardlimit; /* maximum # allocated inodes */ + __vki_u64 dqb_isoftlimit; /* preferred inode limit */ + __vki_u64 dqb_curinodes; /* current # allocated inodes */ + __vki_u64 dqb_btime; /* time limit for excessive disk use */ + __vki_u64 dqb_itime; /* time limit for excessive files */ + __vki_u32 dqb_valid; /* bitmask of QIF_* constants */ + }; + + +struct vki_nextdqblk { + __vki_u64 dqb_bhardlimit; + __vki_u64 dqb_bsoftlimit; + __vki_u64 dqb_curspace; + __vki_u64 dqb_ihardlimit; + __vki_u64 dqb_isoftlimit; + __vki_u64 dqb_curinodes; + __vki_u64 dqb_btime; + __vki_u64 dqb_itime; + __vki_u32 dqb_valid; + __vki_u32 dqb_id; +}; + +struct vki_dqinfo { + __vki_u64 dqi_bgrace; + __vki_u64 dqi_igrace; + __vki_u32 dqi_flags; /* DFQ_* */ + __vki_u32 dqi_valid; +}; + /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/ |
|
From: Florian K. <fk...@so...> - 2025-12-03 22:29:52
|
https://sourceware.org/cgit/valgrind/commit/?id=cd9d7d0d2edeef5ef37582c6d6fa55ca3c3bcccd commit cd9d7d0d2edeef5ef37582c6d6fa55ca3c3bcccd Author: Florian Krohm <fl...@ei...> Date: Wed Dec 3 22:26:57 2025 +0000 Change the data type of libvex_Backend::emit. Both the s390 and arm insn emitters need to know the host's hardware capabilities. Today, these are provided by means of global variables s390_host_hwcaps and arm_hwcaps. To eliminate that kludge the emit function is changed. Instead of passing VexEndness we now pass a pointer to VexArchInfo which provides both the endianess and hardware capabilities. Those global variables will be removed in a followup patch. Diff: --- VEX/priv/host_amd64_defs.c | 2 +- VEX/priv/host_amd64_defs.h | 2 +- VEX/priv/host_arm64_defs.c | 2 +- VEX/priv/host_arm64_defs.h | 2 +- VEX/priv/host_arm_defs.c | 2 +- VEX/priv/host_arm_defs.h | 2 +- VEX/priv/host_mips_defs.c | 2 +- VEX/priv/host_mips_defs.h | 2 +- VEX/priv/host_nanomips_defs.c | 2 +- VEX/priv/host_nanomips_defs.h | 2 +- VEX/priv/host_ppc_defs.c | 3 ++- VEX/priv/host_ppc_defs.h | 2 +- VEX/priv/host_riscv64_defs.c | 2 +- VEX/priv/host_riscv64_defs.h | 2 +- VEX/priv/host_s390_defs.c | 2 +- VEX/priv/host_s390_defs.h | 2 +- VEX/priv/host_x86_defs.c | 2 +- VEX/priv/host_x86_defs.h | 2 +- VEX/priv/main_main.c | 8 ++++---- 19 files changed, 23 insertions(+), 22 deletions(-) diff --git a/VEX/priv/host_amd64_defs.c b/VEX/priv/host_amd64_defs.c index d7d1ab1aad..e834e82536 100644 --- a/VEX/priv/host_amd64_defs.c +++ b/VEX/priv/host_amd64_defs.c @@ -2592,7 +2592,7 @@ static UChar* do_ffree_st ( UChar* p, Int n ) Int emit_AMD64Instr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const AMD64Instr* i, - Bool mode64, VexEndness endness_host, + Bool mode64, const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_amd64_defs.h b/VEX/priv/host_amd64_defs.h index 4c16db17bf..731fd2efd3 100644 --- a/VEX/priv/host_amd64_defs.h +++ b/VEX/priv/host_amd64_defs.h @@ -836,7 +836,7 @@ extern Int emit_AMD64Instr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const AMD64Instr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_arm64_defs.c b/VEX/priv/host_arm64_defs.c index da52748eb9..b00aad94d5 100644 --- a/VEX/priv/host_arm64_defs.c +++ b/VEX/priv/host_arm64_defs.c @@ -3627,7 +3627,7 @@ static UInt* do_load_or_store64 ( UInt* p, Int emit_ARM64Instr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const ARM64Instr* i, - Bool mode64, VexEndness endness_host, + Bool mode64, const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_arm64_defs.h b/VEX/priv/host_arm64_defs.h index 4f5b1bce3e..83bb6a286e 100644 --- a/VEX/priv/host_arm64_defs.h +++ b/VEX/priv/host_arm64_defs.h @@ -1115,7 +1115,7 @@ extern void mapRegs_ARM64Instr ( HRegRemap*, ARM64Instr*, Bool ); extern Int emit_ARM64Instr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const ARM64Instr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo *archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_arm_defs.c b/VEX/priv/host_arm_defs.c index 39d89f7e87..a838565a20 100644 --- a/VEX/priv/host_arm_defs.c +++ b/VEX/priv/host_arm_defs.c @@ -3069,7 +3069,7 @@ static UInt* do_load_or_store32 ( UInt* p, Int emit_ARMInstr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const ARMInstr* i, - Bool mode64, VexEndness endness_host, + Bool mode64, const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_arm_defs.h b/VEX/priv/host_arm_defs.h index 904bd0c43c..d6dbc4ee27 100644 --- a/VEX/priv/host_arm_defs.h +++ b/VEX/priv/host_arm_defs.h @@ -1057,7 +1057,7 @@ extern void mapRegs_ARMInstr ( HRegRemap*, ARMInstr*, Bool ); extern Int emit_ARMInstr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const ARMInstr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_mips_defs.c b/VEX/priv/host_mips_defs.c index ad92c055c9..d018aac841 100644 --- a/VEX/priv/host_mips_defs.c +++ b/VEX/priv/host_mips_defs.c @@ -3768,7 +3768,7 @@ static UChar *mkMoveReg(UChar * p, UInt r_dst, UInt r_src) Int emit_MIPSInstr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const MIPSInstr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_mips_defs.h b/VEX/priv/host_mips_defs.h index 423f68ea09..838368b85c 100644 --- a/VEX/priv/host_mips_defs.h +++ b/VEX/priv/host_mips_defs.h @@ -1006,7 +1006,7 @@ extern void mapRegs_MIPSInstr (HRegRemap *, MIPSInstr *, Bool mode64); extern Int emit_MIPSInstr (/*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const MIPSInstr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_nanomips_defs.c b/VEX/priv/host_nanomips_defs.c index 3e91c904f6..19b4ee0fa4 100644 --- a/VEX/priv/host_nanomips_defs.c +++ b/VEX/priv/host_nanomips_defs.c @@ -1343,7 +1343,7 @@ Int emit_NANOMIPSInstr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const NANOMIPSInstr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_nanomips_defs.h b/VEX/priv/host_nanomips_defs.h index beb8084797..aa40b1e140 100644 --- a/VEX/priv/host_nanomips_defs.h +++ b/VEX/priv/host_nanomips_defs.h @@ -393,7 +393,7 @@ extern Int emit_NANOMIPSInstr (/*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const NANOMIPSInstr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_ppc_defs.c b/VEX/priv/host_ppc_defs.c index dfefcb3fd4..7dc9714572 100644 --- a/VEX/priv/host_ppc_defs.c +++ b/VEX/priv/host_ppc_defs.c @@ -4154,7 +4154,7 @@ static UChar* mkFormVA ( UChar* p, UInt opc1, UInt r1, UInt r2, */ Int emit_PPCInstr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const PPCInstr* i, - Bool mode64, VexEndness endness_host, + Bool mode64, const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, @@ -4167,6 +4167,7 @@ Int emit_PPCInstr ( /*MB_MOD*/Bool* is_profInc, vex_printf("asm ");ppPPCInstr(i, mode64); vex_printf("\n"); } + VexEndness endness_host = archinfo_host->endness; switch (i->tag) { case Pin_LI: diff --git a/VEX/priv/host_ppc_defs.h b/VEX/priv/host_ppc_defs.h index c57afd50b5..df376e21c7 100644 --- a/VEX/priv/host_ppc_defs.h +++ b/VEX/priv/host_ppc_defs.h @@ -1269,7 +1269,7 @@ extern void mapRegs_PPCInstr ( HRegRemap*, PPCInstr* , Bool mode64); extern Int emit_PPCInstr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const PPCInstr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_riscv64_defs.c b/VEX/priv/host_riscv64_defs.c index 152d4ae92c..dcb1a968de 100644 --- a/VEX/priv/host_riscv64_defs.c +++ b/VEX/priv/host_riscv64_defs.c @@ -1774,7 +1774,7 @@ Int emit_RISCV64Instr(/*MB_MOD*/ Bool* is_profInc, Int nbuf, const RISCV64Instr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_riscv64_defs.h b/VEX/priv/host_riscv64_defs.h index 7a97f90ef4..97a8420f79 100644 --- a/VEX/priv/host_riscv64_defs.h +++ b/VEX/priv/host_riscv64_defs.h @@ -612,7 +612,7 @@ Int emit_RISCV64Instr(/*MB_MOD*/ Bool* is_profInc, Int nbuf, const RISCV64Instr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index 04b06c4cfe..3479bbc91b 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -10896,7 +10896,7 @@ s390_insn_vec_replicate_emit(UChar *buf, const s390_insn *insn) Int emit_S390Instr(Bool *is_profinc, UChar *buf, Int nbuf, const s390_insn *insn, - Bool mode64, VexEndness endness_host, + Bool mode64, const VexArchInfo *archinfo, const void *disp_cp_chain_me_to_slowEP, const void *disp_cp_chain_me_to_fastEP, const void *disp_cp_xindir, diff --git a/VEX/priv/host_s390_defs.h b/VEX/priv/host_s390_defs.h index 48ea79f18d..a743abb501 100644 --- a/VEX/priv/host_s390_defs.h +++ b/VEX/priv/host_s390_defs.h @@ -885,7 +885,7 @@ UInt ppHRegS390(HReg); void getRegUsage_S390Instr( HRegUsage *, const s390_insn *, Bool ); void mapRegs_S390Instr ( HRegRemap *, s390_insn *, Bool ); Int emit_S390Instr ( Bool *, UChar *, Int, const s390_insn *, Bool, - VexEndness, const void *, const void *, + const VexArchInfo *, const void *, const void *, const void *, const void *); const RRegUniverse *getRRegUniverse_S390( void ); void genSpill_S390 ( HInstr **, HInstr **, HReg , Int , Bool ); diff --git a/VEX/priv/host_x86_defs.c b/VEX/priv/host_x86_defs.c index 200c122fd8..5b50d8a536 100644 --- a/VEX/priv/host_x86_defs.c +++ b/VEX/priv/host_x86_defs.c @@ -2122,7 +2122,7 @@ static UChar* push_word_from_tags ( UChar* p, UShort tags ) Int emit_X86Instr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const X86Instr* i, - Bool mode64, VexEndness endness_host, + Bool mode64, const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/host_x86_defs.h b/VEX/priv/host_x86_defs.h index ecd74e6a53..65cca18f6f 100644 --- a/VEX/priv/host_x86_defs.h +++ b/VEX/priv/host_x86_defs.h @@ -717,7 +717,7 @@ extern void mapRegs_X86Instr ( HRegRemap*, X86Instr*, Bool ); extern Int emit_X86Instr ( /*MB_MOD*/Bool* is_profInc, UChar* buf, Int nbuf, const X86Instr* i, Bool mode64, - VexEndness endness_host, + const VexArchInfo* archinfo_host, const void* disp_cp_chain_me_to_slowEP, const void* disp_cp_chain_me_to_fastEP, const void* disp_cp_xindir, diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index 32a78190ad..e979952853 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -780,9 +780,9 @@ static void libvex_BackEnd ( const VexTranslateArgs *vta, const VexAbiInfo*, Int, Int, Bool, Bool, Addr ); Int (*emit) ( /*MB_MOD*/Bool*, - UChar*, Int, const HInstr*, Bool, VexEndness, - const void*, const void*, const void*, - const void* ); + UChar*, Int, const HInstr*, Bool, + const VexArchInfo*, const void*, + const void*, const void*, const void* ); Bool (*preciseMemExnsFn) ( Int, Int, VexRegisterUpdates ); const RRegUniverse* rRegUniv = NULL; @@ -1232,7 +1232,7 @@ static void libvex_BackEnd ( const VexTranslateArgs *vta, } j = emit( &hi_isProfInc, insn_bytes, sizeof insn_bytes, hi, - mode64, vta->archinfo_host.endness, + mode64, &vta->archinfo_host, vta->disp_cp_chain_me_to_slowEP, vta->disp_cp_chain_me_to_fastEP, vta->disp_cp_xindir, |
|
From: Florian K. <fk...@so...> - 2025-12-03 17:16:24
|
https://sourceware.org/cgit/valgrind/commit/?id=fabbec1163e1f5854f5553d6b627525ec614d8b9 commit fabbec1163e1f5854f5553d6b627525ec614d8b9 Author: Florian Krohm <fl...@ei...> Date: Wed Dec 3 17:15:42 2025 +0000 s390: Remove unused function parameter Diff: --- VEX/priv/host_s390_defs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index 063ede22af..04b06c4cfe 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -10620,8 +10620,7 @@ s390_insn_xassisted_emit(UChar *buf, const s390_insn *insn, The dispatch counter is a 32-bit value. */ static UChar * -s390_insn_evcheck_emit(UChar *buf, const s390_insn *insn, - VexEndness endness_host) +s390_insn_evcheck_emit(UChar *buf, const s390_insn *insn) { s390_amode *amode; UInt b, d; @@ -11060,7 +11059,7 @@ emit_S390Instr(Bool *is_profinc, UChar *buf, Int nbuf, const s390_insn *insn, break; case S390_INSN_EVCHECK: - end = s390_insn_evcheck_emit(buf, insn, endness_host); + end = s390_insn_evcheck_emit(buf, insn); break; case S390_INSN_XDIRECT: |
|
From: Paul F. <pa...@so...> - 2025-12-01 21:26:44
|
https://sourceware.org/cgit/valgrind/commit/?id=c15bcfe15bd785a528725eebb7d985fcb8a86bed commit c15bcfe15bd785a528725eebb7d985fcb8a86bed Author: Paul Floyd <pj...@wa...> Date: Mon Dec 1 22:26:10 2025 +0100 Darwin regtest: DRD filters and more suppressions Diff: --- darwin17.supp | 39 +++++++++++++++++++++++++++++++++++++++ drd/tests/filter_stderr.in | 1 + 2 files changed, 40 insertions(+) diff --git a/darwin17.supp b/darwin17.supp index 528a9f139a..71d79d844e 100644 --- a/darwin17.supp +++ b/darwin17.supp @@ -1056,3 +1056,42 @@ fun:xpc_pipe_routine } +{ + OSX1013:drd:__si_module_static_cache_block_invoke + drd:MutexErr + fun:pthread_mutex_init + fun:__si_module_static_cache_block_invoke +} + +{ + OSX1013:drd:setlocale + drd:ConflictingAccess + ... + fun:setlocale +} + +{ + OSX1013:drd:std::__1::__thread_specific_ptr<std::__1::__thread_struct>::set_pointer(std::__1::__thread_struct*) + + drd:ConflictingAccess + fun:_ZNSt3__121__thread_specific_ptrINS_15__thread_structEE11set_pointerEPS1_ +} + +{ + OSX1013:drd:std::__1::__thread_local_data + drd:ConflictingAccess + fun:_ZNSt3__119__thread_local_dataEv +} + +{ + OSX1013:drd:get_counter + drd:ConflictingAccess + fun:_ZL11get_counterv +} + +{ + OSX1013:drd:gomp_barier_wait + drd:ConflictingAccess + fun:gomp_barrier_wait + fun:child +} diff --git a/drd/tests/filter_stderr.in b/drd/tests/filter_stderr.in index fea9bcff9d..bde4e597ab 100644 --- a/drd/tests/filter_stderr.in +++ b/drd/tests/filter_stderr.in @@ -38,6 +38,7 @@ $SED \ -e "s/[A-Za-z_]* (pthread_create.c:[0-9]*)/(within libpthread-?.?.so)/" \ -e "s/[A-Za-z_]* (in [^ ]*libpthread-[0-9.]*\.so)/(within libpthread-?.?.so)/" \ -e "s/... (in \/lib\/libthr.so.3)/start_thread/" \ +-e "s/_pthread_body (in \/...libc...)/start_thread/" \ -e "s:(within /lib[0-9]*/ld-[0-9.]*\.so):(within ld-?.?.so):" \ -e "s/was held during [0-9][0-9]*/was held during .../" \ -e "s: BSS section of [^<]*/: BSS section of :g" \ |
|
From: Paul F. <pa...@so...> - 2025-12-01 08:05:42
|
https://sourceware.org/cgit/valgrind/commit/?id=6da5389ecf5f6efe3c174d64eb2e60194c728f96 commit 6da5389ecf5f6efe3c174d64eb2e60194c728f96 Author: Paul Floyd <pj...@wa...> Date: Mon Dec 1 09:04:46 2025 +0100 Darwin: update readmacho code Code from Louis Brunner Diff: --- coregrind/m_debuginfo/readmacho.c | 520 ++++++++++++++++++++++++++++---------- coregrind/pub_core_mach.h | 36 ++- 2 files changed, 423 insertions(+), 133 deletions(-) diff --git a/coregrind/m_debuginfo/readmacho.c b/coregrind/m_debuginfo/readmacho.c index dc2023bc77..66fd57e06d 100644 --- a/coregrind/m_debuginfo/readmacho.c +++ b/coregrind/m_debuginfo/readmacho.c @@ -37,6 +37,7 @@ #include "pub_core_libcfile.h" #include "pub_core_libcproc.h" #include "pub_core_aspacemgr.h" /* for mmaping debuginfo files */ +#include "pub_core_mach.h" /* VG_(dyld_cache_get_slide) */ #include "pub_core_machine.h" /* VG_ELF_CLASS */ #include "pub_core_options.h" #include "pub_core_oset.h" @@ -145,7 +146,7 @@ Bool ML_(check_macho_and_get_rw_loads)( Int fd, Int* rw_loads ) return True; } - const struct MACH_HEADER* mh = (const struct MACH_HEADER*)macho_header; + const struct MACH_HEADER* mh = (const struct MACH_HEADER*)macho_header; vg_assert(mh); if (mh->magic != MAGIC) { return False; @@ -154,15 +155,36 @@ Bool ML_(check_macho_and_get_rw_loads)( Int fd, Int* rw_loads ) HChar* macho_load_commands = ML_(dinfo_zalloc)("di.readmacho.macho_load_commands", mh->sizeofcmds); preadres = VG_(pread)( fd, macho_load_commands, mh->sizeofcmds, sizeof(struct MACH_HEADER) ); if (sr_isError(preadres) || sr_Res(preadres) < mh->sizeofcmds) { - ML_(dinfo_free)(macho_load_commands); - return False; + ML_(dinfo_free)(macho_load_commands); + return False; } - *rw_loads = count_rw_loads((const struct load_command*)macho_load_commands, mh->ncmds); ML_(dinfo_free)(macho_load_commands); return True; } +Bool ML_(check_macho_and_get_rw_loads_from_memory)( const void* buf, SizeT szB, Int* rw_loads ) +{ + vg_assert(buf); + vg_assert(rw_loads); + + if (szB < sizeof(struct fat_header)) { + return False; + } + if (check_fat_macho_and_get_rw_loads(buf, rw_loads)) { + return True; + } + + const struct MACH_HEADER* mh = (const struct MACH_HEADER*)buf; + vg_assert(mh); + if (mh->magic != MAGIC) { + return False; + } + + *rw_loads = count_rw_loads((const struct load_command*)((const HChar*)mh + sizeof(struct MACH_HEADER)), mh->ncmds); + return True; +} + /* Unmap an image mapped in by map_image_aboard. */ static void unmap_image ( /*MOD*/DiSlice* sli ) @@ -174,19 +196,29 @@ static void unmap_image ( /*MOD*/DiSlice* sli ) } } - /* Open the given file, find the thin part if necessary, do some checks, and return a DiSlice containing details of both the thin part and (implicitly, via the contained DiImage*) the fat part. returns DiSlice_INVALID if it fails. If it succeeds, the returned slice is guaranteed to refer to a valid(ish) Mach-O image. */ static DiSlice map_image_aboard ( DebugInfo* di, /* only for err msgs */ - const HChar* filename ) + const HChar* filename, + const DebugInfoMapping* rx_map ) { DiSlice sli = DiSlice_INVALID; /* First off, try to map the thing in. */ - DiImage* mimg = ML_(img_from_local_file)(filename); + DiImage* mimg; + + if (rx_map != NULL) { + // FIXME: basically, we make a slice from the place where the mach_header is until the end of the memory space + // unfortunately, all the data needed for parsing from the DSC is spread across many places in memory + // and there is no way to know for sure the size of the DSC perfectly, so this is the best method at the moment + // and it's _very_ unsafe + mimg = ML_(img_from_memory)(rx_map->avma, MACH_DSC_END - rx_map->avma, filename); + } else { + mimg = ML_(img_from_local_file)(filename); + } if (mimg == NULL) { VG_(message)(Vg_UserMsg, "warning: connection to image %s failed\n", filename ); @@ -199,7 +231,7 @@ static DiSlice map_image_aboard ( DebugInfo* di, /* only for err msgs */ DiOffT fh_be_ioff = 0; struct fat_header fh_be; struct fat_header fh; - + // Assume initially that we have a thin image, and narrow // the bounds if it turns out to be fat. This stores |mimg| as // |sli.img|, so NULL out |mimg| after this point, for the sake of @@ -240,6 +272,8 @@ static DiSlice map_image_aboard ( DebugInfo* di, /* only for err msgs */ Int cputype = CPU_TYPE_X86; # elif defined(VGA_amd64) Int cputype = CPU_TYPE_X86_64; +# elif defined(VGA_arm64) + Int cputype = CPU_TYPE_ARM64; # else # error "unknown architecture" # endif @@ -328,20 +362,108 @@ static DiSlice map_image_aboard ( DebugInfo* di, /* only for err msgs */ /*--- ---*/ /*------------------------------------------------------------*/ +static +void add_symbol( /*OUT*/XArray* /* DiSym */ syms, + struct _DebugInfo* di, + struct NLIST* nl, Addr sym_addr, + const HChar* prefix, + DiCursor strtab_cur, UInt strtab_sz ) +{ + DiSym disym; + + // "start_according_to_valgrind" + static const HChar* s_a_t_v = NULL; /* do not make non-static */ + + Bool inside_text = di->text_present && sym_addr >= di->text_avma && sym_addr < di->text_avma + di->text_size; + Bool inside_data = di->data_present && sym_addr >= di->data_avma && sym_addr < di->data_avma + di->data_size; + Bool inside_d_data = di->sdata_present && sym_addr >= di->sdata_avma && sym_addr < di->sdata_avma + di->sdata_size; + + if (di->trace_symtab) { + HChar* str = ML_(cur_read_strdup)( + ML_(cur_plus)(strtab_cur, nl->n_un.n_strx), + "di.read_symtab.1"); + VG_(printf)("nlist raw: avma %010lx %s in %s %s\n", + sym_addr, str, + inside_text ? "__TEXT" : inside_data ? "__DATA" : inside_d_data ? "__DATA_DIRTY" : "???", + prefix + ); + ML_(dinfo_free)(str); + } + + /* If no part of the symbol falls within the mapped range, + ignore it. */ + if (!inside_text && !inside_data && !inside_d_data) { + return; + } + + /* skip names which point outside the string table; + following these risks segfaulting Valgrind */ + if (nl->n_un.n_strx < 0 || nl->n_un.n_strx >= strtab_sz) { + return; + } + + HChar* name + = ML_(cur_read_strdup)( ML_(cur_plus)(strtab_cur, nl->n_un.n_strx), + "di.read_symtab.2"); + + /* skip nameless symbols; these appear to be common, but + useless */ + if (*name == 0) { + ML_(dinfo_free)(name); + return; + } + + if (prefix[0]) { + HChar* newname = ML_(dinfo_zalloc)("di.read_symtab.3", + VG_(strlen)(prefix) + VG_(strlen)(name)); + VG_(strcpy)(newname, prefix); + VG_(strcat)(newname, name); + ML_(dinfo_free)(name); + name = newname; + } + + VG_(bzero_inline)(&disym, sizeof(disym)); + disym.avmas.main = sym_addr; + SET_TOCPTR_AVMA(disym, 0); + SET_LOCAL_EP_AVMA(disym, 0); + disym.pri_name = ML_(addStr)(di, name, -1); + disym.sec_names = NULL; + disym.size = // let canonicalize fix it + di->text_avma+di->text_size - sym_addr; + disym.isText = inside_text; + disym.isIFunc = False; + disym.isGlobal = inside_data || inside_d_data; + // Lots of user function names get prepended with an underscore. Eg. the + // function 'f' becomes the symbol '_f'. And the "below main" + // function is called "start". So we skip the leading underscore, and + // if we see 'start' and --show-below-main=no, we rename it as + // "start_according_to_valgrind", which makes it easy to spot later + // and display as "(below main)". + if (disym.pri_name[0] == '_') { + disym.pri_name++; + } + else if (!VG_(clo_show_below_main) && VG_STREQ(disym.pri_name, "start")) { + if (s_a_t_v == NULL) + s_a_t_v = ML_(addStr)(di, "start_according_to_valgrind", -1); + vg_assert(s_a_t_v); + disym.pri_name = s_a_t_v; + } + + vg_assert(disym.pri_name); + VG_(addToXA)( syms, &disym ); + ML_(dinfo_free)(name); +} + /* Read a symbol table (nlist). Add the resulting candidate symbols to 'syms'; the caller will post-process them and hand them off to ML_(addSym) itself. */ static void read_symtab( /*OUT*/XArray* /* DiSym */ syms, - struct _DebugInfo* di, + struct _DebugInfo* di, DiCursor symtab_cur, UInt symtab_count, DiCursor strtab_cur, UInt strtab_sz ) { Int i; - DiSym disym; - - // "start_according_to_valgrind" - static const HChar* s_a_t_v = NULL; /* do not make non-static */ for (i = 0; i < symtab_count; i++) { struct NLIST nl; @@ -358,72 +480,37 @@ void read_symtab( /*OUT*/XArray* /* DiSym */ syms, } else { continue; } - - if (di->trace_symtab) { - HChar* str = ML_(cur_read_strdup)( - ML_(cur_plus)(strtab_cur, nl.n_un.n_strx), - "di.read_symtab.1"); - VG_(printf)("nlist raw: avma %010lx %s\n", sym_addr, str ); - ML_(dinfo_free)(str); - } - /* If no part of the symbol falls within the mapped range, - ignore it. */ - if (sym_addr <= di->text_avma - || sym_addr >= di->text_avma+di->text_size) { - continue; - } - - /* skip names which point outside the string table; - following these risks segfaulting Valgrind */ - if (nl.n_un.n_strx < 0 || nl.n_un.n_strx >= strtab_sz) { - continue; - } - - HChar* name - = ML_(cur_read_strdup)( ML_(cur_plus)(strtab_cur, nl.n_un.n_strx), - "di.read_symtab.2"); + add_symbol(syms, di, &nl, sym_addr, "", strtab_cur, strtab_sz); + } +} - /* skip nameless symbols; these appear to be common, but - useless */ - if (*name == 0) { - ML_(dinfo_free)(name); - continue; - } +// See reason for disabling later in this file +#if 0 +static +void add_indirect_symbols( /*OUT*/XArray* /* DiSym */ syms, + struct _DebugInfo* di, + struct SECTION* section, SizeT entry_size, + DiCursor indir_cur, UInt indir_count, + DiCursor symtab_cur, UInt symtab_count, + DiCursor strtab_cur, UInt strtab_sz ) +{ + for (Int i = 0; i < indir_count; i++) { + Int index; + struct NLIST nl; + ML_(cur_read_get)(&index, + ML_(cur_plus)(indir_cur, i * sizeof(Int)), + sizeof(index)); + ML_(cur_read_get)(&nl, + ML_(cur_plus)(symtab_cur, index * sizeof(struct NLIST)), + sizeof(nl)); - VG_(bzero_inline)(&disym, sizeof(disym)); - disym.avmas.main = sym_addr; - SET_TOCPTR_AVMA(disym, 0); - SET_LOCAL_EP_AVMA(disym, 0); - disym.pri_name = ML_(addStr)(di, name, -1); - disym.sec_names = NULL; - disym.size = // let canonicalize fix it - di->text_avma+di->text_size - sym_addr; - disym.isText = True; - disym.isIFunc = False; - disym.isGlobal = False; - // Lots of user function names get prepended with an underscore. Eg. the - // function 'f' becomes the symbol '_f'. And the "below main" - // function is called "start". So we skip the leading underscore, and - // if we see 'start' and --show-below-main=no, we rename it as - // "start_according_to_valgrind", which makes it easy to spot later - // and display as "(below main)". - if (disym.pri_name[0] == '_') { - disym.pri_name++; - } - else if (!VG_(clo_show_below_main) && VG_STREQ(disym.pri_name, "start")) { - if (s_a_t_v == NULL) - s_a_t_v = ML_(addStr)(di, "start_according_to_valgrind", -1); - vg_assert(s_a_t_v); - disym.pri_name = s_a_t_v; - } + Addr sym_addr = di->text_bias + section->addr + i * entry_size; - vg_assert(disym.pri_name); - VG_(addToXA)( syms, &disym ); - ML_(dinfo_free)(name); + add_symbol(syms, di, &nl, sym_addr, section->sectname, strtab_cur, strtab_sz); } } - +#endif /* Compare DiSyms by their start address, and for equal addresses, use the primary name as a secondary sort key. */ @@ -536,7 +623,7 @@ static Bool file_exists_p(const HChar *path) } -/* Search for an existing dSYM file as a possible separate debug file. +/* Search for an existing dSYM file as a possible separate debug file. Adapted from gdb. */ static HChar * find_separate_debug_file (const HChar *executable_name) @@ -545,7 +632,7 @@ find_separate_debug_file (const HChar *executable_name) HChar *dot_ptr; HChar *slash_ptr; HChar *dsymfile; - + /* Make sure the object file name itself doesn't contain ".dSYM" in it or we will end up with an infinite loop where after we add a dSYM symbol file, it will then enter this function asking if there is a debug file for the @@ -554,23 +641,23 @@ find_separate_debug_file (const HChar *executable_name) { /* Check for the existence of a .dSYM file for a given executable. */ basename_str = VG_(basename) (executable_name); - dsymfile = ML_(dinfo_zalloc)("di.readmacho.dsymfile", + dsymfile = ML_(dinfo_zalloc)("di.readmacho.dsymfile", VG_(strlen) (executable_name) + VG_(strlen) (APPLE_DSYM_EXT_AND_SUBDIRECTORY) + VG_(strlen) (basename_str) + 1 ); - + /* First try for the dSYM in the same directory as the original file. */ VG_(strcpy) (dsymfile, executable_name); VG_(strcat) (dsymfile, APPLE_DSYM_EXT_AND_SUBDIRECTORY); VG_(strcat) (dsymfile, basename_str); - + if (file_exists_p (dsymfile)) return dsymfile; - + /* Now search for any parent directory that has a '.' in it so we can find - Mac OS X applications, bundles, plugins, and any other kinds of files. + Mac OS X applications, bundles, plugins, and any other kinds of files. Mac OS X application bundles wil have their program in "/some/path/MyApp.app/Contents/MacOS/MyApp" (or replace ".app" with ".bundle" or ".plugin" for other types of bundles). So we look for any @@ -595,7 +682,7 @@ find_separate_debug_file (const HChar *executable_name) if (file_exists_p (dsymfile)) return dsymfile; } - + /* NULL terminate the string at the '.' character and append the path down to the dSYM file. */ *dot_ptr = '\0'; @@ -603,11 +690,11 @@ find_separate_debug_file (const HChar *executable_name) VG_(strcat) (dot_ptr, basename_str); if (file_exists_p (dsymfile)) return dsymfile; - + /* NULL terminate the string at the '.' locatated by the strrchr() function again. */ *dot_ptr = '\0'; - + /* We found a previous extension '.' character and did not find a dSYM file so now find previous directory delimiter so we don't try multiple times on a file name that may have a version number @@ -640,7 +727,7 @@ static DiSlice getsectdata ( DiSlice img, Int c; for (c = 0; c < mh.ncmds; c++) { - struct load_command cmd; + struct load_command cmd; ML_(cur_read_get)(&cmd, cur, sizeof(cmd)); if (cmd.cmd == LC_SEGMENT_CMD) { struct SEGMENT_COMMAND seg; @@ -652,7 +739,7 @@ static DiSlice getsectdata ( DiSlice img, for (s = 0; s < seg.nsects; s++) { struct SECTION sect; ML_(cur_step_get)(§, §s_cur, sizeof(sect)); - if (0 == VG_(strncmp)(sect.sectname, sectname, + if (0 == VG_(strncmp)(sect.sectname, sectname, sizeof(sect.sectname))) { DiSlice res = img; res.ioff = sect.offset; @@ -741,17 +828,31 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) DiCursor dysym_cur = DiCursor_INVALID; HChar* dsymfilename = NULL; Bool have_uuid = False; + Bool from_memory = False; // True if we're reading from DSC + Bool have_rw = False; + Addr kernel_slide = 0; // Used when from_memory is True UChar uuid[16]; Word i; + struct SEGMENT_COMMAND data_const = {.cmd = 0}; + struct SEGMENT_COMMAND link_edit = {.cmd = 0}; const DebugInfoMapping* rx_map = NULL; const DebugInfoMapping* rw_map = NULL; - /* mmap the object file to look for di->soname and di->text_bias + /* mmap the object file to look for di->soname and di->text_bias and uuid and nlist */ /* This should be ensured by our caller (that we're in the accept state). */ vg_assert(di->fsm.have_rx_map); +#if DARWIN_VERS >= DARWIN_11_00 + if (di->from_memory) { + from_memory = True; + kernel_slide = VG_(dyld_cache_get_slide)(); + } +#endif + if (di->fsm.rw_map_count) { + have_rw = True; + } for (i = 0; i < VG_(sizeXA)(di->fsm.maps); i++) { const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, i); @@ -759,19 +860,27 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) rx_map = map; if (map->rw && !rw_map) rw_map = map; - if (rx_map && rw_map) + if (rx_map && (rw_map || !have_rw)) break; } vg_assert(rx_map); + vg_assert(!have_rw || rw_map); - if (VG_(clo_verbosity) > 1) + if (VG_(clo_verbosity) > 1) { + if (!have_rw) { + VG_(message)(Vg_DebugMsg, + "%s (rx at %#lx)\n", di->fsm.filename, + rx_map->avma); + } else { VG_(message)(Vg_DebugMsg, "%s (rx at %#lx, rw at %#lx)\n", di->fsm.filename, rx_map->avma, rw_map->avma ); + } + } VG_(memset)(&uuid, 0, sizeof(uuid)); - msli = map_image_aboard( di, di->fsm.filename ); + msli = map_image_aboard( di, di->fsm.filename, from_memory ? rx_map : NULL ); if (!ML_(sli_is_valid)(msli)) { ML_(symerr)(di, False, "Connect to main image failed."); goto fail; @@ -782,19 +891,15 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) /* Poke around in the Mach-O header, to find some important stuff. */ // Find LC_SYMTAB and LC_DYSYMTAB, if present. - // Read di->soname from LC_ID_DYLIB if present, - // or from LC_ID_DYLINKER if present, + // Read di->soname from LC_ID_DYLIB if present, + // or from LC_ID_DYLINKER if present, // or use "NONE". // Get di->text_bias (aka slide) based on the corresponding LC_SEGMENT // Get uuid for later dsym search di->text_bias = 0; - if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir)) - VG_(message)(Vg_DebugMsg, "Reading syms from %s\n", - di->fsm.filename ); - - { + { DiCursor cmd_cur = ML_(cur_from_sli)(msli); struct MACH_HEADER mh; @@ -808,13 +913,13 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) for (c = 0; c < mh.ncmds; c++) { struct load_command cmd; ML_(cur_read_get)(&cmd, cmd_cur, sizeof(cmd)); - + if (cmd.cmd == LC_SYMTAB) { sym_cur = cmd_cur; - } + } else if (cmd.cmd == LC_DYSYMTAB) { dysym_cur = cmd_cur; - } + } else if (cmd.cmd == LC_ID_DYLIB && mh.filetype == MH_DYLIB) { // GrP fixme bundle? struct dylib_command dcmd; @@ -879,7 +984,7 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) if (!di->text_present && 0 == VG_(strcmp)(&seg.segname[0], "__TEXT") /* DDD: is the next line a kludge? -- JRS */ - && seg.fileoff == 0 && seg.filesize != 0) { + && (from_memory || seg.fileoff == 0) && seg.filesize != 0) { di->text_present = True; di->text_svma = (Addr)seg.vmaddr; di->text_avma = rx_map->avma; @@ -893,18 +998,56 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) di->text_debug_svma = di->text_svma; di->text_debug_bias = di->text_bias; } + if (0 == VG_(strcmp)(seg.segname, "__DATA_CONST")) { + data_const = seg; + } /* Try for __DATA */ - if (!di->data_present + if (have_rw && !di->data_present && 0 == VG_(strcmp)(&seg.segname[0], "__DATA") /* && DDD:seg->fileoff == 0 */ && seg.filesize != 0) { di->data_present = True; di->data_svma = (Addr)seg.vmaddr; di->data_avma = rw_map->avma; +#if defined(VGA_arm64) + // FIXME: the same mmap contains both __DATA_CONST, __DATA and __DATA_DIRTY + // this means that symbols in __DATA/__DATA_DIRTY are offset by the size of __DATA_CONST + // not sure when this started to be an issue so I am going to gate this under arm64 for now + if (data_const.cmd != 0) { + di->data_avma += data_const.vmsize; + } +#endif di->data_size = seg.vmsize; di->data_bias = di->data_avma - di->data_svma; di->data_debug_svma = di->data_svma; di->data_debug_bias = di->data_bias; } + /* We store __DATA_DIRTY inside .sdata (because they correspond somewhat). + Some binaries have very important information there, + notably dyld and its dyld_all_image_infos. */ + if (have_rw && !di->sdata_present + && 0 == VG_(strcmp)(&seg.segname[0], "__DATA_DIRTY") + /* && DDD:seg->fileoff == 0 */ && seg.filesize != 0) { + di->sdata_present = True; + di->sdata_svma = (Addr)seg.vmaddr; + // FIXME: assumes __DATA was found first (which in practice should be fine) + di->sdata_avma = rw_map->avma + di->data_size; +#if defined(VGA_arm64) + // FIXME: the same mmap contains both __DATA_CONST, __DATA and __DATA_DIRTY + // this means that symbols in __DATA/__DATA_DIRTY are offset by the size of __DATA_CONST + // not sure when this started to be an issue so I am going to gate this under arm64 for now + if (data_const.cmd != 0) { + di->sdata_avma += data_const.vmsize; + } +#endif + di->sdata_size = seg.vmsize; + di->sdata_bias = di->sdata_avma - di->sdata_svma; + di->sdata_debug_svma = di->sdata_svma; + di->sdata_debug_bias = di->sdata_bias; + } + /* Try for __LINKEDIT */ + if (0 == VG_(strcmp)(&seg.segname[0], "__LINKEDIT")) { + link_edit = seg; + } } else if (cmd.cmd == LC_UUID) { ML_(cur_read_get)(&uuid, cmd_cur, sizeof(uuid)); @@ -915,6 +1058,11 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) } } + if (from_memory && link_edit.cmd == 0) { + ML_(symerr)(di, False, "Invalid Mach-O file (missing __LINKEDIT)."); + goto fail; + } + if (!di->soname) { di->soname = ML_(dinfo_strdup)("di.readmacho.noname", "NONE"); } @@ -930,13 +1078,19 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) // We already asserted that .. vg_assert(msli.img != NULL && msli.szB > 0); - if (ML_(cur_is_valid)(sym_cur) && ML_(cur_is_valid)(dysym_cur)) { + if (ML_(cur_is_valid)(sym_cur)) { + // Some binaries (e.g. Valgrind's tools themselves, like memcheck) + // don't have dynamic symbols because they are static binaries. + // Let's try to load symbols using a single table. + Bool has_dynamic = ML_(cur_is_valid)(dysym_cur); struct symtab_command symcmd; struct dysymtab_command dysymcmd; ML_(cur_read_get)(&symcmd, sym_cur, sizeof(symcmd)); - ML_(cur_read_get)(&dysymcmd, dysym_cur, sizeof(dysymcmd)); + if (has_dynamic) { + ML_(cur_read_get)(&dysymcmd, dysym_cur, sizeof(dysymcmd)); + } /* Read nlist symbol table */ DiCursor syms = DiCursor_INVALID; @@ -944,25 +1098,50 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) XArray* /* DiSym */ candSyms = NULL; Word nCandSyms; - if (msli.szB < symcmd.stroff + symcmd.strsize - || msli.szB < symcmd.symoff + symcmd.nsyms - * sizeof(struct NLIST)) { + // FIXME: there is no real nice way to check this when using DSC + // the chunk that msli points to is only the mach_header + load_commands + // but not the actual sections (__TEXT, __DATA, __LINKEDIT, etc) + // so those checks will always fail because they point to data much further in memory + // (as DSC groups all this kind of data together for X amount of images) + if (!from_memory + && (msli.szB < symcmd.stroff + symcmd.strsize + || msli.szB < symcmd.symoff + symcmd.nsyms * sizeof(struct NLIST))) { ML_(symerr)(di, False, "Invalid Mach-O file (5 too small)."); goto fail; - } - if (dysymcmd.ilocalsym + dysymcmd.nlocalsym > symcmd.nsyms - || dysymcmd.iextdefsym + dysymcmd.nextdefsym > symcmd.nsyms) { + } + if (has_dynamic + && (dysymcmd.ilocalsym + dysymcmd.nlocalsym > symcmd.nsyms + || dysymcmd.iextdefsym + dysymcmd.nextdefsym > symcmd.nsyms)) { ML_(symerr)(di, False, "Invalid Mach-O file (bad symbol table)."); goto fail; } - syms = ML_(cur_plus)(ML_(cur_from_sli)(msli), symcmd.symoff); - strs = ML_(cur_plus)(ML_(cur_from_sli)(msli), symcmd.stroff); - - if (VG_(clo_verbosity) > 1) + if (from_memory) { + // First, we calculate the real position of __LINKEDIT in the DSC by adding the slide + // Then we get the offset of syms/strings within __LINKEDIT by removing the fileoffset + // Then we add the __LINKEDIT address + // Finally we calculate the proper offset of those addresses compared to the mach_header slice + Addr link_edit_addr = link_edit.vmaddr + kernel_slide; + syms = ML_(cur_from_sli)(msli); + syms.ioff = (link_edit_addr + (symcmd.symoff - link_edit.fileoff)) - rx_map->avma; + strs = ML_(cur_from_sli)(msli); + strs.ioff = (link_edit_addr + (symcmd.stroff - link_edit.fileoff)) - rx_map->avma; + } else { + syms = ML_(cur_plus)(ML_(cur_from_sli)(msli), symcmd.symoff); + strs = ML_(cur_plus)(ML_(cur_from_sli)(msli), symcmd.stroff); + } + + if (VG_(clo_verbosity) > 1) { + if (has_dynamic) { VG_(message)(Vg_DebugMsg, - " reading syms from primary file (%d %d)\n", + " reading syms from primary file (%u %u)\n", dysymcmd.nextdefsym, dysymcmd.nlocalsym ); + } else { + VG_(message)(Vg_DebugMsg, + " reading syms from primary file (%u)\n", + symcmd.nsyms ); + } + } /* Read candidate symbols into 'candSyms', so we can truncate overlapping ends and generally tidy up, before presenting @@ -972,18 +1151,95 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) ML_(dinfo_free), sizeof(DiSym) ); - // extern symbols - read_symtab(candSyms, - di, - ML_(cur_plus)(syms, - dysymcmd.iextdefsym * sizeof(struct NLIST)), - dysymcmd.nextdefsym, strs, symcmd.strsize); - // static and private_extern symbols - read_symtab(candSyms, - di, - ML_(cur_plus)(syms, - dysymcmd.ilocalsym * sizeof(struct NLIST)), - dysymcmd.nlocalsym, strs, symcmd.strsize); + if (has_dynamic) { + // extern symbols + read_symtab(candSyms, + di, + ML_(cur_plus)(syms, + dysymcmd.iextdefsym * sizeof(struct NLIST)), + dysymcmd.nextdefsym, strs, symcmd.strsize); + // static and private_extern symbols + read_symtab(candSyms, + di, + ML_(cur_plus)(syms, + dysymcmd.ilocalsym * sizeof(struct NLIST)), + dysymcmd.nlocalsym, strs, symcmd.strsize); + +// Due to the usage of dyld_cache, I am unsure how to properly capture the stubs from there +// moreover we don't have a rw_map for those so loads of logic need to change above. +// This is only really useful when reading librairies from disk which is limited now. +// Finally, there is also a weird overflow of some kind on arm64 macOS 15. +// So I am disabling this for now. +#if 0 + { + DiCursor cmd_cur = ML_(cur_from_sli)(msli); + DiCursor indirs = DiCursor_INVALID; + + if (from_memory) { + Addr link_edit_addr = link_edit.vmaddr + kernel_slide; + indirs = ML_(cur_from_sli)(msli); + indirs.ioff = (link_edit_addr + (dysymcmd.indirectsymoff - link_edit.fileoff)) - rx_map->avma; + } else { + indirs = ML_(cur_plus)(ML_(cur_from_sli)(msli), dysymcmd.indirectsymoff); + } + + struct MACH_HEADER mh; + ML_(cur_step_get)(&mh, &cmd_cur, sizeof(mh)); + for (Int c = 0; c < mh.ncmds; c++) { + struct load_command cmd; + ML_(cur_read_get)(&cmd, cmd_cur, sizeof(cmd)); + + if (cmd.cmd == LC_SEGMENT_CMD) { + struct SEGMENT_COMMAND seg; + ML_(cur_read_get)(&seg, cmd_cur, sizeof(seg)); + + for (i = 0; i < seg.nsects; i += 1) { + DiCursor sect_cur = ML_(cur_plus)(cmd_cur, sizeof(seg)); + struct SECTION sect; + ML_(cur_read_get)(§, sect_cur, sizeof(sect)); + Int indexOfIndirects = sect.reserved1; + + if ((sect.flags & S_SYMBOL_STUBS) == S_SYMBOL_STUBS) { + Int sizeOfStub = sect.reserved2; + Int amountOfStubs = sect.size / sizeOfStub; + if (indexOfIndirects + amountOfStubs > dysymcmd.nindirectsyms) { + ML_(symerr)(di, False, "Invalid Mach-O file (invalid stub section)."); + goto fail; + } + // add symbols where we have stub assembly + add_indirect_symbols(candSyms, di, + §, sizeOfStub, + ML_(cur_plus)(indirs, indexOfIndirects * sizeof(UInt)), amountOfStubs, + syms, symcmd.nsyms, strs, symcmd.strsize); + } + if ((sect.flags & S_LAZY_SYMBOL_POINTERS) == S_LAZY_SYMBOL_POINTERS) { + Int sizeOfPointer = VG_WORDSIZE; + Int amountOfPointers = sect.size / sizeOfPointer; + if (indexOfIndirects + amountOfPointers > dysymcmd.nindirectsyms) { + ML_(symerr)(di, False, "Invalid Mach-O file (invalid lazy symbol section)."); + goto fail; + } + // add symbols where we have lazy symbol pointers + add_indirect_symbols(candSyms, di, + §, sizeOfPointer, + ML_(cur_plus)(indirs, indexOfIndirects * sizeof(UInt)), amountOfPointers, + syms, symcmd.nsyms, strs, symcmd.strsize); + } + + sect_cur = ML_(cur_plus)(sect_cur, sizeof(sect)); + } + } + + cmd_cur = ML_(cur_plus)(cmd_cur, cmd.cmdsize); + } + } +#endif + } else { + read_symtab(candSyms, + di, + syms, + symcmd.nsyms, strs, symcmd.strsize); + } /* tidy up the cand syms -- trim overlapping ends. May resize candSyms. */ @@ -1027,7 +1283,7 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) if (VG_(clo_verbosity) > 1) VG_(message)(Vg_DebugMsg, " dSYM= %s\n", dsymfilename); - dsli = map_image_aboard( di, dsymfilename ); + dsli = map_image_aboard( di, dsymfilename, NULL ); if (!ML_(sli_is_valid)(dsli)) { ML_(symerr)(di, False, "Connect to debuginfo image failed " "(first attempt)."); @@ -1065,7 +1321,7 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) VG_(message)(Vg_DebugMsg, "%sdSYM directory %s; consider using " "--dsymutil=yes\n", VG_(clo_verbosity) > 1 ? " " : "", - dsymfilename ? "has wrong UUID" : "is missing"); + dsymfilename ? "has wrong UUID" : "is missing"); goto success; } @@ -1073,7 +1329,7 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) { Int r; const HChar* dsymutil = "/usr/bin/dsymutil "; - HChar* cmd = ML_(dinfo_zalloc)( "di.readmacho.tmp1", + HChar* cmd = ML_(dinfo_zalloc)( "di.readmacho.tmp1", VG_(strlen)(dsymutil) + VG_(strlen)(di->fsm.filename) + 32 /* misc */ ); @@ -1097,7 +1353,7 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) if (VG_(clo_verbosity) > 1) VG_(message)(Vg_DebugMsg, " dsyms= %s\n", dsymfilename); - dsli = map_image_aboard( di, dsymfilename ); + dsli = map_image_aboard( di, dsymfilename, NULL ); if (!ML_(sli_is_valid)(dsli)) { ML_(symerr)(di, False, "Connect to debuginfo image failed " "(second attempt)."); @@ -1173,13 +1429,13 @@ Bool ML_(read_macho_debug_info)( struct _DebugInfo* di ) eh_frame_svma + di->text_bias, True/*is_ehframe*/); } - + if (ML_(sli_is_valid)(debug_info_mscn)) { if (VG_(clo_verbosity) > 1) { if (0) VG_(message)(Vg_DebugMsg, "Reading dwarf3 for %s (%#lx) from %s" - " (%lld %lld %lld %lld %lld %lld)\n", + " (%llu %llu %llu %llu %llu %llu)\n", di->fsm.filename, di->text_avma, dsymfilename, debug_info_mscn.szB, debug_abbv_mscn.szB, debug_line_mscn.szB, debug_str_mscn.szB, diff --git a/coregrind/pub_core_mach.h b/coregrind/pub_core_mach.h index 694bbee376..cbce0309ad 100644 --- a/coregrind/pub_core_mach.h +++ b/coregrind/pub_core_mach.h @@ -34,7 +34,7 @@ #define DARWIN_FAKE_MEMORY_PATH "/dev/macos/internals/" //-------------------------------------------------------------------- -// PURPOSE: This module contains the Mach kernel interface, +// PURPOSE: This module contains the Mach kernel interface, // for operating systems like Darwin / Mac OS X that use it. //-------------------------------------------------------------------- @@ -44,6 +44,40 @@ extern void VG_(mach_init)(void); // Record system memory after aspace has been init'd extern void VG_(mach_record_system_memory)(void); +// MACH_DSC_END represent a guess to where the dyld shared cache ends +// there is no way to know for sure and even if we could, +// it would be a pain to carry that value around all of V +// so we just use a guess and hope for the best. +// Why is this value needed? +// We only use it in a single context: when reading the dyld shared cache directly from memory +// we use it as a bound when reading symbols with DebugInfo. +// How is this value calculated? +// - amd64: end of user addressable space, which makes sense as the DSC is mapped at the end of the address space +// - x86: end of user addressable space, note that there should not be any x86 valgrind with DSC support so this is just a placeholder +// - arm64: +// - the DSC is mapped at 0x180000000 + some ASLR slider +// - the size depends on the macOS version but is usually less than 0xFFFFFFFF +// - thus it should be around 0x280000000 but I have seen it reach above +// - thus we use 0x300000000 which is also where we tell V that client memory starts +#if defined(VGP_amd64_darwin) +#define MACH_DSC_END 0x7ffffffff000 +#elif defined(VGP_x86_darwin) +#define MACH_DSC_END 0xfffff000 +#elif defined(VGP_arm64_darwin) +#define MACH_DSC_END 0x300000000 +#else +#error "Unsupported platform" +#endif + +#if DARWIN_VERS >= DARWIN_11_00 +// Dyld shared cache (DSC) parsing, which is required as system libraries are not provided on disk +// starting with macOS 11.0 (Big Sur) +extern void VG_(dyld_cache_init)(const HChar*); +extern int VG_(dyld_cache_might_be_in)(const HChar*); +extern int VG_(dyld_cache_load_library)(const HChar*); +extern Addr VG_(dyld_cache_get_slide)(void); +#endif + #endif // __PUB_CORE_MACH_H #endif // defined(VGO_darwin) |
|
From: Paul F. <pa...@so...> - 2025-12-01 07:19:44
|
https://sourceware.org/cgit/valgrind/commit/?id=b599858486bb7db6d2ff3e6ddc4e7f71791d393d commit b599858486bb7db6d2ff3e6ddc4e7f71791d393d Author: Paul Floyd <pj...@wa...> Date: Mon Dec 1 08:18:56 2025 +0100 Linux Helgrind: add a suppression for _dl_allocate_tls_init Seen on Fedora 43 amd64 Diff: --- glibc-2.X-helgrind.supp.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/glibc-2.X-helgrind.supp.in b/glibc-2.X-helgrind.supp.in index 9b1ef9ae48..61d4e1d724 100644 --- a/glibc-2.X-helgrind.supp.in +++ b/glibc-2.X-helgrind.supp.in @@ -356,3 +356,9 @@ obj:/usr/lib/*/libnss_mdns4*.so.* } +{ + helgrind---_dl_allocate_tls_init + Helgrind:Race + fun:mempcpy + fun:_dl_allocate_tls_init +} |
|
From: Paul F. <pa...@so...> - 2025-12-01 07:13:25
|
https://sourceware.org/cgit/valgrind/commit/?id=cfc8b0706a9a0fbf05525a0ce142e2bf4cc53fed commit cfc8b0706a9a0fbf05525a0ce142e2bf4cc53fed Author: Paul Floyd <pj...@wa...> Date: Mon Dec 1 08:12:30 2025 +0100 Linux DRD suppression: add an entry for __is_decorate_maps_enabled Seen on Fedora 43 Diff: --- drd/tests/std_thread2.supp | 7 +++++++ glibc-2.X-drd.supp.in | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/drd/tests/std_thread2.supp b/drd/tests/std_thread2.supp index 40741b06f8..39a201da9a 100644 --- a/drd/tests/std_thread2.supp +++ b/drd/tests/std_thread2.supp @@ -98,3 +98,10 @@ drd:ConflictingAccess fun:__set_vma_name } + +{ + drd-libc-__is_decorate_maps_enabled + drd:ConflictingAccess + fun:__is_decorate_maps_enabled +} + diff --git a/glibc-2.X-drd.supp.in b/glibc-2.X-drd.supp.in index 419ff2256c..6866904470 100644 --- a/glibc-2.X-drd.supp.in +++ b/glibc-2.X-drd.supp.in @@ -369,3 +369,9 @@ fun:_dl_exception_create_format } +{ + drd-libc-__is_decorate_maps_enabled + drd:ConflictingAccess + fun:__is_decorate_maps_enabled +} + |
|
From: Florian K. <fk...@so...> - 2025-11-30 21:53:33
|
https://sourceware.org/cgit/valgrind/commit/?id=e6a4ea43e1c3d96ec41fd4bea4a5d8bec8535f4a commit e6a4ea43e1c3d96ec41fd4bea4a5d8bec8535f4a Author: Florian Krohm <fl...@ei...> Date: Sun Nov 30 21:52:32 2025 +0000 NEWS / README.s390 update BZ 509562 closed Diff: --- NEWS | 2 ++ README.s390 | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 2cedad448a..6068d611d4 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux. * ================== PLATFORM CHANGES ================= +s390x: Machine models older than z196 are no longer supported. * ==================== TOOL CHANGES =================== @@ -28,6 +29,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 228343 none/tests/darwin/bug228343 fails on OS X 413369 unhandled amd64-darwin syscall: unix:151 (getpgid) 487055 memcheck/tests/x86-linux/scalar fails running in Docker +509562 s390x: Define minimum required machine model 510416 Missing syswraps for file_getattr and file_setattr 510864 Add SSE4.1 PMAXSD and PMINSD instructions support for 32-bit x86 511329 Darwin and FreeBSD: Move setting of carry flag out of diff --git a/README.s390 b/README.s390 index d0661731c6..980285ab7f 100644 --- a/README.s390 +++ b/README.s390 @@ -1,7 +1,8 @@ Requirements ------------ -- You need GCC 3.4 or later to compile the s390 port. +- You need a GCC-compatible compiler with C11 support to compile + the s390 port. - Valgrind requires a machine not older than z196 to run. |
|
From: Paul F. <pa...@so...> - 2025-11-30 17:22:52
|
https://sourceware.org/cgit/valgrind/commit/?id=e06e758b33111f012301dc54f6577c0c81dc12a9 commit e06e758b33111f012301dc54f6577c0c81dc12a9 Author: Paul Floyd <pj...@wa...> Date: Sun Nov 30 18:21:56 2025 +0100 Darwin: update x86 syswrap code Code from Louis Brunner. Diff: --- coregrind/m_syswrap/syswrap-x86-darwin.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-x86-darwin.c b/coregrind/m_syswrap/syswrap-x86-darwin.c index 97c044f77e..a0bc1a1e7a 100644 --- a/coregrind/m_syswrap/syswrap-x86-darwin.c +++ b/coregrind/m_syswrap/syswrap-x86-darwin.c @@ -195,7 +195,7 @@ ThreadState *build_thread(const thread_state_t state, // Edit the thread state to send to the real kernel. // The real thread will run start_thread_NORETURN(tst) // on a separate non-client stack. -void hijack_thread_state(thread_state_t mach_generic, +void hijack_thread_state(thread_state_t mach_generic, thread_state_flavor_t flavor, mach_msg_type_number_t count, ThreadState *tst) @@ -271,7 +271,7 @@ asm( -void pthread_hijack(Addr self, Addr kport, Addr func, Addr func_arg, +void pthread_hijack(Addr self, Addr kport, Addr func, Addr func_arg, Addr stacksize, Addr flags, Addr sp) { vki_sigset_t blockall; @@ -358,6 +358,7 @@ asm( " push $0\n" // alignment " push $0\n" // alignment " push %ebp\n" // original sp +" push %esi\n" // kevent_count " push %edi\n" // reuse " push %edx\n" // workitem " push %ecx\n" // stackaddr @@ -375,7 +376,7 @@ asm( To handle this in valgrind, we create and destroy a valgrind thread for every work item. */ -void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, +void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, UInt reuse, Int kevent_count, Addr sp) { ThreadState *tst; @@ -396,8 +397,8 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, if (0) VG_(printf)( "wqthread_hijack: self %#lx, kport %#lx, " - "stackaddr %#lx, workitem %#lx, reuse/flags %x, sp %#lx\n", - self, kport, stackaddr, workitem, reuse, sp); + "stackaddr %#lx, workitem %#lx, reuse/flags %x, kevent_count %d, sp %#lx\n", + self, kport, stackaddr, workitem, reuse, kevent_count, sp); /* Start the thread with all signals blocked. VG_(scheduler) will set the mask correctly when we finally get there. */ @@ -429,7 +430,8 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, || DARWIN_VERS == DARWIN_10_10 \ || DARWIN_VERS == DARWIN_10_11 \ || DARWIN_VERS == DARWIN_10_12 \ - || DARWIN_VERS == DARWIN_10_13 + || DARWIN_VERS == DARWIN_10_13 \ + || DARWIN_VERS == DARWIN_10_14 UWord magic_delta = 0xB0; # else # error "magic_delta: to be computed on new OS version" @@ -452,6 +454,10 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, tid, tst, tst->os_state.pthread, self); vex = &tst->arch.vex; + if (tst->os_state.pthread - magic_delta != self) { + VG_(printf)("wqthread_hijack reuse: tst->os_state.pthread %#lx vs self %#lx (diff: %#lx vs %#lx)\n", + tst->os_state.pthread, self, tst->os_state.pthread - self, magic_delta); + } vg_assert(tst->os_state.pthread - magic_delta == self); } else { @@ -471,7 +477,7 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, vex->guest_ECX = stackaddr; vex->guest_EDX = workitem; vex->guest_EDI = reuse; - vex->guest_ESI = 0; + vex->guest_ESI = kevent_count; vex->guest_ESP = sp; stacksize = 512*1024; // wq stacks are always DEFAULT_STACK_SIZE |
|
From: Paul F. <pa...@so...> - 2025-11-30 16:28:53
|
https://sourceware.org/cgit/valgrind/commit/?id=175d836a83d297c637b7d6966e94c6bdaec7c35b commit 175d836a83d297c637b7d6966e94c6bdaec7c35b Author: Paul Floyd <pj...@wa...> Date: Sun Nov 30 17:27:17 2025 +0100 Darwin: update syscalls Code merged from Louis Brunner, mainly up to OSX 10.13 Diff: --- coregrind/m_syswrap/priv_syswrap-darwin.h | 13 +- coregrind/m_syswrap/syswrap-darwin.c | 302 ++++++++++++++++++++++++++++-- include/vki/vki-darwin.h | 5 + include/vki/vki-scnums-darwin.h | 2 + 4 files changed, 295 insertions(+), 27 deletions(-) diff --git a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h index 37d330d939..1e770d43a0 100644 --- a/coregrind/m_syswrap/priv_syswrap-darwin.h +++ b/coregrind/m_syswrap/priv_syswrap-darwin.h @@ -39,14 +39,6 @@ void start_thread_NORETURN ( Word arg ); void assign_port_name(mach_port_t port, const char *name); void record_named_port(ThreadId tid, mach_port_t port, mach_port_right_t right, const char *name); -extern const SyscallTableEntry ML_(mach_trap_table)[]; -extern const SyscallTableEntry ML_(syscall_table)[]; -extern const SyscallTableEntry ML_(mdep_trap_table)[]; - -extern const UInt ML_(syscall_table_size); -extern const UInt ML_(mach_trap_table_size); -extern const UInt ML_(mdep_trap_table_size); - void VG_(show_open_ports)(void); Bool ML_(sync_mappings)(const HChar *when, const HChar *where, UWord num); @@ -240,7 +232,7 @@ DECL_TEMPLATE(darwin, csops_audittoken); // 170 // NYI kdebug_typefilter // 177 #endif /* DARWIN_VERS >= DARWIN_10_12 */ #if DARWIN_VERS >= DARWIN_10_11 -// NYI kdebug_trace_string // 178 +DECL_TEMPLATE(darwin, kdebug_trace_string); // 178 #endif /* DARWIN_VERS >= DARWIN_10_11 */ // 179 DECL_TEMPLATE(darwin, kdebug_trace); // 180 @@ -589,7 +581,7 @@ DECL_TEMPLATE(darwin, faccessat); // 466 // NYI fstatat // 469 DECL_TEMPLATE(darwin, fstatat64); // 470 // NYI linkat // 471 -// NYI unlinkat // 472 +DECL_TEMPLATE(darwin, unlinkat); // 472 DECL_TEMPLATE(darwin, readlinkat); // 473 // NYI symlinkat // 474 DECL_TEMPLATE(darwin, mkdirat); // 475 @@ -768,6 +760,7 @@ DECL_TEMPLATE(darwin, semaphore_wait_signal); DECL_TEMPLATE(darwin, semaphore_timedwait); DECL_TEMPLATE(darwin, semaphore_timedwait_signal); DECL_TEMPLATE(darwin, task_for_pid); +DECL_TEMPLATE(darwin, task_name_for_pid); DECL_TEMPLATE(darwin, pid_for_task); #if DARWIN_VERS >= DARWIN_10_13 diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index 606fbccff1..28ae9b4d51 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -66,6 +66,7 @@ #include <mach/mach.h> #include <mach/mach_vm.h> #include <semaphore.h> +#include <sys/kdebug.h> /* --- !!! --- EXTERNAL HEADERS end --- !!! --- */ #define msgh_request_port msgh_remote_port @@ -271,7 +272,6 @@ static void run_a_thread_NORETURN ( Word tidW ) tst->status = VgTs_Empty; // GrP fixme race here! new thread may claim this V thread stack // before we get out here! - // GrP fixme use bsdthread_terminate for safe cleanup? mach_msg(&msg, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, sizeof(msg), 0, 0, MACH_MSG_TIMEOUT_NONE, 0); @@ -715,6 +715,189 @@ void VG_(show_open_ports)(void) } +/* --------------------------------------------------------------------- + kdebug helpers + ------------------------------------------------------------------ */ + +// Adapted from https://newosxbook.com/tools/kdv.html +static const HChar *kdebug_std_codes[] = +{ + NULL, + "MACH", // #define DBG_MACH 1 + "NETWORK", // #define DBG_NETWORK 2 + "FSYSTEM", // #define DBG_FSYSTEM 3 + "BSD", // #define DBG_BSD 4 + "IOKIT", // #define DBG_IOKIT 5 + "DRIVERS", // #define DBG_DRIVERS 6 + "TRACE", // #define DBG_TRACE 7 + "DLIL", // #define DBG_DLIL 8 + "PTHREAD", // #define DBG_PTHREAD 9 + "CORESTORAGE", // #define DBG_CORESTORAGE 10 + "COREGRAPHICS", // #define DBG_CG 11 + "MONOTONICS", // #define DBG_MONOTONIC 12 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "MISC", // #define DBG_MISC 20 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "SECURITY", // As of 10.10 + "DYLD", // #define DBG_DYLD 31 + "QT", // #define DBG_QT 32 + "APPS", // #define DBG_APPS 33 + "LAUNCHD", // #define DBG_LAUNCHD 34 + "SILICON", // #define DBG_SILICON 35 + "HANGTRACER", // iOS 9: undocumented + "PERF" , // #define DBG_PERF 37 + // added in 10.9 + "IMPORTANCE", // #define DBG_IMPORTANCE 38 + NULL, // Apparently present in iOS? + // Added in 10.10 + "BANK", // #define DBG_BANK 40 + "XPC", //#define DBG_XPC 41 + "ATM" , // #define DBG_ATM 42 + "ARIADNE", // #define DBG_ARIADNE 43 + // Added in 10.11 + "DAEMON", // #define DBG_DAEMON 44 + "ENERGYTRACE", // #define DBG_ENERGYTRACE 45 + "DISPATCH", // #define DBG_DISPATCH 46 + NULL, NULL, + "IMG", // #define DBG_IMG 49 + NULL, + "UMALLOC", // #define DBG_UMALLOC 51 + NULL, + "TURNSTILE", // #define DBG_TURNSTILE 53 + "AUDIO", // #define DBG_AUDIO 54 + NULL, NULL, NULL, NULL, NULL, // 55-59 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 60-69 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 70-79 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 80-89 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 90-99 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 100-109 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 110-119 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 120-129 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 130-139 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 140-149 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 150-159 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 160-169 + "WINDOWSERVER", // apparently deprecated in 10.11 and merged with 49 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 171-179 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 180-189 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 190-199 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 200-209 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 210-219 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 220-229 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 230-238 + "IOS_APPS", // iOS: Used by tons of Apps, undocumented + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, // 240-249 + NULL, NULL, NULL, NULL, NULL, // 250-254 + "MIG", // #define DBG_MIG 255 +}; + +struct KDebugTraceCode { + ULong code; + const HChar name[64]; +}; + +static const HChar *kdebug_debugid(ULong did) +{ + static Bool kdebug_trace_codes_initd = False; + static UInt kdebug_trace_codes_count = 0; + static struct KDebugTraceCode* kdebug_trace_codes = NULL; + + static HChar buf[64]; + + Int class = KDBG_EXTRACT_CLASS(did); + ULong event_id = did & KDBG_EVENTID_MASK; + HChar dir = '\0'; + const HChar* found_class = NULL; + + if (!kdebug_trace_codes_initd) { + HChar rbuf[1024]; + Int leftover = 0; + + kdebug_trace_codes_initd = True; + SysRes fd = VG_(open)("/usr/share/misc/trace.codes", O_RDONLY, 0); + if (sr_isError(fd)) { + VG_(close)(sr_Res(fd)); + } else { + kdebug_trace_codes_count = 0; + while (1) { + Int count = VG_(read)(sr_Res(fd), rbuf, sizeof(rbuf)); + if (count <= 0) { + break; + } + for (HChar* p = rbuf; p < rbuf + count; p += 1) { + if (*p == '\n') { + kdebug_trace_codes_count += 1; + } + } + } + kdebug_trace_codes = VG_(malloc)("kdebug_trace_codes", + kdebug_trace_codes_count * + sizeof(struct KDebugTraceCode)); + VG_(lseek)(sr_Res(fd), 0, VKI_SEEK_SET); + kdebug_trace_codes_count = 0; + while (1) { + Int count = VG_(read)(sr_Res(fd), rbuf+leftover, sizeof(rbuf)-leftover); + if (count <= 0) { + break; + } + count += leftover; + Int start = 0; + for (HChar* p = rbuf; p < rbuf + count; p += 1) { + if (*p != '\n') { + continue; + } + + HChar* end = NULL; + *p = '\0'; + kdebug_trace_codes[kdebug_trace_codes_count].code = VG_(strtoll16)(rbuf+start, &end); + while (*end == ' ' || *end == '\t') { + end += 1; + } + // FIXME: gross cast! + VG_(strlcpy)((HChar*)(Addr)kdebug_trace_codes[kdebug_trace_codes_count].name, end, sizeof(kdebug_trace_codes[kdebug_trace_codes_count].name)); + kdebug_trace_codes_count += 1; + start = p - rbuf + 1; + } + if (start < count) { + leftover = count - start; + VG_(memmove)(rbuf, rbuf+start, leftover); + } + } + VG_(close)(sr_Res(fd)); + } + } + + for (Int i = 0; i < kdebug_trace_codes_count; i += 1) { + const struct KDebugTraceCode* entry = &kdebug_trace_codes[i]; + if (entry->code == event_id) { + found_class = entry->name; + break; + } + } + if (found_class == NULL) { + found_class = kdebug_std_codes[class]; + } + if (found_class == NULL) { + found_class = "UNKNOWN"; + } + + if (did & DBG_FUNC_START) { + dir = '>'; + } + if (did & DBG_FUNC_END) { + dir = '<'; + } + + if (dir) { + VG_(sprintf)(buf, "%c%s", dir, found_class); + } else { + VG_(sprintf)(buf, "%s", found_class); + } + + return buf; +} + + /* --------------------------------------------------------------------- sync_mappings ------------------------------------------------------------------ */ @@ -2055,7 +2238,7 @@ PRE(disconnectx) PRE(kevent) { PRINT("kevent( %ld, %#lx, %ld, %#lx, %ld, %#lx )", - SARG1, ARG2, ARG3, ARG4, ARG5, ARG6); + SARG1, ARG2, SARG3, ARG4, SARG5, ARG6); PRE_REG_READ6(int,"kevent", int,kq, const struct vki_kevent *,changelist, int,nchanges, struct vki_kevent *,eventlist, int,nevents, @@ -2073,7 +2256,7 @@ PRE(kevent) POST(kevent) { - PRINT("kevent ret %ld dst %#lx (%zu)", RES, ARG4, sizeof(struct vki_kevent)); + PRINT("kevent ret %ld dst %#lx (%zu)", (Word)RES, ARG4, sizeof(struct vki_kevent)); if (RES > 0) POST_MEM_WRITE(ARG4, RES * sizeof(struct vki_kevent)); } @@ -2169,6 +2352,7 @@ static const HChar *workqop_name(int op) case VKI_WQOPS_SET_EVENT_MANAGER_PRIORITY: return "SET_EVENT_MANAGER_PRIORITY"; case VKI_WQOPS_THREAD_WORKLOOP_RETURN: return "THREAD_WORKLOOP_RETURN"; case VKI_WQOPS_SHOULD_NARROW: return "SHOULD_NARROW"; + case VKI_WQOPS_SETUP_DISPATCH: return "SETUP_DISPATCH"; default: return "?"; } } @@ -2226,11 +2410,33 @@ PRE(workq_ops) // RK fixme need anything here? // RK fixme may block? break; + case VKI_WQOPS_SETUP_DISPATCH: { + // docs says: setup pthread workqueue-related operations +#if DARWIN_VERS >= DARWIN_10_15 +#pragma pack(4) + struct workq_dispatch_config { + uint32_t wdc_version; + uint32_t wdc_flags; + uint64_t wdc_queue_serialno_offs; + uint64_t wdc_queue_label_offs; + }; +#pragma pack() + PRE_MEM_READ("workq_ops(item)", ARG2, MIN(sizeof(struct workq_dispatch_config), SARG3)); + struct workq_dispatch_config* cfg = (struct workq_dispatch_config*)ARG2; + if (cfg->wdc_flags & ~VKI_WORKQ_DISPATCH_SUPPORTED_FLAGS || + cfg->wdc_version < VKI_WORKQ_DISPATCH_MIN_SUPPORTED_VERSION) { + SET_STATUS_Failure( VKI_ENOTSUP ); + } +#endif + break; + } default: - VG_(printf)("UNKNOWN workq_ops option %ld\n", ARG1); + PRINT("workq_ops ( %lu [??], ... )", ARG1); + log_decaying("UNKNOWN workq_ops option %lu!", ARG1); break; } } + POST(workq_ops) { ThreadState *tst = VG_(get_ThreadState)(tid); @@ -2809,10 +3015,11 @@ PRE(fstat_extended) PRE_REG_READ4(int, "fstat_extended", int, fd, struct stat *, buf, void *, fsacl, vki_size_t *, fsacl_size); PRE_MEM_WRITE( "fstat_extended(buf)", ARG2, sizeof(struct vki_stat) ); - if (ARG4 && ML_(safe_to_deref)( (void*)ARG4, sizeof(vki_size_t) )) + if (ML_(safe_to_deref)( (void*)ARG4, sizeof(vki_size_t) )) PRE_MEM_WRITE("fstat_extended(fsacl)", ARG3, *(vki_size_t *)ARG4 ); PRE_MEM_READ( "fstat_extended(fsacl_size)", ARG4, sizeof(vki_size_t) ); } + POST(fstat_extended) { POST_MEM_WRITE( ARG2, sizeof(struct vki_stat) ); @@ -2830,10 +3037,11 @@ PRE(stat64_extended) void *, fsacl, vki_size_t *, fsacl_size); PRE_MEM_RASCIIZ( "stat64_extended(file_name)", ARG1 ); PRE_MEM_WRITE( "stat64_extended(buf)", ARG2, sizeof(struct vki_stat64) ); - if (ARG4 && ML_(safe_to_deref)( (void*)ARG4, sizeof(vki_size_t) )) + if (ML_(safe_to_deref)( (void*)ARG4, sizeof(vki_size_t) )) PRE_MEM_WRITE("stat64_extended(fsacl)", ARG3, *(vki_size_t *)ARG4 ); PRE_MEM_READ( "stat64_extended(fsacl_size)", ARG4, sizeof(vki_size_t) ); } + POST(stat64_extended) { POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); @@ -2842,7 +3050,6 @@ POST(stat64_extended) POST_MEM_WRITE( ARG4, sizeof(vki_size_t) ); } - PRE(lstat64_extended) { PRINT("lstat64_extended( %#lx(%s), %#lx, %#lx, %#lx )", @@ -2851,10 +3058,11 @@ PRE(lstat64_extended) void *, fsacl, vki_size_t *, fsacl_size); PRE_MEM_RASCIIZ( "lstat64_extended(file_name)", ARG1 ); PRE_MEM_WRITE( "lstat64_extended(buf)", ARG2, sizeof(struct vki_stat64) ); - if (ARG4 && ML_(safe_to_deref)( (void*)ARG4, sizeof(vki_size_t) )) + if ( ML_(safe_to_deref)( (void*)ARG4, sizeof(vki_size_t) )) PRE_MEM_WRITE( "lstat64_extended(fsacl)", ARG3, *(vki_size_t *)ARG4 ); PRE_MEM_READ( "lstat64_extended(fsacl_size)", ARG4, sizeof(vki_size_t) ); } + POST(lstat64_extended) { POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); @@ -2871,10 +3079,11 @@ PRE(fstat64_extended) PRE_REG_READ4(int, "fstat64_extended", int, fd, struct stat64 *, buf, void *, fsacl, vki_size_t *, fsacl_size); PRE_MEM_WRITE( "fstat64_extended(buf)", ARG2, sizeof(struct vki_stat64) ); - if (ARG4 && ML_(safe_to_deref)( (void*)ARG4, sizeof(vki_size_t) )) + if (ML_(safe_to_deref)( (void*)ARG4, sizeof(vki_size_t) )) PRE_MEM_WRITE("fstat64_extended(fsacl)", ARG3, *(vki_size_t *)ARG4 ); PRE_MEM_READ( "fstat64_extended(fsacl_size)", ARG4, sizeof(vki_size_t) ); } + POST(fstat64_extended) { POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) ); @@ -5131,6 +5340,7 @@ POST(host_get_clock_service) Reply *reply = (Reply *)ARG1; + record_named_port(tid, reply->clock_serv.name, -1, "clock-%p"); assign_port_name(reply->clock_serv.name, "clock-%p"); PRINT("%s", name_for_port(reply->clock_serv.name)); } @@ -6053,6 +6263,7 @@ POST(task_get_special_port) switch (MACH_ARG(task_get_special_port.which_port)) { case TASK_BOOTSTRAP_PORT: vg_bootstrap_port = reply->special_port.name; + record_named_port(tid, reply->special_port.name, -1, "bootstrap"); assign_port_name(reply->special_port.name, "bootstrap"); break; case TASK_KERNEL_PORT: @@ -6155,6 +6366,7 @@ POST(semaphore_create) Reply *reply = (Reply *)ARG1; + record_named_port(tid, reply->semaphore.name, -1, "semaphore-%p"); assign_port_name(reply->semaphore.name, "semaphore-%p"); PRINT("%s", name_for_port(reply->semaphore.name)); } @@ -8921,6 +9133,25 @@ PRE(__semwait_signal) // *flags |= SfMayBlock; //} +PRE(task_name_for_pid) +{ + PRINT("task_name_for_pid(%s, %ld, %#lx)", name_for_port(ARG1), SARG2, ARG3); + PRE_REG_READ3(long, "task_name_for_pid", + mach_port_t,"target", + vki_pid_t, "pid", mach_port_t *,"task"); + PRE_MEM_WRITE("task_name_for_pid(task)", ARG3, sizeof(mach_port_t)); +} + +POST(task_name_for_pid) +{ + mach_port_t task; + + POST_MEM_WRITE(ARG3, sizeof(mach_port_t)); + + task = *(mach_port_t *)ARG3; + record_named_port(tid, task, MACH_PORT_RIGHT_SEND, "task-name-%p"); + PRINT("task-name %#x", task); +} PRE(task_for_pid) { @@ -9472,6 +9703,17 @@ static void munge_wll(UWord* a1, ULong* a2, ULong* a3, # endif } +static void munge_wlww(UWord* a1, ULong* a2, UWord* a3, UWord* a4, + UWord aRG1, UWord aRG2, UWord aRG3, + UWord aRG4, UWord aRG5) +{ +# if defined(VGA_x86) + *a1 = aRG1; *a2 = LOHI64(aRG2,aRG3); *a3 = aRG4; *a4 = aRG5; +# else + *a1 = aRG1; *a2 = aRG2; *a3 = aRG3; *a4 = aRG4; +# endif +} + static void munge_wwlw(UWord* a1, UWord* a2, ULong* a3, UWord* a4, UWord aRG1, UWord aRG2, UWord aRG3, UWord aRG4, UWord aRG5) @@ -9757,9 +9999,12 @@ PRE(kernelrpc_mach_port_construct_trap) { UWord a1; UWord a2; ULong a3; UWord a4; munge_wwlw(&a1, &a2, &a3, &a4, ARG1, ARG2, ARG3, ARG4, ARG5); + mach_port_options_t* options = (mach_port_options_t*) a2; PRINT("kernelrpc_mach_port_construct_trap" - "(target: %s, options: %#lx, content: %llx, name: %p)", - name_for_port(a1), a2, a3, *(mach_port_name_t**)a4); + "(target: %s, options: %#lx {flags: %#x, mpl_ql: %#x}, context: %llx, name: %p)", + name_for_port(a1), a2, options->flags, options->mpl.mpl_qlimit, a3, *(mach_port_name_t**)a4); + PRE_MEM_READ("kernelrpc_mach_port_construct_trap(options)", a2, + sizeof(mach_port_options_t)); PRE_MEM_WRITE("kernelrpc_mach_port_construct_trap(name)", a4, sizeof(mach_port_name_t*)); } @@ -9925,6 +10170,15 @@ POST(fstatat64) POST_MEM_WRITE( ARG3, sizeof(struct vki_stat64) ); } +PRE(unlinkat) +{ + PRINT("unlinkat ( %ld, %#lx(%s), %#lx )", + SARG1, ARG2, (HChar*)ARG2, ARG3); + PRE_REG_READ3(long, "unlinkat", + int, fd, const char *, path, int, flag); + PRE_MEM_RASCIIZ( "unlinkat(path)", ARG2 ); +} + PRE(readlinkat) { PRINT("readlinkat ( %ld, %#lx(%s), %#lx, %ld )", @@ -10080,6 +10334,15 @@ PRE(mkdirat) #if DARWIN_VERS >= DARWIN_10_11 +PRE(kdebug_trace_string) +{ + PRINT("kdebug_trace_string(%#lx (%s), %#lx, %s)", ARG1, kdebug_debugid(ARG1), ARG2, (HChar*)(Addr)ARG3); + if (ARG3 != 0) { + PRE_MEM_RASCIIZ("kdebug_trace_string(string)", ARG3); + } + SET_STATUS_Success(0); +} + PRE(kevent_qos) { PRINT("kevent_qos( %ld, %#lx, %ld, %#lx, %ld, %#lx, %ld, %ld )", @@ -10798,6 +11061,11 @@ const SyscallTableEntry ML_(syscall_table)[] = { _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(175)), // old gc_control // _____(__NR_add_profil), _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(177)), // ??? +#if DARWIN_VERS >= DARWIN_10_11 + MACX_(__NR_kdebug_trace_string, kdebug_trace_string), // 178 +#else + _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(178)), // ??? +#endif _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(178)), // ??? _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(179)), // ??? MACX_(__NR_kdebug_trace, kdebug_trace), // 180 @@ -11143,7 +11411,9 @@ const SyscallTableEntry ML_(syscall_table)[] = { #endif MACX_(__NR_faccessat, faccessat), // 466 MACXY(__NR_fstatat64, fstatat64), // 470 + MACX_(__NR_unlinkat, unlinkat), // 472 MACXY(__NR_readlinkat, readlinkat), // 473 + MACX_(__NR_mkdirat, mkdirat), // 475 MACX_(__NR_bsdthread_ctl, bsdthread_ctl), // 478 MACXY(__NR_csrctl, csrctl), // 483 MACX_(__NR_guarded_open_dprotected_np, guarded_open_dprotected_np), // 484 @@ -11228,7 +11498,7 @@ const SyscallTableEntry ML_(mach_trap_table)[] = { _____(VG_DARWIN_SYSCALL_CONSTRUCT_MACH(9)), # if DARWIN_VERS >= DARWIN_10_8 - MACXY(__NR_kernelrpc_mach_vm_allocate_trap, kernelrpc_mach_vm_allocate_trap), + MACXY(VG_DARWIN_SYSCALL_CONSTRUCT_MACH(10), kernelrpc_mach_vm_allocate_trap), # else _____(VG_DARWIN_SYSCALL_CONSTRUCT_MACH(10)), # endif @@ -11318,7 +11588,7 @@ const SyscallTableEntry ML_(mach_trap_table)[] = { _____(VG_DARWIN_SYSCALL_CONSTRUCT_MACH(43)), # endif -// _____(__NR_task_name_for_pid), + MACXY(__NR_task_name_for_pid, task_name_for_pid), MACXY(__NR_task_for_pid, task_for_pid), MACXY(__NR_pid_for_task, pid_for_task), _____(VG_DARWIN_SYSCALL_CONSTRUCT_MACH(47)), @@ -11401,17 +11671,15 @@ const SyscallTableEntry ML_(mach_trap_table)[] = { // calling convention instead of the syscall convention. // Use ML_(mdep_trap_table)[syscallno - ML_(mdep_trap_base)] . -#if defined(VGA_x86) const SyscallTableEntry ML_(mdep_trap_table)[] = { +#if defined(VGA_x86) MACX_(__NR_thread_fast_set_cthread_self, thread_fast_set_cthread_self), -}; #elif defined(VGA_amd64) -const SyscallTableEntry ML_(mdep_trap_table)[] = { MACX_(__NR_thread_fast_set_cthread_self, thread_fast_set_cthread_self), -}; #else #error unknown architecture #endif +}; const SyscallTableEntry* ML_(get_darwin_syscall_entry) ( UInt sysno ) { diff --git a/include/vki/vki-darwin.h b/include/vki/vki-darwin.h index d7fb765eda..e89888e65a 100644 --- a/include/vki/vki-darwin.h +++ b/include/vki/vki-darwin.h @@ -981,6 +981,11 @@ struct ByteRangeLockPB2 #define VKI_WQOPS_SET_EVENT_MANAGER_PRIORITY 128 /* max() in the provided priority in the the priority of the event manager */ #define VKI_WQOPS_THREAD_WORKLOOP_RETURN 256 /* parks the thread after delivering the passed kevent array */ #define VKI_WQOPS_SHOULD_NARROW 512 /* checks whether we should narrow our concurrency */ +#define VKI_WQOPS_SETUP_DISPATCH 1024 /* setup pthread workqueue-related operations */ + +#define VKI_WORKQ_DISPATCH_CONFIG_VERSION 2 +#define VKI_WORKQ_DISPATCH_MIN_SUPPORTED_VERSION 1 +#define VKI_WORKQ_DISPATCH_SUPPORTED_FLAGS 0 #include <sys/ttycom.h> diff --git a/include/vki/vki-scnums-darwin.h b/include/vki/vki-scnums-darwin.h index 3a33520780..f7f3b11057 100644 --- a/include/vki/vki-scnums-darwin.h +++ b/include/vki/vki-scnums-darwin.h @@ -782,7 +782,9 @@ #endif #define __NR_faccessat VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(466) #define __NR_fstatat64 VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(470) +#define __NR_unlinkat VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(472) #define __NR_readlinkat VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(473) +#define __NR_mkdirat VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(475) #define __NR_bsdthread_ctl VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(478) #define __NR_csrctl VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(483) #define __NR_guarded_open_dprotected_np VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(484) |
|
From: Mark W. <ma...@so...> - 2025-11-30 15:00:56
|
https://sourceware.org/cgit/valgrind/commit/?id=db4da40262410a10b67d410b4d5d4fe7f72bf788 commit db4da40262410a10b67d410b4d5d4fe7f72bf788 Author: Mark Wielaard <ma...@kl...> Date: Sun Nov 30 15:58:38 2025 +0100 Add sse4-common.h to none/tests/Makefile.am noinst_HEADERS Fixes: 5e584556a9b9 ("Add none/tests/sse4-common.h header") Diff: --- none/tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index c0f473b73a..20be62cbd3 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -95,7 +95,7 @@ dist_noinst_SCRIPTS = \ allexec_prepare_prereq \ filter_sort -noinst_HEADERS = fdleak.h +noinst_HEADERS = fdleak.h sse4-common.h EXTRA_DIST = \ allexec32.stdout.exp allexec32.stderr.exp allexec32.vgtest\ |
|
From: Paul F. <pa...@so...> - 2025-11-30 14:52:24
|
https://sourceware.org/cgit/valgrind/commit/?id=e4559d9fc88df83dc7a727871020e9d66bad11c9 commit e4559d9fc88df83dc7a727871020e9d66bad11c9 Author: Paul Floyd <pj...@wa...> Date: Sun Nov 30 15:51:20 2025 +0100 Darwin: add code for text_slide Code from Louis Brunner Diff: --- coregrind/m_mach/mach_basics.c | 12 +++++++++++- coregrind/m_mach/mach_msg.c | 20 ++++++++++---------- coregrind/m_ume/macho.c | 12 ++++++++++-- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/coregrind/m_mach/mach_basics.c b/coregrind/m_mach/mach_basics.c index f0f45f5735..73b802bdd6 100644 --- a/coregrind/m_mach/mach_basics.c +++ b/coregrind/m_mach/mach_basics.c @@ -30,6 +30,7 @@ #include "pub_core_basics.h" #include "pub_core_mach.h" +#include "pub_core_libcassert.h" // vg_assert #include <mach/mach.h> #include <mach/machine/ndr_def.h> @@ -40,6 +41,7 @@ extern mach_port_name_t thread_self_trap(void); extern mach_port_t mach_reply_port(void); /* Global variables set in mach_init() */ +int vm_page_shift = 0; vm_size_t vm_page_size = 0; mach_port_name_t mach_task_self_ = 0; @@ -60,6 +62,10 @@ mach_port_t mig_get_reply_port(void) // its own behalf, and doesn't call mig outside the semaphore } +void mach_msg_destroy(mach_msg_header_t *msg) +{ + // TODO: copy from XNU? +} void mig_dealloc_reply_port(mach_port_t reply_port) { @@ -79,7 +85,11 @@ void VG_(mach_init)(void) mach_task_self_ = task_self_trap(); // GrP fixme host_page_size(host_self_trap(), &vm_page_size); - vm_page_size = 4096; + vm_page_shift = 12; + // FIXME: stored in COMM_PAGE + 0x025, (1 << 12) = 4096 + vm_page_size = 0x1000; + + vg_assert(1 << vm_page_shift == vm_page_size); } #endif // defined(VGO_darwin) diff --git a/coregrind/m_mach/mach_msg.c b/coregrind/m_mach/mach_msg.c index c21425472a..adf95c1cf4 100644 --- a/coregrind/m_mach/mach_msg.c +++ b/coregrind/m_mach/mach_msg.c @@ -39,6 +39,7 @@ #if defined(VGO_darwin) +#include "config.h" // for DARWIN_VERS #include "pub_core_basics.h" #include "pub_core_mach.h" @@ -56,16 +57,15 @@ mach_msg_trap(mach_msg_header_t *msg, mach_msg_timeout_t timeout, mach_port_t notify); -mach_msg_return_t -mach_msg(msg, option, send_size, rcv_size, rcv_name, timeout, notify) - mach_msg_header_t *msg; - mach_msg_option_t option; - mach_msg_size_t send_size; - mach_msg_size_t rcv_size; - mach_port_t rcv_name; - mach_msg_timeout_t timeout; - mach_port_t notify; -{ +mach_msg_return_t mach_msg( + mach_msg_header_t *msg, + mach_msg_option_t option, + mach_msg_size_t send_size, + mach_msg_size_t rcv_size, + mach_port_t rcv_name, + mach_msg_timeout_t timeout, + mach_port_t notify +) { mach_msg_return_t mr; /* diff --git a/coregrind/m_ume/macho.c b/coregrind/m_ume/macho.c index 239b7fc026..a8fdfd7088 100644 --- a/coregrind/m_ume/macho.c +++ b/coregrind/m_ume/macho.c @@ -74,6 +74,7 @@ typedef struct load_info_t { vki_uint8_t *linker_entry; // dylinker entry point Addr linker_offset; // dylinker text offset vki_size_t max_addr; // biggest address reached while loading segments + Addr text_slide; // slide of the text segment because of "ASLR" (arm64-only) } load_info_t; static void print(const HChar *str) @@ -180,7 +181,7 @@ load_segment(int fd, vki_off_t offset, vki_off_t size, vki_size_t vmsize; // page-aligned vki_size_t vmend; // page-aligned unsigned int prot; - Addr slided_addr = segcmd->vmaddr + out_info->linker_offset; + Addr slided_addr = segcmd->vmaddr + out_info->linker_offset + out_info->text_slide; // GrP fixme mark __UNIXSTACK as SF_STACK @@ -449,6 +450,7 @@ load_dylinker(struct dylinker_command *dycmd, load_info_t *out_info) linker_info.entry = NULL; linker_info.linker_entry = NULL; linker_info.linker_offset = 0; + linker_info.text_slide = 0; linker_info.max_addr = out_info->max_addr; if (dycmd->name.offset >= dycmd->cmdsize) { @@ -816,7 +818,7 @@ Bool VG_(match_macho)(const void *hdr, SizeT len) // GrP fixme check more carefully for matching fat arch? - return (len >= VKI_PAGE_SIZE && + return (len >= sizeof(*magic) && (*magic == MAGIC || *magic == VG_(ntohl)(FAT_MAGIC))) ? True : False; } @@ -834,6 +836,7 @@ Int VG_(load_macho)(Int fd, const HChar *name, ExeInfo *info) load_info.linker_entry = NULL; load_info.linker_offset = 0; load_info.max_addr = 0; + load_info.text_slide = 0; err = VG_(fstat)(fd, &sb); if (err) { @@ -856,6 +859,11 @@ Int VG_(load_macho)(Int fd, const HChar *name, ExeInfo *info) info->text = (Addr) load_info.text; info->dynamic = load_info.linker_entry ? True : False; + if (!info->dynamic && load_info.text_slide) { + print("cannot slide static executables\n"); + return VKI_ENOEXEC; + } + info->executable_path = VG_(strdup)("ume.macho.executable_path", name); SysRes res = VG_(dup)(fd); |
|
From: Florian K. <fk...@so...> - 2025-11-30 08:35:03
|
https://sourceware.org/cgit/valgrind/commit/?id=502fb19a40194c52f051c603c311c0dd2d5c29b2 commit 502fb19a40194c52f051c603c311c0dd2d5c29b2 Author: Florian Krohm <fl...@ei...> Date: Sun Nov 30 08:33:41 2025 +0000 s390: Remove S390_NUM_FACILITY_DW; fix testcase stfle.c (BZ 509562) Now that the stfle insn is available we can use it to tell uas how many double words are needed to store all facility bits. Hence, S390_NUM_FACILITY_DW can go. none/tests/s390x/stfle.c: The bug is here if (bit_to_test < 64) return (hoststfle[0] & (1ULL << (63 - bit_to_test))); else if (bit_to_test < 128) return (hoststfle[1] & (1ULL << (63 - bit_to_test))); else if (bit_to_test < 192) return (hoststfle[2] & (1ULL << (63 - bit_to_test))); when bit_to_test >= 64. Now fixed and test added. Part of fixing https://bugs.kde.org/show_bug.cgi?id=509562 Diff: --- VEX/pub/libvex_s390x_common.h | 3 --- coregrind/m_machine.c | 20 +++++++++++----- none/tests/s390x/stfle.c | 43 +++++++++++++++++++++++------------ none/tests/s390x/stfle.stdout.exp | 2 ++ none/tests/s390x/stfle.stdout.exp-z16 | 2 ++ tests/s390x_features.c | 32 ++++++++++++++++++-------- 6 files changed, 69 insertions(+), 33 deletions(-) diff --git a/VEX/pub/libvex_s390x_common.h b/VEX/pub/libvex_s390x_common.h index 295e0c29b0..5fc0be9166 100644 --- a/VEX/pub/libvex_s390x_common.h +++ b/VEX/pub/libvex_s390x_common.h @@ -99,9 +99,6 @@ /* Number of arguments that can be passed in registers */ #define S390_NUM_GPRPARMS 5 -/* Number of double words needed to store all facility bits. */ -#define S390_NUM_FACILITY_DW 4 - #endif /* __LIBVEX_PUB_S390X_H */ /*--------------------------------------------------------------------*/ diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index 860ce1f9dd..4c65ec6cbc 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -1541,15 +1541,24 @@ Bool VG_(machine_get_hwcaps)( void ) VG_(exit)(1); } - ULong hoststfle[S390_NUM_FACILITY_DW]; + /* Get number of double words to store all facilities */ + unsigned long long dummy[1]; - for (i = 0; i < S390_NUM_FACILITY_DW; ++i) - hoststfle[i] = 0; + register ULong r0 asm("0") = 0; + asm volatile(".insn s,0xb2b00000,%0\n" /* stfle */ + : "=Q" (dummy), "+d"(r0) + : + : "cc", "memory"); + UInt num_dw = r0 + 1; + + /* Get the facility bits */ + ULong hoststfle[num_dw]; - register ULong reg0 asm("0") = S390_NUM_FACILITY_DW - 1; + for (i = 0; i < num_dw; ++i) + hoststfle[i] = 0; __asm__(".insn s,0xb2b00000,%0" /* stfle */ - : "=Q"(hoststfle), "+d"(reg0) + : "=Q"(hoststfle), "+d"(r0) : : "cc"); @@ -1582,7 +1591,6 @@ Bool VG_(machine_get_hwcaps)( void ) UChar dw_number = 0; UChar fac_bit = 0; for (i=0; i < sizeof fac_hwcaps / sizeof fac_hwcaps[0]; ++i) { - vg_assert(fac_hwcaps[i].facility_bit <= 191); // for now dw_number = fac_hwcaps[i].facility_bit / 64; fac_bit = fac_hwcaps[i].facility_bit % 64; if (hoststfle[dw_number] & (1ULL << (63 - fac_bit))) { diff --git a/none/tests/s390x/stfle.c b/none/tests/s390x/stfle.c index 5926964c6a..db432c6d9b 100644 --- a/none/tests/s390x/stfle.c +++ b/none/tests/s390x/stfle.c @@ -1,12 +1,22 @@ #include <stdio.h> +#include <assert.h> -/* Number of double words needed to store all facility bits. */ -#define S390_NUM_FACILITY_DW 4 +/* Return the number of double words needed to store all facility bits */ +static unsigned get_num_facility_dw(void) +{ + unsigned long long dummy[1]; + register unsigned long long r0 asm("0") = 0; + asm volatile(".insn s,0xb2b00000,%0\n" /* stfle */ + : "=Q" (dummy), "+d"(r0) + : + : "cc", "memory"); + return r0 + 1; +} unsigned long long stfle(unsigned long dw, unsigned bit_to_test) { - unsigned long long hoststfle[S390_NUM_FACILITY_DW]; + unsigned long long hoststfle[dw]; register unsigned long long __nr asm("0") = dw - 1; int cc; @@ -16,20 +26,19 @@ unsigned long long stfle(unsigned long dw, unsigned bit_to_test) : "=Q" (*hoststfle), "+d" (__nr), "=d" (cc) : : "cc", "memory"); printf("the value of cc is %d and #double words is %llu\n", cc, __nr + 1); - if (bit_to_test < 64) - return (hoststfle[0] & (1ULL << (63 - bit_to_test))); - else if (bit_to_test < 128) - return (hoststfle[1] & (1ULL << (63 - bit_to_test))); - else if (bit_to_test < 192) - return (hoststfle[2] & (1ULL << (63 - bit_to_test))); - - printf("code needs to be updated\n"); - return 0; + + for (unsigned i = 0; i < dw; ++i) { + if (bit_to_test < (i + 1) * 64) { + bit_to_test -= i * 64; + return (hoststfle[i] & (1ULL << (63 - bit_to_test))); + } + } + assert(0); } -int main() +int main(void) { - int dw = S390_NUM_FACILITY_DW; + int dw = get_num_facility_dw(); /* Test #1: Make sure STFLE returns sensible values. z/Arch facilities must be present. */ @@ -44,6 +53,12 @@ int main() else printf("STFLE facility is not installed\n"); + /* Test #2.1: Test facility 77 which is installed for z196 and later */ + if (stfle(dw, 77)) + printf("Facility 77 is installed\n"); + else + printf("Facility 77 is not installed\n"); + /* Test #3: Tell STFLE to only write 1 DW of facility bits. Expected condition code should be 3 because this test is run on those machines only that need 3 do double words to store facility bits. */ diff --git a/none/tests/s390x/stfle.stdout.exp b/none/tests/s390x/stfle.stdout.exp index 895551e071..ff00c06cb5 100644 --- a/none/tests/s390x/stfle.stdout.exp +++ b/none/tests/s390x/stfle.stdout.exp @@ -3,6 +3,8 @@ the value of cc is 0 and #double words is 3 The z/Architecture architectural mode is installed and active the value of cc is 0 and #double words is 3 STFLE facility is installed +the value of cc is 0 and #double words is 3 +Facility 77 is installed the value of cc is 3 and #double words is 3 the value of cc is 3 and #double words is 3 The z/Architecture architectural mode is installed and active diff --git a/none/tests/s390x/stfle.stdout.exp-z16 b/none/tests/s390x/stfle.stdout.exp-z16 index 8b01a2becd..8c74a068a0 100644 --- a/none/tests/s390x/stfle.stdout.exp-z16 +++ b/none/tests/s390x/stfle.stdout.exp-z16 @@ -3,6 +3,8 @@ the value of cc is 0 and #double words is 4 The z/Architecture architectural mode is installed and active the value of cc is 0 and #double words is 4 STFLE facility is installed +the value of cc is 0 and #double words is 4 +Facility 77 is installed the value of cc is 3 and #double words is 4 the value of cc is 3 and #double words is 4 The z/Architecture architectural mode is installed and active diff --git a/tests/s390x_features.c b/tests/s390x_features.c index 2b6af79f8a..954db9f055 100644 --- a/tests/s390x_features.c +++ b/tests/s390x_features.c @@ -51,23 +51,33 @@ #define GET_HWCAP() 0UL #endif -/* Number of double words needed to store all facility bits. */ -#define S390_NUM_FACILITY_DW 3 +/* Return the number of double words needed to store all facility bits */ +static unsigned get_num_facility_dw(void) +{ + unsigned long long facilities[1]; -static void clear_facilities(unsigned long long *ret) + register unsigned long long r0 asm("0") = 0; + asm volatile(".insn s,0xb2b00000,%0\n" /* stfle */ + : "=Q" (facilities), "+d"(r0) + : + : "cc", "memory"); + return r0 + 1; +} + +static void clear_facilities(unsigned long long *ret, unsigned num_dw) { unsigned int index; - for(index = 0; index < S390_NUM_FACILITY_DW; index++) + for(index = 0; index < num_dw; index++) { ret[index] = 0ULL; } } -void stfle(unsigned long long *ret) +void stfle(unsigned long long *ret, unsigned num_dw) { - register unsigned long long r0 asm("0") = S390_NUM_FACILITY_DW - 1; + register unsigned long long r0 asm("0") = num_dw - 1; asm volatile(".insn s,0xb2b00000,%0\n" /* stfle */ - : "=m" (*ret), "+d"(r0) :: "cc", "memory"); + : "=Q" (*ret), "+d"(r0) :: "cc", "memory"); } @@ -217,13 +227,15 @@ static model_info *get_host(void) static int go(char *feature, char *cpu) { - unsigned long long facilities[S390_NUM_FACILITY_DW]; unsigned long long match; model_info *host, *from, *to, *p; char *colon; - clear_facilities(facilities); - stfle(facilities); + unsigned num_dw = get_num_facility_dw(); + unsigned long long facilities[num_dw]; + + clear_facilities(facilities, num_dw); + stfle(facilities, num_dw); if (strcmp(feature, "s390x-vx") == 0 ) { /* VX needs kernel support; thus check the appropriate HWCAP bit. */ |
|
From: Paul F. <pa...@so...> - 2025-11-29 20:53:40
|
https://sourceware.org/cgit/valgrind/commit/?id=34b849de8406fe2b8a37083e6e153a0693de204d commit 34b849de8406fe2b8a37083e6e153a0693de204d Author: Paul Floyd <pj...@wa...> Date: Sat Nov 29 21:52:00 2025 +0100 debuginfo: small code simplification Merge two identical cases (and there may be a third if and when Darwin arm64 makes it here). Diff: --- coregrind/m_debuginfo/debuginfo.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index bb208925d4..3daa38a3a9 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -3517,9 +3517,7 @@ Bool VG_(use_CF_info) ( /*MOD*/D3UnwindRegs* uregsHere, # elif defined(VGA_mips32) || defined(VGA_mips64) || defined(VGA_nanomips) ipHere = uregsHere->pc; # elif defined(VGA_ppc32) || defined(VGA_ppc64be) || defined(VGA_ppc64le) -# elif defined(VGP_arm64_linux) - ipHere = uregsHere->pc; -# elif defined(VGP_arm64_freebsd) +# elif defined(VGA_arm64) ipHere = uregsHere->pc; # elif defined(VGP_riscv64_linux) ipHere = uregsHere->pc; |
|
From: Paul F. <pa...@so...> - 2025-11-29 20:17:43
|
https://sourceware.org/cgit/valgrind/commit/?id=dde5c22436e7b8c8f73b8366ed8e5ec967a132c4 commit dde5c22436e7b8c8f73b8366ed8e5ec967a132c4 Author: Paul Floyd <pj...@wa...> Date: Sat Nov 29 21:14:44 2025 +0100 Darwin: updates to macho loading and turn off hanging regtests Code merges from Louis Brunner. Turn off 7 tests that are hanging. Updates to filtering. Diff: --- configure.ac | 9 ++++ coregrind/m_debuginfo/debuginfo.c | 7 ++- coregrind/m_debuginfo/readmacho.c | 93 +++++++++++++++++--------------- drd/tests/annotate_sem.vgtest | 2 +- drd/tests/pth_cond_destroy_busy.vgtest | 2 +- drd/tests/swapcontext.vgtest | 2 +- helgrind/tests/bug392331.vgtest | 2 +- helgrind/tests/bug392331_supp.vgtest | 2 +- helgrind/tests/filter_stderr.in | 9 +++- helgrind/tests/shared_timed_mutex.vgtest | 2 +- helgrind/tests/tc22_exit_w_lock.vgtest | 2 +- helgrind/tests/tc24_nonzero_sem.c | 5 +- 12 files changed, 84 insertions(+), 53 deletions(-) diff --git a/configure.ac b/configure.ac index 09a352a707..54df9c1e19 100644 --- a/configure.ac +++ b/configure.ac @@ -396,6 +396,15 @@ case "${host_os}" in AC_DEFINE([DARWIN_10_11], 101100, [DARWIN_VERS value for Mac OS X 10.11]) AC_DEFINE([DARWIN_10_12], 101200, [DARWIN_VERS value for macOS 10.12]) AC_DEFINE([DARWIN_10_13], 101300, [DARWIN_VERS value for macOS 10.13]) + AC_DEFINE([DARWIN_10_14], 101400, [DARWIN_VERS value for macOS 10.14 / iOS 12]) + AC_DEFINE([DARWIN_10_15], 101500, [DARWIN_VERS value for macOS 10.15 / iOS 13]) + AC_DEFINE([DARWIN_11_00], 110000, [DARWIN_VERS value for macOS 11.0 / iOS 14]) + AC_DEFINE([DARWIN_12_00], 120000, [DARWIN_VERS value for macOS 12.0 / iOS 15]) + AC_DEFINE([DARWIN_13_00], 130000, [DARWIN_VERS value for macOS 13.0 / iOS 16]) + AC_DEFINE([DARWIN_14_00], 140000, [DARWIN_VERS value for macOS 14.0 / iOS 17]) + AC_DEFINE([DARWIN_15_00], 150000, [DARWIN_VERS value for macOS 15.0 / iOS 18]) + AC_DEFINE([DARWIN_15_04], 150400, [DARWIN_VERS value for macOS 15.4]) + AC_DEFINE([DARWIN_26_00], 260000, [DARWIN_VERS value for macOS / iOS 26]) AC_MSG_CHECKING([for the kernel version]) kernel=`uname -r` diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 18152b9e25..bb208925d4 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -60,11 +60,11 @@ #if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd) # include "priv_readelf.h" # include "priv_readdwarf3.h" -# include "priv_readpdb.h" #elif defined(VGO_darwin) # include "priv_readmacho.h" -# include "priv_readpdb.h" +# include "pub_core_mach.h" #endif +# include "priv_readpdb.h" #if defined(VGO_freebsd) #include "pub_core_clientstate.h" #endif @@ -1196,6 +1196,9 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd ) if (sr_isError(statres)) { DebugInfo fake_di; Bool quiet = VG_(strstr)(filename, "/var/run/nscd/") != NULL +#if defined(VGO_darwin) + || VG_(strstr)(filename, DARWIN_FAKE_MEMORY_PATH) != NULL +#endif || VG_(strstr)(filename, "/dev/shm/") != NULL || VG_(strncmp)("/memfd:", filename, VG_(strlen)("/memfd:")) == 0; diff --git a/coregrind/m_debuginfo/readmacho.c b/coregrind/m_debuginfo/readmacho.c index 31f56134d6..dc2023bc77 100644 --- a/coregrind/m_debuginfo/readmacho.c +++ b/coregrind/m_debuginfo/readmacho.c @@ -83,6 +83,41 @@ /*--- ---*/ /*------------------------------------------------------------*/ +static Int count_rw_loads(const struct load_command* macho_load_commands, unsigned int ncmds) +{ + Int rw_loads = 0; + const struct load_command* lc = (const struct load_command*)macho_load_commands; + for (unsigned int i = 0U; i < ncmds; ++i) { + if (lc->cmd == LC_SEGMENT_CMD) { + const struct SEGMENT_COMMAND* sc = (const struct SEGMENT_COMMAND*)lc; + if (sc->initprot == 3 && sc->filesize +#if DARWIN_VERS >= DARWIN_13_00 +// FIXME: somehow __DATA_CONST appears as rw- in most binaries in macOS 13 and later (not sure when that started) +// so we ignore it otherwise some binaries don't get symbols + && VG_(strcmp)(sc->segname, "__DATA_CONST") != 0 +#endif + ) { + rw_loads += 1; + } + } + const char* tmp = (const char*)lc + lc->cmdsize; + lc = (const struct load_command*)tmp; + } + return rw_loads; +} + +static Bool check_fat_macho_and_get_rw_loads(const void* macho_header, Int* rw_loads) +{ + const struct fat_header* fh_be = (const struct fat_header*)macho_header; + vg_assert(fh_be); + if (VG_(ntohl)(fh_be->magic) == FAT_MAGIC) { + // @todo PJF not yet handled, previous behaviour was to assume that the count is 1 + *rw_loads = 1; + return True; + } + return False; +} + /* A DiSlice is used to handle the thin/fat distinction for MachO images. (1) the entire mapped-in ("primary") image, fat headers, kitchen sink, whatnot: the entire file. This is the DiImage* that is the backing @@ -93,20 +128,11 @@ memory that falls entirely inside the primary image. */ +STATIC_ASSERT(sizeof(struct fat_header) <= sizeof(struct MACH_HEADER)); + Bool ML_(check_macho_and_get_rw_loads)( Int fd, Int* rw_loads ) { - /* (JRS: the Mach-O headers might not be in this mapped data, - because we only mapped a page for this initial check, - or at least not very much, and what's at the start of the file - is in general a so-called fat header. The Mach-O object we're - interested in could be arbitrarily far along the image, and so - we can't assume its header will fall within this page.) */ - - /* But we can say that either it's a fat object, in which case it - begins with a fat header, or it's unadorned Mach-O, in which - case it starts with a normal header. At least do what checks we - can to establish whether or not we're looking at something - sane. */ + vg_assert(rw_loads); HChar macho_header[sizeof(struct MACH_HEADER)]; SysRes preadres = VG_(pread)( fd, macho_header, sizeof(struct MACH_HEADER), 0 ); @@ -115,43 +141,26 @@ Bool ML_(check_macho_and_get_rw_loads)( Int fd, Int* rw_loads ) return False; } - const struct fat_header* fh_be = (const struct fat_header*)macho_header; - const struct MACH_HEADER* mh = (const struct MACH_HEADER*)macho_header; - - vg_assert(fh_be); - vg_assert(mh); - vg_assert(rw_loads); - STATIC_ASSERT(sizeof(struct fat_header) <= sizeof(struct MACH_HEADER)); - if (VG_(ntohl)(fh_be->magic) == FAT_MAGIC) { - // @todo PJF not yet handled, previous behaviour was to assume that the count is 1 - *rw_loads = 1; + if (check_fat_macho_and_get_rw_loads(macho_header, rw_loads)) { return True; } - if (mh->magic == MAGIC) { - HChar* macho_load_commands = ML_(dinfo_zalloc)("di.readmacho.macho_load_commands", mh->sizeofcmds); - preadres = VG_(pread)( fd, macho_load_commands, mh->sizeofcmds, sizeof(struct MACH_HEADER) ); - if (sr_isError(preadres) || sr_Res(preadres) < mh->sizeofcmds) { - ML_(dinfo_free)(macho_load_commands); - return False; - } + const struct MACH_HEADER* mh = (const struct MACH_HEADER*)macho_header; + vg_assert(mh); + if (mh->magic != MAGIC) { + return False; + } - const struct load_command* lc = (const struct load_command*)macho_load_commands; - for (unsigned int i = 0U; i < mh->ncmds; ++i) { - if (lc->cmd == LC_SEGMENT_CMD) { - const struct SEGMENT_COMMAND* sc = (const struct SEGMENT_COMMAND*)lc; - if (sc->initprot == 3 && sc->filesize) { - ++*rw_loads; - } - } - const char* tmp = (const char*)lc + lc->cmdsize; - lc = (const struct load_command*)tmp; - } + HChar* macho_load_commands = ML_(dinfo_zalloc)("di.readmacho.macho_load_commands", mh->sizeofcmds); + preadres = VG_(pread)( fd, macho_load_commands, mh->sizeofcmds, sizeof(struct MACH_HEADER) ); + if (sr_isError(preadres) || sr_Res(preadres) < mh->sizeofcmds) { ML_(dinfo_free)(macho_load_commands); - return True; + return False; } - return False; + *rw_loads = count_rw_loads((const struct load_command*)macho_load_commands, mh->ncmds); + ML_(dinfo_free)(macho_load_commands); + return True; } diff --git a/drd/tests/annotate_sem.vgtest b/drd/tests/annotate_sem.vgtest index 3c5071ca14..4cec9ee371 100644 --- a/drd/tests/annotate_sem.vgtest +++ b/drd/tests/annotate_sem.vgtest @@ -1,4 +1,4 @@ -prereq: test -e annotate_sem && ./supported_libpthread +prereq: test -e annotate_sem && ./supported_libpthread && ! ../../tests/os_test darwin vgopts: --fair-sched=try --read-var-info=yes --check-stack-var=yes --show-confl-seg=no prog: annotate_sem stderr_filter: filter_stderr_and_thread_no diff --git a/drd/tests/pth_cond_destroy_busy.vgtest b/drd/tests/pth_cond_destroy_busy.vgtest index f3cf778252..a5895f3520 100644 --- a/drd/tests/pth_cond_destroy_busy.vgtest +++ b/drd/tests/pth_cond_destroy_busy.vgtest @@ -1,2 +1,2 @@ -prereq: ./supported_libpthread && ! ../../tests/libc_test glibc 2.24.90 +prereq: ./supported_libpthread && ! ../../tests/libc_test glibc 2.24.90 && ! ../../tests/os_test darwin prog: pth_cond_destroy_busy diff --git a/drd/tests/swapcontext.vgtest b/drd/tests/swapcontext.vgtest index 98e3712c40..0c05ab7021 100644 --- a/drd/tests/swapcontext.vgtest +++ b/drd/tests/swapcontext.vgtest @@ -1,4 +1,4 @@ -prereq: test -e swapcontext && ./supported_libpthread +prereq: test -e swapcontext && ./supported_libpthread && ! ../../tests/os_test darwin vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=2 prog: swapcontext stderr_filter: filter_stderr diff --git a/helgrind/tests/bug392331.vgtest b/helgrind/tests/bug392331.vgtest index f300c5cc13..3484935de7 100644 --- a/helgrind/tests/bug392331.vgtest +++ b/helgrind/tests/bug392331.vgtest @@ -1,4 +1,4 @@ -prereq: test -e bug392331 +prereq: test -e bug392331 && ! ../../tests/os_test darwin vgopts: -q --check-cond-signal-mutex=yes prog: bug392331 stderr_filter: filter_bug392331 diff --git a/helgrind/tests/bug392331_supp.vgtest b/helgrind/tests/bug392331_supp.vgtest index 64fc729607..5b4c526bf9 100644 --- a/helgrind/tests/bug392331_supp.vgtest +++ b/helgrind/tests/bug392331_supp.vgtest @@ -1,3 +1,3 @@ -prereq: test -e bug392331 +prereq: test -e bug392331 && ! ../../tests/os_test darwin vgopts: -q --suppressions=bug392331.supp prog: bug392331 diff --git a/helgrind/tests/filter_stderr.in b/helgrind/tests/filter_stderr.in index 03a7d9e3b6..3a89f54bd3 100644 --- a/helgrind/tests/filter_stderr.in +++ b/helgrind/tests/filter_stderr.in @@ -19,7 +19,14 @@ fi | # And FreeBSD if $dir/../../tests/os_test freebsd; then - #perl -p $dir/filter_stderr_freebsd + awk -f $dir/filter_freebsd.awk +else + cat +fi | + +# And Darwin +if $dir/../../tests/os_test darwin; then + # reuse the FreeBSD filter to start with awk -f $dir/filter_freebsd.awk else cat diff --git a/helgrind/tests/shared_timed_mutex.vgtest b/helgrind/tests/shared_timed_mutex.vgtest index d3a044379c..8903894e6a 100644 --- a/helgrind/tests/shared_timed_mutex.vgtest +++ b/helgrind/tests/shared_timed_mutex.vgtest @@ -1,3 +1,3 @@ -prereq: test -e ../../drd/tests/shared_timed_mutex +prereq: test -e ../../drd/tests/shared_timed_mutex && ! ../../tests/os_test darwin vgopts: --read-var-info=yes prog: ../../drd/tests/shared_timed_mutex diff --git a/helgrind/tests/tc22_exit_w_lock.vgtest b/helgrind/tests/tc22_exit_w_lock.vgtest index 2e6190a727..8dd7531ec5 100644 --- a/helgrind/tests/tc22_exit_w_lock.vgtest +++ b/helgrind/tests/tc22_exit_w_lock.vgtest @@ -1,3 +1,3 @@ -prereq: test -e tc22_exit_w_lock +prereq: test -e tc22_exit_w_lock && ! ../../tests/os_test darwin prog: tc22_exit_w_lock cleanup: rm -f vgcore.* diff --git a/helgrind/tests/tc24_nonzero_sem.c b/helgrind/tests/tc24_nonzero_sem.c index 541fa7ddb8..2fe4081913 100644 --- a/helgrind/tests/tc24_nonzero_sem.c +++ b/helgrind/tests/tc24_nonzero_sem.c @@ -44,7 +44,10 @@ int main ( void ) assert(!r); } - r= my_sem_destroy(sem); assert(!r); + r= my_sem_destroy(sem); +#if !defined(VGO_darwin) + assert(!r); +#endif return 0; } |
|
From: Paul F. <pa...@so...> - 2025-11-28 21:51:31
|
https://sourceware.org/cgit/valgrind/commit/?id=5d68d627f1d8ced4973ff9e138a1ec06922446e2 commit 5d68d627f1d8ced4973ff9e138a1ec06922446e2 Author: Paul Floyd <pj...@wa...> Date: Fri Nov 28 22:49:25 2025 +0100 Darwin: update signal tramp, helgrind and drd suppressions Change a couple of testcase asserts to match Darwin quirks. Signal tramp from Louis Brunner Diff: --- coregrind/m_libcsignal.c | 26 ++++++++++++++++++-------- darwin17.supp | 19 +++++++++++++++++++ helgrind/tests/tc12_rwl_trivial.c | 2 +- helgrind/tests/tc23_bogus_condwait.c | 5 ++++- include/vki/vki-darwin.h | 3 +++ 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/coregrind/m_libcsignal.c b/coregrind/m_libcsignal.c index d8563a4d02..d28b0b9b21 100644 --- a/coregrind/m_libcsignal.c +++ b/coregrind/m_libcsignal.c @@ -240,19 +240,29 @@ Int VG_(sigprocmask)( Int how, const vki_sigset_t* set, vki_sigset_t* oldset) #if defined(VGO_darwin) /* A helper function for sigaction on Darwin. */ -static -void darwin_signal_demux(void* a1, UWord a2, UWord a3, void* a4, void* a5) { +static +void darwin_signal_demux(void* catcher, UWord infostyle, UWord sig, void* sinfo, void* uctx +# if defined(VGA_arm64) +, void* token +# endif +) { VG_(debugLog)(2, "libcsignal", - "PRE demux sig, a2 = %lu, signo = %lu\n", a2, a3); - if (a2 == 1) - ((void(*)(int))a1) (a3); + "PRE demux sig, infostyle = %s, signo = %lu\n", infostyle == VKI_UC_TRAD ? "TRAD" : "FLAVOR", sig); + if (infostyle == VKI_UC_TRAD) + ((void(*)(int))catcher) (sig); else - ((void(*)(int,void*,void*))a1) (a3,a4,a5); + ((void(*)(int,void*,void*))catcher) (sig, sinfo, uctx); VG_(debugLog)(2, "libcsignal", - "POST demux sig, a2 = %lu, signo = %lu\n", a2, a3); - VG_(do_syscall2)(__NR_sigreturn, (UWord)a5, 0x1E); + "POST demux sig, infostyle = %s, signo = %lu\n", infostyle == VKI_UC_TRAD ? "TRAD" : "FLAVOR", sig); +# if defined(VGA_arm64) + VG_(do_syscall3)(__NR_sigreturn, (UWord)uctx, VKI_UC_FLAVOR, (UWord)token); + /* NOTREACHED */ + __asm__ __volatile__("udf #0"); +# else + VG_(do_syscall2)(__NR_sigreturn, (UWord)uctx, VKI_UC_FLAVOR); /* NOTREACHED */ __asm__ __volatile__("ud2"); +# endif } #endif diff --git a/darwin17.supp b/darwin17.supp index 6966f101cd..528a9f139a 100644 --- a/darwin17.supp +++ b/darwin17.supp @@ -866,6 +866,13 @@ fun:dispatch_once_f } +{ + OSX1013:helgrind:nanosleep + Helgrind:Race + ... + fun:nanosleep +} + { OSX1013:drd:nanosleep drd:ConflictingAccess @@ -1009,6 +1016,18 @@ fun:gomp_barrier_wait } +{ + OSX1013:helgrind:_os_unfair_lock_lock_slow + Helgrind:Race + fun:_os_unfair_lock_lock_slow +} + +{ + OSX1013:helgrind:sem_trywait + Helgrind:Race + fun:sem_trywait +} + { OSX1013:drd:object_dispose drd:ConflictingAccess diff --git a/helgrind/tests/tc12_rwl_trivial.c b/helgrind/tests/tc12_rwl_trivial.c index 35702ebb09..24f312c663 100644 --- a/helgrind/tests/tc12_rwl_trivial.c +++ b/helgrind/tests/tc12_rwl_trivial.c @@ -27,7 +27,7 @@ int main ( void ) /* this should fail - lock is unowned now */ r = pthread_rwlock_unlock( &rwl ); -#if defined(VGO_darwin) || defined(VGO_solaris) || defined(VGO_freebsd) +#if defined(VGO_solaris) || defined(VGO_freebsd) assert(r != 0); #else assert(r == 0); diff --git a/helgrind/tests/tc23_bogus_condwait.c b/helgrind/tests/tc23_bogus_condwait.c index f2ccf3517f..b106748179 100644 --- a/helgrind/tests/tc23_bogus_condwait.c +++ b/helgrind/tests/tc23_bogus_condwait.c @@ -90,7 +90,10 @@ int main ( void ) r= pthread_join( my_rescuer, NULL ); assert(!r); r= pthread_join( grabber, NULL ); assert(!r); - r= my_sem_destroy( quit_now ); assert(!r); + r= my_sem_destroy( quit_now ); +#if !defined(VGO_darwin) + assert(!r); +#endif return 0; } diff --git a/include/vki/vki-darwin.h b/include/vki/vki-darwin.h index 5cffcd1b64..d7fb765eda 100644 --- a/include/vki/vki-darwin.h +++ b/include/vki/vki-darwin.h @@ -526,6 +526,9 @@ typedef struct { //typedef struct __sigaction vki_sigaction_toK_t; //typedef struct sigaction vki_sigaction_fromK_t; +#define VKI_UC_TRAD 1 +#define VKI_UC_FLAVOR 30 + typedef struct { void* ksa_handler; |
|
From: Paul F. <pa...@so...> - 2025-11-28 12:40:20
|
https://sourceware.org/cgit/valgrind/commit/?id=7c5fa1ac43196165c359ddc864fb3f7b3c4c6edb commit 7c5fa1ac43196165c359ddc864fb3f7b3c4c6edb Author: Paul Floyd <pj...@wa...> Date: Fri Nov 28 13:39:26 2025 +0100 Darwin .gitignore: add lines for cachegrind callgrind and lackey dSYM directories Diff: --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 33378bcb7c..58b81fa46c 100644 --- a/.gitignore +++ b/.gitignore @@ -79,6 +79,7 @@ # /cachegrind/ /cachegrind/*.so +/cachegrind/*.dSYM /cachegrind/.deps /cachegrind/cachegrind-*-darwin /cachegrind/cachegrind-*-linux @@ -129,6 +130,7 @@ # /callgrind/ /callgrind/*.so +/callgrind/*.dSYM /callgrind/.deps /callgrind/callgrind-*-darwin /callgrind/callgrind-*-linux @@ -746,6 +748,7 @@ # /lackey/ /lackey/*.so +/lackey/*.dSYM /lackey/.deps /lackey/lackey-*-darwin /lackey/lackey-*-linux |
|
From: Paul F. <pa...@so...> - 2025-11-28 12:37:52
|
https://sourceware.org/cgit/valgrind/commit/?id=6a5c15def701a4dfccec322d2367eb4464f8a88e commit 6a5c15def701a4dfccec322d2367eb4464f8a88e Author: Paul Floyd <pj...@wa...> Date: Fri Nov 28 13:36:43 2025 +0100 Darwin DRD and Helgrind: clean up suppressions Also fix one DRD testcase where a pthread function returns a different error code. Diff: --- darwin17.supp | 134 ++++------------------------------------------------ drd/tests/trylock.c | 7 ++- 2 files changed, 16 insertions(+), 125 deletions(-) diff --git a/darwin17.supp b/darwin17.supp index 90d99f0748..6966f101cd 100644 --- a/darwin17.supp +++ b/darwin17.supp @@ -585,13 +585,6 @@ obj:*CoreServices.framework*LaunchServices* } -##{ -## OSX1013:libsystem_pthread-1 -## Memcheck:Cond -## obj:*libsystem_pthread*dylib* -## obj:*ImageIO.framework*ImageIO* -## obj:*ImageIO.framework*ImageIO* -##} { OSX1013:ApplicationServices-1 @@ -779,13 +772,6 @@ fun:*NXHash* } -{ - OSX1013:_pthread_start - Helgrind:Race - fun:_pthread_start - fun:thread_start -} - { OSX1013:vng_aes_encrypt_opt Memcheck:Value8 @@ -799,40 +785,9 @@ } { - OSX1013:helgrind:_pthread_deallocate - Helgrind:Race - fun:_pthread_deallocate -} - -{ - OSX1013:helgrind:_pthread_join_cleanup - Helgrind:Race - fun:_pthread_join_cleanup -} - -{ - OSX1013:helgrind:_pthread_join - Helgrind:Race - ... - fun:_pthread_join -} - -{ - OSX1013:helgrind:_pthread_terminate + OSX1013:helgrind:pthread library Helgrind:Race - fun:_pthread_terminate -} - -{ - OSX1013:helgrind:_pthread_exit - Helgrind:Race - fun:_pthread_exit -} - -{ - OSX1013:helgrind:_pthread_body - Helgrind:Race - fun:_pthread_body + obj:/usr/lib/system/libsystem_pthread.dylib } # various getaddrinfo suppressions @@ -890,13 +845,6 @@ fun:cache_fill } -{ - OSX1013:helgrind:pthead_once - Helgrind:Race - ... - fun:pthread_once -} - { OSX1013:helgrind:objc_destructInstance Helgrind:Race @@ -919,50 +867,14 @@ } { - OSX1013:nanosleep + OSX1013:drd:nanosleep drd:ConflictingAccess fun:nanosleep } { - OSX1013:_pthread_join + OSX1013:drd:pthread library drd:ConflictingAccess - fun:_pthread_join -} -{ - OSX1013:usleep - drd:ConflictingAccess - fun:pthread_testcancel - fun:usleep -} -{ - OSX1013:_pthread_join_cleanup - drd:ConflictingAccess - fun:_pthread_join_cleanup -} -{ - OSX1013:pthread_mutex_destroy - drd:ConflictingAccess - fun:pthread_mutex_destroy -} -{ - OSX1013:pthread_cond_destroy - drd:ConflictingAccess - fun:pthread_cond_destroy -} -{ - OSX1013:pthread_mutex_unlock - drd:ConflictingAccess - fun:pthread_mutex_unlock -} -{ - OSX1013:pthread_mutex_lock - drd:ConflictingAccess - fun:pthread_mutex_lock -} -{ - OSX1013:_pthread_deallocate - drd:ConflictingAccess - fun:_pthread_deallocate + obj:/usr/lib/system/libsystem_pthread.dylib } { OSX1013:std::timed_mutex::unlock @@ -974,36 +886,11 @@ drd:ConflictingAccess fun:_ZNSt3__111timed_mutex14try_lock_untilINS_6chrono12steady_clockENS2_8durationIxNS_5ratio* } -{ - OSX1013:_pthread_cond_updateval - drd:ConflictingAccess - fun:_pthread_cond_updateval -} -{ - OSX1013:pthread_cond_signal - drd:ConflictingAccess - fun:pthread_cond_signal -} -{ - OSX1013:_pthread_mutex_droplock - drd:ConflictingAccess - fun:_pthread_mutex_droplock -} -{ - OSX1013:_pthread_cond_wait - drd:ConflictingAccess - fun:_pthread_cond_wait -} { OSX1013:mach_timebase_info drd:ConflictingAccess fun:mach_timebase_info } -{ - OSX1013:pthread_testcancel - drd:ConflictingAccess - fun:pthread_testcancel -} # take care with this, don't want to suppress anything in user # thread functions { @@ -1116,6 +1003,11 @@ fun:_ZN9rwlock_ttILb0EE5writeEv } +{ + OSX1013:helgrind:gomp_barrier_wait + Helgrind:Race + fun:gomp_barrier_wait +} { OSX1013:drd:object_dispose @@ -1138,12 +1030,6 @@ fun:objc_destructInstance } -{ - OSX1013:drd:pthread_rwlock_unlock - drd:ConflictingAccess - fun:pthread_rwlock_unlock -} - { OSX1013:drd:xpc_pipe_routine drd:ConflictingAccess diff --git a/drd/tests/trylock.c b/drd/tests/trylock.c index 1aca703408..b2199e3057 100644 --- a/drd/tests/trylock.c +++ b/drd/tests/trylock.c @@ -57,7 +57,12 @@ int main(int argc, char** argv) #endif fprintf(stderr, "Attempt to lock for writing recursively (not allowed).\n"); r = pthread_rwlock_wrlock(&rwlock); assert(r == 0); - r = pthread_rwlock_trywrlock(&rwlock); assert(r == EBUSY); + r = pthread_rwlock_trywrlock(&rwlock); +#if defined(__APPLE__) + assert(r == EDEADLK); +#else + assert(r == EBUSY); +#endif r = pthread_rwlock_unlock(&rwlock); assert(r == 0); r = pthread_rwlock_destroy(&rwlock); assert(r == 0); |
|
From: Mark W. <ma...@kl...> - 2025-11-28 10:51:22
|
On Tue, Nov 25, 2025 at 01:14:52PM +0100, Mark Wielaard wrote: > Sourceware service migration; downtime friday/weekend 28/29/30 nov > > Various sourceware.org, cygwin.com, gcc.gnu.org, dwarfstd.org, > elfutils.org and valgrind.org services will migrate to a bigger server > in a new datacenter this Friday afternoon. > > We already did a test migration and theoretically a fresh data sync to > the new datacenter should take just ~4 hours. But there are also > various DNS updates that need to be coordinated and might take some > time to propagate. So expect some service interruptions starting > Friday afternoon possibily extending into the weekend. > > Please follow https://fosstodon.org/@sourceware for updates. Prechecks look good. We did most networking and DNS changes that could be done before the big switch. We hope the migration/downtime will be limited to 16:00-20:00 UTC today (date -d "Fri 28 Nov 2025 16:00 UTC"). One thing we didn't manage to get in place is IPv6. After the migration the services will only be accessible through IPv4. We hope to get IPv6 access back at a later time. https://forge.sourceware.org will not be affected by this, so this might be an ideal time to play with it if you haven't yet. See https://gcc.gnu.org/wiki/ForgeExperiment Make sure to register with your @gcc.gnu.org/@sourceware.org account/email first though, because email and wiki will not work during the downtime. This is part of a larger effort to upgrade the Sourceware hardware, services and isolation. The Sourceware Project Leadership Committee, overseers, Software Freedom Conservancy, FSF sysadmins, Red Hat IT (https://osci.io) and OSUOSL work closely together as discussed during the last https://sourceware.org/sourceware-wiki/OpenHouse2025/ The Software Freedom Conservancy, our fiscal sponsor, is holding a fundraiser match challenge. To keep Sourceware worry-free, friendly and independent one of the best things you can do is become an SFC Sustainer https://sfconservancy.org/sustainer/ Your support currently counts double! See under "2025 in Review", "Highlights From Our Member Projects" how SFC has helped Sourceware (and many other project) this last year. https://sfconservancy.org/sustainer/#YearInReview |
|
From: Paul F. <pa...@so...> - 2025-11-28 06:46:35
|
https://sourceware.org/cgit/valgrind/commit/?id=d4d17178aba87645c41e4ed105e7c520c6ab2dec commit d4d17178aba87645c41e4ed105e7c520c6ab2dec Author: Paul Floyd <pj...@wa...> Date: Fri Nov 28 07:44:51 2025 +0100 Darwin Helgrind/DRD: change pthread lib, more filters and suppressions And turn off one test that is hanging. More to come. Diff: --- darwin17.supp | 41 ++++++++++++++++------------------------- helgrind/tests/bug484480.vgtest | 1 + include/pub_tool_redir.h | 3 ++- tests/filter_stderr_basic.in | 5 +++-- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/darwin17.supp b/darwin17.supp index c701782af8..90d99f0748 100644 --- a/darwin17.supp +++ b/darwin17.supp @@ -617,28 +617,10 @@ obj:*libdispatch.dylib* } -##{ -## OSX1013:CoreImage-1 -## Memcheck:Cond -## obj:*CoreImage.framework*CoreImage* -## obj:*CoreImage.framework*CoreImage* -## obj:*CoreImage.framework*CoreImage* -##} - -##{ -## OSX1013:strncpy-1 -## Memcheck:Cond -## fun:strncpy -## obj:*CoreServicesInternal.framework*CoreServicesInternal -## obj:*CoreServicesInternal.framework*CoreServicesInternal -##} - { OSX1013:pthread_rwlock_init Memcheck:Cond fun:pthread_rwlock_init - obj:*ImageIO.framework*ImageIO* - obj:*ImageIO.framework*ImageIO* } { @@ -756,13 +738,6 @@ fun:setenv } -# See https://bugs.kde.org/show_bug.cgi?id=196528 -{ -macos-__pthread_rwlock_init-see-our-bug-196528 -Memcheck:Cond -fun:pthread_rwlock_init -} - # macOS 10.13 mach-o loader at startup { OSX1013:map_images-1 @@ -780,6 +755,7 @@ fun:pthread_rwlock_init fun:map_images_nolock fun:map_images } + { OSX1013:map_images-3 Memcheck:Leak @@ -1127,6 +1103,20 @@ fun:pthread_rwlock_init fun:nw_path_copy_interface_with_generation_internal } + +{ + OSX1013:helgrind:rwlock_tt<false>::read() + Helgrind:Race + fun:_ZN9rwlock_ttILb0EE4readEv +} + +{ + OSX1013:helgrind:rwlock_tt<false>::write() + Helgrind:Race + fun:_ZN9rwlock_ttILb0EE5writeEv +} + + { OSX1013:drd:object_dispose drd:ConflictingAccess @@ -1160,3 +1150,4 @@ fun:pthread_rwlock_init ... fun:xpc_pipe_routine } + diff --git a/helgrind/tests/bug484480.vgtest b/helgrind/tests/bug484480.vgtest index b130a2744e..44e7c68bb8 100644 --- a/helgrind/tests/bug484480.vgtest +++ b/helgrind/tests/bug484480.vgtest @@ -1,2 +1,3 @@ +prereq: ! ../../tests/os_test darwin vgopts: -q prog: bug484480 diff --git a/include/pub_tool_redir.h b/include/pub_tool_redir.h index 043f8ac520..f2d7681087 100644 --- a/include/pub_tool_redir.h +++ b/include/pub_tool_redir.h @@ -289,7 +289,8 @@ #elif defined(VGO_freebsd) # define VG_Z_LIBPTHREAD_SONAME libthrZdsoZa // libthr.so* #elif defined(VGO_darwin) -# define VG_Z_LIBPTHREAD_SONAME libSystemZdZaZddylib // libSystem.*.dylib +//# define VG_Z_LIBPTHREAD_SONAME libSystemZdZaZddylib // libSystem.*.dylib +# define VG_Z_LIBPTHREAD_SONAME libsystemZupthreadZddylib // libSystem.*.dylib #elif defined(VGO_solaris) # define VG_Z_LIBPTHREAD_SONAME libpthreadZdsoZd1 // libpthread.so.1 #else diff --git a/tests/filter_stderr_basic.in b/tests/filter_stderr_basic.in index 8f9a0e200d..b0d37d9f1b 100644 --- a/tests/filter_stderr_basic.in +++ b/tests/filter_stderr_basic.in @@ -83,6 +83,7 @@ $SED '/warning: evaluate_Dwarf3_Expr: unhandled DW_OP_/d' | $SED '/^used_suppression:.*OSX.*dyld.*default.supp:*/d' | # Suppress Darwin running dsymutil $SED -e '/run: \/usr\/bin\/dsymutil.*/d' | -# Suppress Darwin unknown mach ports -$SED -e '/UNKNOWN Mach port modified/d' +# Suppress Darwin unknown mach ports and mach_msg +$SED -e '/UNKNOWN Mach port modified/d' | +$SED -e '/UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option/d' |