-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: should bad addresses panic? #7277
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
Labels
Milestone
Comments
If this is the only motivating example, then I propose to do nothing. Unsafe is, well, unsafe. If you are writing to random addresses, it can lead to arbitrary consequences, we can not reliably panic in all such cases. I second the concern about runtime corruption. Whenever we saw such crash, it was a serious corruption of runtime, continuing in such case makes no sense and dangerous. Also think of a malicious code that probes system data structures. If you want to execute untrusted code, you need to do it in a separate process. It has 1000 and 1 way to crash the process (or do something worse). Then simplest way it to start a goroutine that panics, or allocate all memory, etc, etc. |
Russ once provided another example: the pure Go linker will want try to mmap(2) the object files instead of reading and loading them to memory, but in case of IO errors or concurrent file writes, reading the mmapped the content might trigger SIGBUS (or SIGSEGV). so it's better to be able to catch them. (I'd think we categorize the SIGBUS/SIGSEGV into runtime errors and user errors, and only let the user catch the latter one. The problem is how we categorize them. |
I don't know why playground is different, I do not mind if it's changed. Regarding set of addresses, there is a 3rd set of addresses that we can not fix: http://play.golang.org/p/QrXsFggzKW But all this relates only to unsafe, which can lead to arbitrary results anyway. |
Issue closed http://golang.org/cl/66590044 |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: