Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential deadlock in bsg_kscrw_i_writeThread() #1453

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

nickdowell
Copy link
Contributor

@nickdowell nickdowell commented Aug 9, 2022

Goal

Fix a potential deadlock when capturing the crashed thread's name - see #1406

Design

bsg_ksmachgetThreadName() uses pthread_from_mach_thread_np() which acquires a lock and is therefore unsafe to call from a crash handler.

Changeset

Replaces use of bsg_ksmachgetThreadName() with pthread_getname_np(pthread_self(), ...) to avoid potential deadlock.

Testing

Thread name capture is verified for C++ exceptions and NSExceptions since #1406

@github-actions
Copy link

github-actions bot commented Aug 9, 2022

Bugsnag.framework binary size increased by 56 bytes from 771,640 to 771,696

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +32  +0.0%     +32    __TEXT,__text
  +0.6%     +24  +0.6%     +24    Lazy Binding Info
  +0.0%     +16  +0.0%     +16    Symbol Table
  +0.6%     +12  +0.6%     +12    __TEXT,__stub_helper
  +0.6%     +12  +0.6%     +12    __TEXT,__stubs
  +0.5%      +8  +0.5%      +8    Indirect Symbol Table
  +0.0%      +8  +0.0%      +8    String Table
  +0.6%      +8  +0.6%      +8    __DATA,__la_symbol_ptr
  -0.1%      -8  -0.4%      -8    [__DATA]
  [ = ]       0  -0.4%     -56    [__LINKEDIT]
  -0.4%     -56  -0.4%     -56    [__TEXT]
  +0.0%     +56  [ = ]       0    TOTAL

Generated by 🚫 Danger

@nickdowell nickdowell requested a review from kattrali August 9, 2022 12:57
@nickdowell nickdowell merged commit be72b8d into next Aug 9, 2022
@nickdowell nickdowell deleted the nickdowell/fix-crashing-thread-name branch August 9, 2022 14:06
@nickdowell nickdowell mentioned this pull request Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants