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

[PLAT-6948] Fix crash in bsg_ksmachgetThreadQueueName #1147

Merged
merged 1 commit into from
Jul 6, 2021

Conversation

nickdowell
Copy link
Contributor

Goal

Fix a crash in dispatch_queue_get_label which appears to be due to an invalid dispatch_queue.

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000100000048
Exception Note:        EXC_CORPSE_NOTIFYVM

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libdispatch.dylib             0x0000000189abad00 dispatch_queue_get_label + 4
1   com.bugsnag.Bugsnag           0x0000000107e154ac bsg_ksmachgetThreadQueueName+ 324 (BSG_KSMach.c:324)
2   com.bugsnag.Bugsnag           0x0000000107e053e0 -[BugsnagThread initWithMachThread:backtraceAddresses:backtraceLength:errorReportingThread:index:] + 208 (BugsnagThread.m:326)

Changeset

The dispatch_queue is now probed to check that it points to a valid memory address before calling dispatch_queue_get_label.

Testing

Was not able to reproduce the crash.

Unit tests and E2E tests verify that bsg_ksmachgetThreadQueueName returns the expected name.

@nickdowell nickdowell requested review from kstenerud and kattrali July 6, 2021 09:40
@github-actions
Copy link

github-actions bot commented Jul 6, 2021

Infer: No issues found 🎉

OCLint: No issues found 🎉

Bugsnag.framework binary size did not change - 1,134,024 bytes

Generated by 🚫 Danger

@nickdowell nickdowell merged commit 46626a5 into next Jul 6, 2021
@nickdowell nickdowell deleted the nickdowell/fix-thread-name-crash branch July 6, 2021 15:09
@nickdowell nickdowell mentioned this pull request Jul 7, 2021
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