-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Print address on SIGSEGV #66809
Comments
Also useful for aligned simd operations on unaligned address. |
To my knowledge, this is basically impossible? I believe it might be possible for us to install a signal handler on SIGSEGV and try and determine the incorrect dereference, but that seems... way too hard for Rust itself to do, nor something that we should do given our constraints. |
I was working on a library to make something like this slightly more manageable, but didn't finish it. It is indeed a lot of work that is both operating system and architecture specific. It is technically possible though. |
On linux |
To be clear, I meant "not really feasible for libstd to do" -- I think presumably this would be a good fit for a library outside std? I don't think there's anything in particular that ties this to std, and I'm basically arguing for "this does not belong in std" |
There is already a // signum can be SIGSEGV or SIGBUS
rtprint!("signal {} for address 0x{:x}", signum, addr); Before
|
My personal opinion is that we’ve made a mistake by not removing that handler[1] along with the rest of the morestack runtime before 1.0 cut and I would rather not see us commit another by adding more dubious functionality to it. [1]: It is very much a best effort kind of thing and leads to invalid expectations. And also one of the few places where we fail to adhere to our “0-cost abstraction” goal. |
It is just a heuristic, but without it I suspect we'd get a lot more bugs decrying segmentation faults in memory safe Rust. It's a better perspective to have diagnosed a stack overflow up front, even if we do so imperfectly. |
It can be useful while debugging to find out if it is a null pointer /
NonNull::dangling()
pointer, or if it points just enough past the stack guard to not be detected as stack overflow.It would also be useful to print if the access was a read, write or execution.
The text was updated successfully, but these errors were encountered: