Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
07724c6
transferring to linux test machine
supervacuus Aug 5, 2024
752b125
clean up formatting
supervacuus Aug 5, 2024
b38d0e6
fix build
supervacuus Aug 5, 2024
b41ed01
reintroduce #ifdef symmetry regarding the usage of the handler_strate…
supervacuus Aug 5, 2024
4f57a0e
const options param in the handler_strategy getter
supervacuus Aug 5, 2024
09020db
ensure we "leave" the signal-handler when we invoke the CLR/Mono runt…
supervacuus Aug 5, 2024
fee764e
ensure the page_allocator is only enabled when we have an actual nati…
supervacuus Nov 12, 2024
1a8626d
continuing the signal chain at the end is something we want for both …
supervacuus Nov 12, 2024
eb12874
get rid of obsolete local var
supervacuus Nov 12, 2024
b08d939
add trace logs to at-start chaining, so we can see the behavior in th…
supervacuus Nov 12, 2024
2841e64
ensure page-allocator is only referenced on UNIXes
supervacuus Nov 12, 2024
799743f
add integration test for managed and native crash
supervacuus Nov 14, 2024
0aac4e9
ignore 32-bit Linux build in the integration test
supervacuus Nov 14, 2024
fbe9818
remove native sdk logging assert temporarily
supervacuus Nov 14, 2024
0403d18
fix pytest skip for x86
supervacuus Nov 14, 2024
4231642
inverted demorgan
supervacuus Nov 14, 2024
f926707
extract skip_condition to check what provokes the invalid syntax
supervacuus Nov 14, 2024
6e65b62
re-enable log check, since we know it is not about log flushing but d…
supervacuus Nov 15, 2024
67de245
clean up sigaltstack initialization
supervacuus Nov 15, 2024
bc47fcf
clean up run assertion on output, so we can actually see what's happe…
supervacuus Nov 15, 2024
84c94df
create a non-faulty `sigaltstack` for the GHA runner
supervacuus Nov 15, 2024
c735270
disable the test on ASAN runs since that would require an instrumente…
supervacuus Nov 15, 2024
ca5e83a
Add changelog.
supervacuus Nov 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ensure the page_allocator is only enabled when we have an actual nati…
…ve crash, we don't allocate before
  • Loading branch information
supervacuus committed Nov 15, 2024
commit fee764e4a427f9909cf668ef37d9165ec691906f
27 changes: 10 additions & 17 deletions src/backends/sentry_backend_inproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,45 +533,38 @@ handle_ucontext(const sentry_ucontext_t *uctx)
}

#ifdef SENTRY_PLATFORM_UNIX
// give us an allocator we can use safely in signals before we tear down.
// TODO: for `SENTRY_HANDLER_STRATEGY_CHAIN_AT_START` to work together with
// our page allocator we must find a way to maintain memory usage.
// We might be able to move this "enable" far enough down, because I
// think we do not allocate before we hit `make_signal_event()`.
sentry__page_allocator_enable();

// inform the sentry_sync system that we're in a signal handler. This will
// make mutexes spin on a spinlock instead as it's no longer safe to use a
// pthread mutex.
sentry__enter_signal_handler();
#endif

#ifdef SENTRY_PLATFORM_UNIX
sentry_handler_strategy_t handler_strategy
= SENTRY_HANDLER_STRATEGY_DEFAULT;
#endif

SENTRY_WITH_OPTIONS (options) {
#ifdef SENTRY_PLATFORM_LINUX
handler_strategy = sentry_options_get_handler_strategy(options);

// CLR/Mono convert signals provoked by "managed" native code into
// managed code exceptions. In these cases, we shouldn't react to
// the signal at all and let their handler discontinue the signal
// chain by invoking the runtime handler before we process the signal.
// On Linux (and thus Android) CLR/Mono converts signals provoked by
// AOT/JIT-generated native code into managed code exceptions. In these
// cases, we shouldn't react to the signal at all and let their handler
// discontinue the signal chain by invoking the runtime handler before
// we process the signal.
if (handler_strategy == SENTRY_HANDLER_STRATEGY_CHAIN_AT_START) {
// there is a good chance that we won't return from the previous
// handler and that would mean we couldn't enter this handler with
// the next signal coming in if we didn't "leave" here.
sentry__leave_signal_handler();

// invoke the previous handler (typically the CLR/Mono
// signal-to-managed-exception handler)
invoke_signal_handler(
uctx->signum, uctx->siginfo, (void *)uctx->user_context);

// let's re-enter because it means this was an actual native crash
sentry__enter_signal_handler();
}
#endif
// use a signal-safe allocator before we tear down.
sentry__page_allocator_enable();

sentry_value_t event = make_signal_event(sig_slot, uctx);
bool should_handle = true;
Expand All @@ -587,7 +580,7 @@ handle_ucontext(const sentry_ucontext_t *uctx)
sentry_envelope_t *envelope = sentry__prepare_event(
options, event, NULL, !options->on_crash_func);
// TODO(tracing): Revisit when investigating transaction flushing
// during hard crashes.
// during hard crashes.

sentry_session_t *session = sentry__end_current_session_with_status(
SENTRY_SESSION_STATUS_CRASHED);
Expand Down