Skip to content

System libraries (e.g libSystem.B.dylib) are missing from the modules list on macOS #41

@sfackler

Description

@sfackler

It looks like system libraries are not present in minidumps I generate on macOS. As test case, I ran the diskwriter example from the minidumper crate, and then examined its output with minidump-stackwalk --dump:

...

MinidumpModuleList
  module_count = 1

module[0]
MINIDUMP_MODULE
  base_of_image                   = 0x100924000
  size_of_image                   = 0xd8000
  checksum                        = 0x0
  time_date_stamp                 = 0x0 1970-01-01T00:00:00Z
  module_name_rva                 = 0x244e
  version_info.signature          = 0x0
  version_info.struct_version     = 0x0
  version_info.file_version       = 0x0:0x0
  version_info.product_version    = 0x0:0x0
  version_info.file_flags_mask    = 0x0
  version_info.file_flags         = 0x0
  version_info.file_os            = 0x0
  version_info.file_type          = 0x0
  version_info.file_subtype       = 0x0
  version_info.file_date          = 0x0:0x0
  cv_record.data_size             = 34
  cv_record.rva                   = 0x24d8
  misc_record.data_size           = 0
  misc_record.rva                 = 0x0
  (code_file)                     = "/Users/sfackler/code/crash-handling/target/debug/examples/diskwrite"
  (code_identifier)               = "fddd3fdfe88a3bc9aab0a7837ce1e896"
  (cv_record).cv_signature        = 0x53445352
  (cv_record).signature           = fddd3fdf-e88a-3bc9-aab0-a7837ce1e896
  (cv_record).age                 = 0
  (cv_record).pdb_file_name       = "diskwrite"
  (misc_record)                   = (null)
  (debug_file)                    = "diskwrite"
  (debug_identifier)              = "fddd3fdf-e88a-3bc9-aab0-a7837ce1e896"
  (version)                       = ""

...

However, otool -L shows several other libraries linked to it, which I would expect to be present:

../../crash-handling/target/debug/examples/diskwrite:
        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
        /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)

Concretely, this prevents stack walking from handling frames inside of libSystem properly.

This may be related to some linker shenanigans starting on Big Sur:

New in macOS Big Sur 11.0.1, the system ships with a built-in dynamic linker cache of all system-provided libraries. As part of this change, copies of dynamic libraries are no longer present on the filesystem. Code that attempts to check for dynamic library presence by looking for a file at a path or enumerating a directory will fail. Instead, check for library presence by attempting to dlopen() the path, which will correctly check for the library in the cache. (62986286)

https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release-notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions