Skip to content

Restore provenance in GlobalAlloc::{de,re}alloc when running on Miri#18

Merged
yvt merged 6 commits intomainfrom
test-global-restore-provenance
Nov 27, 2025
Merged

Restore provenance in GlobalAlloc::{de,re}alloc when running on Miri#18
yvt merged 6 commits intomainfrom
test-global-restore-provenance

Conversation

@yvt
Copy link
Copy Markdown
Owner

@yvt yvt commented Nov 22, 2025

Work-around for rust-lang/miri#2104

  • Make it compile on MSRV
  • Commit message
  • Clearly document why FORCE_POOL_FTR is set
  • Use iter_pools() in drop too?

@yvt yvt mentioned this pull request Nov 22, 2025
2 tasks
@yvt yvt force-pushed the test-global-restore-provenance branch 5 times, most recently from e077376 to a5fc573 Compare November 27, 2025 13:28
@yvt yvt force-pushed the test-global-restore-provenance branch from a5fc573 to 0745b2a Compare November 27, 2025 13:56
yvt added 3 commits November 27, 2025 23:08
…loc::dealloc` on Miri

> In current Miri with Stacked Borrows aliasing model, global heap
> allocations lose the provenance for the memory outside `layout`,
> which prevents us from accessing their allocation metadata and
> adjacent memory blocks. To work around this, we restore the original
> provenance from the containing memory pool.
> A smaller value is used on Miri because it somehow speeds up
> execution.
It runs successfully now that the pointer provenance issue with
`GlobalAlloc::dealloc` has been addressed.

It is too slow to run to completion, which I suspect is caused by
triggering some pathological cases in Miri.
@yvt yvt force-pushed the test-global-restore-provenance branch from 0745b2a to 344b03f Compare November 27, 2025 14:08
@yvt yvt force-pushed the test-global-restore-provenance branch from 344b03f to 2f7c04f Compare November 27, 2025 14:18
@yvt yvt marked this pull request as ready for review November 27, 2025 15:55
@yvt yvt merged commit c6351a3 into main Nov 27, 2025
7 checks passed
@yvt yvt deleted the test-global-restore-provenance branch November 27, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant