Skip to content

don't try to catch forced unwinds - #166662

Open
joboet wants to merge 1 commit into
rust-lang:mainfrom
joboet:catch_forced_unwind
Open

joboet wants to merge 1 commit into
rust-lang:mainfrom
joboet:catch_forced_unwind

Conversation

@joboet

@joboet joboet commented Nov 27, 2026

Copy link
Copy Markdown
Member

On GNU/Linux, some functions, notably pthread_exit, result in a forced unwind. This PR does not take a stance as to the situations in which this is allowable – which is an unresolved question in rust-lang/rfcs#2945 –, but aims to avoid a case of guaranteed undefined behaviour. As explained in the code added here, the Itanium ABI forbids catching forced unwinds, but since catch_unwind is not aware of the unwind type it will try to do so anyway, resulting in a cryptic error message like "FATAL: exception not rethrown" at best or undefined behaviour at worst. We can do better by aborting ourselves instead, providing a more helpful message in the process.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 27, 2026
@rustbot

rustbot commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

r? @fee1-dead

rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 79 candidates
  • Random selection from 21 candidates

@joboet joboet added A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows F-c_unwind `#![feature(c_unwind)]` labels Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows F-c_unwind `#![feature(c_unwind)]` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants