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

Use __fastfail in libpanic_abort on Windows #73215

Closed
rylev opened this issue Jun 10, 2020 · 3 comments · Fixed by #75364 or #75990
Closed

Use __fastfail in libpanic_abort on Windows #73215

rylev opened this issue Jun 10, 2020 · 3 comments · Fixed by #75364 or #75990
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows Operating system: Windows T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@rylev
Copy link
Member

rylev commented Jun 10, 2020

libpanic_abort currently uses Rust's abort intrinsic for aborts (which uses an illegal opcode to abort the process). This directly contrasts with libstd which uses inline assembly to call into Windows __failfail intrinsic. This is preferred because __fastfail allows for debuggers to attach after the process has aborted for debugging.

Perhaps we should use the same abort implementation used in libstd for libpanic_abort.

Drawbacks

Before Windows 8 __fastfail wasn't available and so calling into it on this platforms leads to an access violation. Access violations are not catchable by normal exception handlers but are catchable by [SEH}(https://docs.microsoft.com/en-us/windows/win32/debug/structured-exception-handling)

@jonas-schievink jonas-schievink added A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs Relevant to the library team, which will review and decide on the PR/issue. O-windows Operating system: Windows labels Jun 10, 2020
@retep998
Copy link
Member

The current method of using intrinsics::abort is also an exception that can be caught by SEH. Therefore on platforms before Windows 8 __fastfail is no worse than intrinsics::abort, but on newer platforms it will ensure the process fails fast.

@rylev
Copy link
Member Author

rylev commented Aug 10, 2020

I'm going to open a PR for this which should hopefully push the discussion along.

@rylev
Copy link
Member Author

rylev commented Aug 25, 2020

@alexcrichton, can we reopen this issue so we can use it to track ARM support?

@alexcrichton alexcrichton reopened this Aug 25, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Aug 29, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Aug 29, 2020
@bors bors closed this as completed in 96e0bc7 Aug 30, 2020
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 C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows Operating system: Windows T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
4 participants