diff --git a/compat/mac/AvailabilityVersions.h b/compat/mac/AvailabilityVersions.h index 0bedb3d2..b9bb74ec 100644 --- a/compat/mac/AvailabilityVersions.h +++ b/compat/mac/AvailabilityVersions.h @@ -87,4 +87,10 @@ #define __MAC_11_0 110000 #endif +// 12.0 SDK + +#ifndef __MAC_12_0 +#define __MAC_12_0 120000 +#endif + #endif // CRASHPAD_COMPAT_MAC_AVAILABILITYVERSIONS_H_ diff --git a/snapshot/mac/process_types/custom.cc b/snapshot/mac/process_types/custom.cc index d80a984b..06c13001 100644 --- a/snapshot/mac/process_types/custom.cc +++ b/snapshot/mac/process_types/custom.cc @@ -147,6 +147,7 @@ size_t dyld_all_image_infos::ExpectedSizeForVersion( std::numeric_limits::max(), // 15, see below offsetof(dyld_all_image_infos, end_v16), // 16 sizeof(dyld_all_image_infos), // 17 + sizeof(dyld_all_image_infos), // 18 }; if (version >= base::size(kSizeForVersion)) { diff --git a/snapshot/mac/process_types/dyld_images.proctype b/snapshot/mac/process_types/dyld_images.proctype index 589ad097..5c57a26f 100644 --- a/snapshot/mac/process_types/dyld_images.proctype +++ b/snapshot/mac/process_types/dyld_images.proctype @@ -127,12 +127,16 @@ PROCESS_TYPE_STRUCT_BEGIN(dyld_all_image_infos) // preceding the padding in the 32-bit structure that would natively be // addressed at index 4 of |reserved|. Treat reserved_4_32 as only available // in version 16 of the structure. + // In the 12.0 SDK, 2 of the trailing UIntPtrs on 64-bit and + // 4 of them on 32-bit were replaced by two uint64_ts. On 32-bit, that + // awkwardly straddles end_v14. Since macOS 12.0 is 64-bit only, the proctype + // version of this struct only has these uint64_ts in the 64-bit version. PROCESS_TYPE_STRUCT_MEMBER(UIntPtr, reserved, [4]) PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_4_64) PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_5) PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_6) - PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_7) - PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_8) + PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, shared_cache_fs_id) + PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, shared_cache_fs_obj_id) PROCESS_TYPE_STRUCT_MEMBER(Nothing, end_v14) PROCESS_TYPE_STRUCT_MEMBER(Reserved32_32Only, reserved_4_32) diff --git a/snapshot/mac/process_types_test.cc b/snapshot/mac/process_types_test.cc index e0c3c9cb..90f5c1f6 100644 --- a/snapshot/mac/process_types_test.cc +++ b/snapshot/mac/process_types_test.cc @@ -356,8 +356,16 @@ TEST(ProcessTypes, DyldImagesSelf) { self_image_infos->reserved[4]); EXPECT_EQ(proctype_image_infos.reserved_5, self_image_infos->reserved[5]); EXPECT_EQ(proctype_image_infos.reserved_6, self_image_infos->reserved[6]); - EXPECT_EQ(proctype_image_infos.reserved_7, self_image_infos->reserved[7]); - EXPECT_EQ(proctype_image_infos.reserved_8, self_image_infos->reserved[8]); +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_12_0 + uint64_t shared_cache_fs_id = self_image_infos->sharedCacheFSID; + uint64_t shared_cache_fs_obj_id = self_image_infos->sharedCacheFSObjID; +#else + uint64_t shared_cache_fs_id = self_image_infos->reserved[7]; + uint64_t shared_cache_fs_obj_id = self_image_infos->reserved[8]; +#endif + EXPECT_EQ(proctype_image_infos.shared_cache_fs_id, shared_cache_fs_id); + EXPECT_EQ(proctype_image_infos.shared_cache_fs_obj_id, + shared_cache_fs_obj_id); #endif } #endif