{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/6877","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/6877/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/6877/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/6877/events","html_url":"https://github.com/JuliaLang/julia/pull/6877","id":33752097,"number":6877,"title":"RFC: catch writes to protected memory in mmapped arrays (fix #3434)","user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2014-05-18T13:54:50Z","updated_at":"2015-06-13T00:40:35Z","closed_at":"2014-07-23T23:31:17Z","pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/6877","html_url":"https://github.com/JuliaLang/julia/pull/6877","diff_url":"https://github.com/JuliaLang/julia/pull/6877.diff","patch_url":"https://github.com/JuliaLang/julia/pull/6877.patch"},"body":"Starting from the example in #6703,\r\n```\r\njulia> s = open(\"/tmp/a.bin\", \"r\")\r\nIOStream(<file /tmp/a.bin>)\r\n\r\njulia> m = mmap_array(Float64, (10,1), s)\r\n10x1 Array{Float64,2}:\r\n 0.751866\r\n 0.832087\r\n 0.239773\r\n 0.120287\r\n 0.867469\r\n 0.957427\r\n 0.941344\r\n 0.642588\r\n 0.56932 \r\n 0.464532\r\n\r\njulia> m[3] = 2.0\r\nERROR: MemoryError()\r\n in setindex! at array.jl:305\r\n\r\njulia> m = 5\r\n5\r\n\r\njulia> gc()\r\n\r\n```\r\nIf desired I'd be happy to change the error message to something more descriptive (e.g., `\"Memory-access error. Did you try to set the value of a read-only mmapped array?\"`). I seem to remember some discussion about problems that can arise from more verbose error messages, which is why I started with something minimal.\r\n\r\nSummary of design: store begin/end pointers of blocks of memory that are write-protected; if you get a SIGSEGV, check the address to see if it falls within one of these protected pages. If it doesn't, use the default SIGSEGV handling.\r\n\r\nI can't test this on Windows or OSX (and IIUC the AppVeyor testing is still not finished?), but there's relatively little of this that's OS-specific.\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/111648068","html_url":"https://github.com/JuliaLang/julia/pull/6877#issuecomment-111648068","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/6877","id":111648068,"user":{"login":"yuyichao","id":712232,"avatar_url":"https://avatars.githubusercontent.com/u/712232?v=3","gravatar_id":"","url":"https://api.github.com/users/yuyichao","html_url":"https://github.com/yuyichao","followers_url":"https://api.github.com/users/yuyichao/followers","following_url":"https://api.github.com/users/yuyichao/following{/other_user}","gists_url":"https://api.github.com/users/yuyichao/gists{/gist_id}","starred_url":"https://api.github.com/users/yuyichao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuyichao/subscriptions","organizations_url":"https://api.github.com/users/yuyichao/orgs","repos_url":"https://api.github.com/users/yuyichao/repos","events_url":"https://api.github.com/users/yuyichao/events{/privacy}","received_events_url":"https://api.github.com/users/yuyichao/received_events","type":"User","site_admin":false},"created_at":"2015-06-13T00:40:35Z","updated_at":"2015-06-13T00:40:35Z","body":"Or 3b36d857eb2848d8480b82e0f00df7965de233f1"}}