Commit Graph

8 Commits

Author SHA1 Message Date
Finagolfin
4cbbb33dbf [Backtracing][Linux] Disable invoking process_vm_readv() for older Android APIs 2023-07-23 20:11:26 +05:30
Alastair Houghton
dd7acb1739 [Backtracing][Linux] Properly align the stacks.
We have two stacks that we set up during crash handling, both of
which were potentially misaligned.  This only tripped us up on
Ubuntu 20.04 on aarch64 - my guess is that maybe `clone()` aligns
the stack pointer on newer kernels which is why we didn't see it
on 22.04.

rdar://110743884
2023-06-14 13:40:51 +01:00
Alastair Houghton
7e632c0ee0 [Backtracing][Linux] Fix Ubuntu 20.04-aarch64 CI failures.
These seem to be related to signal handling issues in threads that
have been started presumably by the C library or some other library.

Primarily this appears to affect Ubuntu 20.04 on aarch64, though I
have seen sporadic issues on 18.04 as well.

We address the problem by making the thread suspension mechanism
more robust in the face of threads with masked signals.

rdar://110653167
2023-06-12 18:54:05 +01:00
Alastair Houghton
be7725f0fd [Backtracing][Linux] Include declarations for gettid() and tgkill().
Older glibc doesn't include these.  Nor does Musl, it seems.  The
previous fix put the gettid() declaration too far down the file.

rdar://110417355
2023-06-09 09:04:27 +01:00
Alastair Houghton
77de53b944 [Backtracing][Linux] Use syscall() to call gettid().
Older versions of Linux don't have gettid() in their headers, so
use syscall() to call it instead.

rdar://110417355
2023-06-07 21:24:32 +01:00
Alastair Houghton
0b9747e77a [Backtracing] Also update the Linux crash handler, now it's merged.
The Linux crash handler should have the same `output-to` behaviour
as on macOS.

rdar://110371557
2023-06-07 13:55:17 +01:00
Alastair Houghton
14fcdbd389 [Backtracing][Linux] Tidy a few things up after review.
Mike and Max made various helpful suggestions, so I've added and updated
various comments and amended the code to cope with partial reads and
writes.

rdar://110261430
2023-06-06 16:06:21 +01:00
Alastair Houghton
2dcaa6f14f [Backtracing][Linux] Add Linux crash handler to the runtime.
This also adds a function to demangle a symbol, and a way for the
backtracing code to report warning messages to the same place as
the main runtime.

I'd like to rename the _swift_isThunkFunction() SPI also, but we
can't do that until we've made the changes to the _Backtracing
library, so we'll do that there instead.

rdar://110261430
2023-06-05 15:39:50 +01:00