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

handle diverging functions forwarding their return place #66827

Merged
merged 2 commits into from Dec 2, 2019

Conversation

@RalfJung
Copy link
Member

RalfJung commented Nov 27, 2019

Fixes rust-lang/miri#1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places.

This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine.

r? @oli-obk

// (even a ZST read/write) needs to error, so let us make this
// a NULL place.
//
// FIXME: Ideally we'd make sure that the place projections also

This comment has been minimized.

Copy link
@oli-obk

oli-obk Nov 28, 2019

Contributor

Like just doing a place projection on a null place should error?

This comment has been minimized.

Copy link
@RalfJung

RalfJung Nov 28, 2019

Author Member

Place projections should have inbounds rules, basically. We have an implementation of that in Miri, and these days I am actually not ashamed of it any more. ;)

But I am worried about the perf impact of this and I think it is currently actually impossible to violate the inbounds requirement, so I didn't bother working on moving that into the core engine.

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Nov 28, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 28, 2019

📌 Commit 2869aba has been approved by oli-obk

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 30, 2019

⌛️ Testing commit 2869aba with merge d703ed8...

bors added a commit that referenced this pull request Nov 30, 2019
handle diverging functions forwarding their return place

Fixes rust-lang/miri#1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places.

This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine.

r? @oli-obk
@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Nov 30, 2019

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-11-30T01:34:15.0576988Z CommonProgramW6432=C:\Program Files\Common Files
2019-11-30T01:34:15.0577071Z DEPLOY_BUCKET=rust-lang-ci2
2019-11-30T01:34:15.0577190Z ENDPOINT_URL_SYSTEMVSSCONNECTION=https://dev.azure.com/rust-lang/
2019-11-30T01:34:15.0577288Z EXEPATH=C:\Program Files\Git\bin
2019-11-30T01:34:15.0577447Z Fixes https://github.com/rust-lang/miri/issues/1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places.
2019-11-30T01:34:15.0577665Z GIT_TERMINAL_PROMPT=0
2019-11-30T01:34:15.0577725Z GOROOT=C:\Go1.12.7
2019-11-30T01:34:15.0577804Z GOROOT_1_10_X64=C:\Go1.10.8
2019-11-30T01:34:15.0577884Z GOROOT_1_11_X64=C:\Go1.11.12
---
2019-11-30T01:34:15.0591330Z TMP=/tmp
2019-11-30T01:34:15.0591419Z TOOLSTATE_ISSUES_API_URL=https://api.github.com/repos/rust-lang/rust/issues
2019-11-30T01:34:15.0591520Z TOOLSTATE_PUBLISH=1
2019-11-30T01:34:15.0591605Z TOOLSTATE_REPO=https://github.com/rust-lang-nursery/rust-toolstate
2019-11-30T01:34:15.0591914Z This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine.
2019-11-30T01:34:15.0592093Z USERDOMAIN=fv-az433
2019-11-30T01:34:15.0592168Z USERDOMAIN_ROAMINGPROFILE=fv-az433
2019-11-30T01:34:15.0592665Z USERNAME=VssAdministrator
2019-11-30T01:34:15.0592765Z USERPROFILE=C:\Users\VssAdministrator
---
2019-11-30T01:35:54.3969710Z Chocolatey installed 0/1 packages. 1 packages failed.
2019-11-30T01:35:54.3970153Z  See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2019-11-30T01:35:54.3973473Z 
2019-11-30T01:35:54.3977648Z Failures
2019-11-30T01:35:54.3986072Z  - msys2 (exited 1) - msys2 not installed. An error occurred during installation:
2019-11-30T01:35:54.3986608Z  The remote server returned an error: (503) Server Unavailable. Service Unavailable
2019-11-30T01:35:54.9088106Z 
2019-11-30T01:35:54.9176059Z ##[error]Bash exited with code '1'.
2019-11-30T01:35:54.9343444Z ##[section]Starting: Checkout
2019-11-30T01:35:54.9459800Z ==============================================================================
2019-11-30T01:35:54.9460058Z Task         : Get sources
2019-11-30T01:35:54.9460159Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 30, 2019

💔 Test failed - checks-azure

@RalfJung

This comment has been minimized.

Copy link
Member Author

RalfJung commented Nov 30, 2019

Chocolatey was down. @bors retry

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 30, 2019

⌛️ Testing commit 2869aba with merge 1041db3...

bors added a commit that referenced this pull request Nov 30, 2019
handle diverging functions forwarding their return place

Fixes rust-lang/miri#1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places.

This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine.

