Skip to content

Allow testing pointers for inboundedness while forbidding dangling pointers #56985

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Dec 24, 2018

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Dec 19, 2018

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 19, 2018
}
InboundsCheck::MaybeDead => self.get_size_and_align(ptr.alloc_id),
};
ptr.check_in_alloc(allocation_size, liveness)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is check_in_alloc still used anywhere else? Might be worth to inline it here, because it clearly has a confusing API.

ptr.check_in_alloc(allocation_size, InboundsCheck::MaybeDead)?;
let (allocation_size, align) = match liveness {
InboundsCheck::Live => {
let alloc = self.get(ptr.alloc_id)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this error on function pointers?

@RalfJung
Copy link
Member

Still not a fan of check_in_alloc, but the fix would likely be to make the error message more informative in general (taking an &str or so), which is a separate problem.

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 23, 2018

📌 Commit c8bcac5 has been approved by RalfJung

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 23, 2018
@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 23, 2018

Can you formulate your unhappiness with check_in_alloc into an E-mentor issue?

Centril added a commit to Centril/rust that referenced this pull request Dec 24, 2018
Allow testing pointers for inboundedness while forbidding dangling pointers

r? @RalfJung
bors added a commit that referenced this pull request Dec 24, 2018
Rollup of 10 pull requests

Successful merges:

 - #55470 (box: Add documentation for `From` impls)
 - #56242 (Add missing link in docs)
 - #56944 (bootstrap: Link LLVM as a dylib with ThinLTO)
 - #56978 (Add `std::os::fortanix_sgx` module)
 - #56985 (Allow testing pointers for inboundedness while forbidding dangling pointers)
 - #56986 (rustc: Move jemalloc from rustc_driver to rustc)
 - #57010 (Actually run compiletest tests on CI)
 - #57021 (Enable emission of alignment attrs for pointer params)
 - #57074 (Fix recursion limits)
 - #57085 (librustc_codegen_llvm: Don't eliminate empty structs in C ABI on linux-sparc64)

Failed merges:

r? @ghost
@bors bors merged commit c8bcac5 into rust-lang:master Dec 24, 2018
@ehuss ehuss mentioned this pull request Dec 25, 2018
@oli-obk oli-obk deleted the const_check_bounds branch June 15, 2020 15:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants