-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Darwin/ARM64: Fix throwing of synchronous memory exceptions #36625
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -842,3 +842,15 @@ end | |
| @testset "fieldtypes Module" begin | ||
| @test fieldtypes(Module) isa Tuple | ||
| end | ||
|
|
||
| # Test that read fault on a prot-none region does not incorrectly give | ||
| # ReadOnlyMemoryEror, but rather crashes the program | ||
| const MAP_ANONYMOUS_PRIVATE = Sys.isbsd() ? 0x1002 : 0x22 | ||
| let script = :(let ptr = Ptr{Cint}(ccall(:jl_mmap, Ptr{Cvoid}, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we actually guarantee this everywhere else?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think we have this logic on every platform.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It throws readonlymmoryerror on linux for example. I don't really see why it's that important to differentiate reading
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I imaging what you could do is to unmap the page before issueing the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That doesn't exercise this code path. We explicitly check that the mapping exists first.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we may just want to fix the linux behavior here to bring it in line with mac/windows. I don't see a good reason to throw ReadOnlyMemoryError here.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... Sure, that's fine. It's technically breaking but it was an error before anyway...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or it's a bug fix and brings linux in line with the other platforms ;).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Breaking" for ppl (like me) who hardly ever use julia anywhere other than linux... Not that I've ever cought any read only memory error when reading things anyway.............
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do agree the name of the exception is very suggestive of what it should do... |
||
| (Ptr{Cvoid}, Csize_t, Cint, Cint, Cint, Int), | ||
| C_NULL, 16*1024, 0, $MAP_ANONYMOUS_PRIVATE, -1, 0)); try | ||
| unsafe_load(ptr) | ||
| catch e; println(e) end; end) | ||
| @test !success(`$(Base.julia_cmd()) -e $script`) | ||
| end | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The corresponding aarch64 operation is setting
lrto zero.julia/src/signals-unix.c
Line 135 in a23a4ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And is
julia/src/signals-unix.c
Line 162 in a23a4ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I was wondering if we should set lr to NULL, but I haven't looked at the unwinder yet. I guess it can't really hurt.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it shoudn't hurt. And I think at least in one case I've seen it helps the unwinder (either ours or gdb) terminates the stack trace. (on linux...)