r? @oli-obk
@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Nov 30, 2019

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-11-30T07:44:33.3612930Z CommonProgramW6432=C:\Program Files\Common Files
2019-11-30T07:44:33.3612986Z DEPLOY_BUCKET=rust-lang-ci2
2019-11-30T07:44:33.3613071Z ENDPOINT_URL_SYSTEMVSSCONNECTION=https://dev.azure.com/rust-lang/
2019-11-30T07:44:33.3613132Z EXEPATH=C:\Program Files\Git\bin
2019-11-30T07:44:33.3613267Z Fixes https://github.com/rust-lang/miri/issues/1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places.
2019-11-30T07:44:33.3613452Z GIT_TERMINAL_PROMPT=0
2019-11-30T07:44:33.3613519Z GOROOT=C:\Go1.12.7
2019-11-30T07:44:33.3613569Z GOROOT_1_10_X64=C:\Go1.10.8
2019-11-30T07:44:33.3613639Z GOROOT_1_11_X64=C:\Go1.11.12
---
2019-11-30T07:44:33.3622949Z TMP=/tmp
2019-11-30T07:44:33.3623029Z TOOLSTATE_ISSUES_API_URL=https://api.github.com/repos/rust-lang/rust/issues
2019-11-30T07:44:33.3623091Z TOOLSTATE_PUBLISH=1
2019-11-30T07:44:33.3623170Z TOOLSTATE_REPO=https://github.com/rust-lang-nursery/rust-toolstate
2019-11-30T07:44:33.3623270Z This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine.
2019-11-30T07:44:33.3623482Z USERDOMAIN=fv-az379
2019-11-30T07:44:33.3623562Z USERDOMAIN_ROAMINGPROFILE=fv-az379
2019-11-30T07:44:33.3623632Z USERNAME=VssAdministrator
2019-11-30T07:44:33.3623685Z USERPROFILE=C:\Users\VssAdministrator
---
2019-11-30T07:46:03.4942196Z Chocolatey installed 0/1 packages. 1 packages failed.
2019-11-30T07:46:03.4942316Z  See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2019-11-30T07:46:03.4947236Z 
2019-11-30T07:46:03.4952654Z Failures
2019-11-30T07:46:03.4959678Z  - msys2 (exited 1) - msys2 not installed. An error occurred during installation:
2019-11-30T07:46:03.4959800Z  The remote server returned an error: (503) Server Unavailable. Service Unavailable
2019-11-30T07:46:03.4976941Z Enjoy using Chocolatey? Explore more amazing features to take your
2019-11-30T07:46:03.4977050Z experience to the next level at
2019-11-30T07:46:03.4977125Z  https://chocolatey.org/compare
2019-11-30T07:46:04.0036096Z 
2019-11-30T07:46:04.0036096Z 
2019-11-30T07:46:04.0125540Z ##[error]Bash exited with code '1'.
2019-11-30T07:46:04.0245951Z ##[section]Starting: Checkout
2019-11-30T07:46:04.0339308Z ==============================================================================
2019-11-30T07:46:04.0339390Z Task         : Get sources
2019-11-30T07:46:04.0339460Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 30, 2019

💔 Test failed - checks-azure

@Centril

This comment has been minimized.

Copy link
Member

Centril commented Nov 30, 2019

@bors retry spurious

Centril added a commit to Centril/rust that referenced this pull request Dec 1, 2019
…oli-obk

handle diverging functions forwarding their return place

Fixes rust-lang/miri#1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places.

This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine.

r? @oli-obk
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
bors added a commit that referenced this pull request Dec 1, 2019
Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66828 (Less minification)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)

Failed merges:

 - #66874 (Miri engine: proper support for `Assert` MIR terminators)

r? @ghost
RalfJung added a commit to RalfJung/rust that referenced this pull request Dec 2, 2019
…oli-obk

handle diverging functions forwarding their return place

Fixes rust-lang/miri#1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places.

This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine.

r? @oli-obk
RalfJung added a commit to RalfJung/rust that referenced this pull request Dec 2, 2019
…oli-obk

handle diverging functions forwarding their return place

Fixes rust-lang/miri#1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places.

This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine.

r? @oli-obk
bors added a commit that referenced this pull request Dec 2, 2019
Rollup of 5 pull requests

Successful merges:

 - #65947 (rustc: split FnAbi's into definitions/direct calls ("of_instance") and indirect calls ("of_fn_ptr").)
 - #66245 (Conditional compilation for sanitizers)
 - #66827 (handle diverging functions forwarding their return place)
 - #66834 (rustbuild fixes)
 - #66911 (rustc_mir: use nicer path printing for #[rustc_regions] NLL tests.)

Failed merges:

 - #66822 (libunwind_panic: adjust miri panic hack)

r? @ghost
RalfJung added a commit to RalfJung/rust that referenced this pull request Dec 2, 2019
…oli-obk

handle diverging functions forwarding their return place

Fixes rust-lang/miri#1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places.

This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine.

r? @oli-obk
bors added a commit that referenced this pull request Dec 2, 2019
Rollup of 5 pull requests

Successful merges:

 - #66245 (Conditional compilation for sanitizers)
 - #66654 (Handle const-checks for `&mut` outside of `HasMutInterior`)
 - #66822 (libunwind_panic: adjust miri panic hack)
 - #66827 (handle diverging functions forwarding their return place)
 - #66834 (rustbuild fixes)

Failed merges:

r? @ghost
@bors bors merged commit 2869aba into rust-lang:master Dec 2, 2019
4 of 5 checks passed
4 of 5 checks passed
homu Test failed
Details
pr #20191127.57 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
bors added a commit to rust-lang/miri that referenced this pull request Dec 2, 2019
Test diverging closure coercion

Adds a test for #1075. Depends on rust-lang/rust#66827.
@RalfJung RalfJung deleted the RalfJung:miri-missing-ret-place branch Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.