Skip to content

Commit 1f42845

Browse files
authored
Crashlytics AW Sigaction crash fix #6434 (#6436)
1 parent f5ce703 commit 1f42845

File tree

7 files changed

+14
-2
lines changed

7 files changed

+14
-2
lines changed

Crashlytics/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- [added] Added stackFrameWithAddress API for recording custom errors that are symbolicated on the backend (#5975).
33
- [fixed] Fixed comment typos (#6363).
44
- [fixed] Remove device information from binary image data crash info entries (#6382).
5+
- [fixed] Fixed Apple Watch crash related to sigaction (#6434).
56

67
# v4.5.0
78
- [fixed] Fixed a compiler warning and removed unused networking code (#6210).

Crashlytics/Crashlytics/Components/FIRCLSContext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ typedef struct {
5757
FIRCLSBinaryImageReadOnlyContext binaryimage;
5858
FIRCLSExceptionReadOnlyContext exception;
5959
FIRCLSHostReadOnlyContext host;
60+
#if CLS_SIGNAL_SUPPORTED
6061
FIRCLSSignalReadContext signal;
62+
#endif
6163
#if CLS_MACH_EXCEPTION_SUPPORTED
6264
FIRCLSMachExceptionReadContext machException;
6365
#endif

Crashlytics/Crashlytics/Components/FIRCLSContext.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,14 @@ bool FIRCLSContextInitialize(FIRCLSInternalReport* report,
196196
});
197197

198198
if (!_firclsContext.readonly->debuggerAttached) {
199+
#if CLS_SIGNAL_SUPPORTED
199200
dispatch_group_async(group, queue, ^{
200201
_firclsContext.readonly->signal.path =
201202
FIRCLSContextAppendToRoot(rootPath, FIRCLSReportSignalFile);
202203

203204
FIRCLSSignalInitialize(&_firclsContext.readonly->signal);
204205
});
206+
#endif
205207

206208
#if CLS_MACH_EXCEPTION_SUPPORTED
207209
dispatch_group_async(group, queue, ^{

Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,9 @@ - (void)crashReportingSetupCompleted:(FIRCLSProfileMark)mark {
507507
// check our handlers
508508
FIRCLSDispatchAfter(2.0, dispatch_get_main_queue(), ^{
509509
FIRCLSExceptionCheckHandlers((__bridge void *)(self));
510+
#if CLS_SIGNAL_SUPPORTED
510511
FIRCLSSignalCheckHandlers();
512+
#endif
511513
#if CLS_MACH_EXCEPTION_SUPPORTED
512514
FIRCLSMachExceptionCheckHandlers();
513515
#endif

Crashlytics/Crashlytics/Handlers/FIRCLSSignal.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <dlfcn.h>
2121
#include <stdlib.h>
2222

23+
#if CLS_SIGNAL_SUPPORTED
2324
static const int FIRCLSFatalSignals[FIRCLSSignalCount] = {SIGABRT, SIGBUS, SIGFPE, SIGILL,
2425
SIGSEGV, SIGSYS, SIGTRAP};
2526

@@ -316,3 +317,4 @@ static void FIRCLSSignalHandler(int signal, siginfo_t *info, void *uapVoid) {
316317
// restore errno
317318
errno = savedErrno;
318319
}
320+
#endif

Crashlytics/Crashlytics/Handlers/FIRCLSSignal.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#include <signal.h>
2121
#include <stdbool.h>
2222

23-
#define FIRCLSSignalCount (7)
24-
2523
// per man sigaltstack, MINSIGSTKSZ is the minimum *overhead* needed to support
2624
// a signal stack. The actual stack size must be larger. Let's pick the recommended
2725
// size.
@@ -31,6 +29,9 @@
3129
#define CLS_SIGNAL_HANDLER_STACK_SIZE 0
3230
#endif
3331

32+
#if CLS_SIGNAL_SUPPORTED
33+
#define FIRCLSSignalCount (7)
34+
3435
typedef struct {
3536
const char* path;
3637
struct sigaction originalActions[FIRCLSSignalCount];
@@ -49,3 +50,4 @@ bool FIRCLSSignalSafeInstallPreexistingHandlers(FIRCLSSignalReadContext* roConte
4950
void FIRCLSSignalNameLookup(int number, int code, const char** name, const char** codeName);
5051

5152
void FIRCLSSignalEnumerateHandledSignals(void (^block)(int idx, int signal));
53+
#endif

Crashlytics/Crashlytics/Helpers/FIRCLSFeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define CLS_USE_SIGALTSTACK (!TARGET_OS_WATCH && !TARGET_OS_TV)
2424
#define CLS_CAN_SUSPEND_THREADS !TARGET_OS_WATCH
2525
#define CLS_MACH_EXCEPTION_SUPPORTED (!TARGET_OS_WATCH && !TARGET_OS_TV)
26+
#define CLS_SIGNAL_SUPPORTED !TARGET_OS_WATCH // As of WatchOS 3, Signal crashes are not supported
2627

2728
#define CLS_COMPACT_UNWINDING_SUPPORTED \
2829
((CLS_CPU_I386 || CLS_CPU_X86_64 || CLS_CPU_ARM64) && CLS_COMPACT_UNWINDED_ENABLED)

0 commit comments

Comments
 (0)