Skip to content

native-lib/trace: Intercept mmap and munmap#4622

Closed
nia-e wants to merge 1 commit into
rust-lang:masterfrom
nia-e:alloc-tracing-mmap
Closed

native-lib/trace: Intercept mmap and munmap#4622
nia-e wants to merge 1 commit into
rust-lang:masterfrom
nia-e:alloc-tracing-mmap

Conversation

@nia-e

@nia-e nia-e commented Oct 11, 2025

Copy link
Copy Markdown
Member

Adds support for tracing mmaps in native code and logging that. Notably does not let us call libc::mmap(..) on the Rust side and then munmap it on the native side / the other way; I have ideas for maybe doing that, but they'd be quite a bit more involved since it requires us doing some syscall shimming.

@rustbot

rustbot commented Oct 11, 2025

Copy link
Copy Markdown
Collaborator

Thank you for contributing to Miri!
Please remember to not force-push to the PR branch except when you need to rebase due to a conflict or when the reviewer asks you for it.

@rustbot rustbot added the S-waiting-on-review Status: Waiting for a review to complete label Oct 11, 2025
@nia-e
nia-e force-pushed the alloc-tracing-mmap branch 3 times, most recently from 48dbe59 to 8ec819f Compare October 11, 2025 06:13
@nia-e
nia-e force-pushed the alloc-tracing-mmap branch from 8ec819f to d48a1cc Compare October 11, 2025 06:36
@RalfJung

Copy link
Copy Markdown
Member

I saw the PR and it's in my queue, but it's a big one so it may take a bit until I have time to dig into this -- sorry.

@nia-e

nia-e commented Oct 17, 2025

Copy link
Copy Markdown
Member Author

Realised this actually has a couple issues that need to be addressed and I could do that in this implementation relatively simply, or rewrite it to be better in every way (so we can call mmap on one side of the ffi boundary and munmap on the other w/ the same pointer, and vice versa) with a tiny tiny bit of inline assembly. I think I'll do that and mark this as a draft

@nia-e

nia-e commented Oct 17, 2025

Copy link
Copy Markdown
Member Author

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels Oct 17, 2025
@nia-e
nia-e marked this pull request as draft October 17, 2025 22:17
@oli-obk oli-obk self-assigned this Oct 18, 2025
@oli-obk

oli-obk commented Oct 18, 2025

Copy link
Copy Markdown
Contributor

Nia gave me a crash course in various of those ideas at eurorust. I'll do the first reviews and assign to you (Ralf) once I think it's ready

@rustbot

rustbot commented Nov 17, 2025

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly e110b81) made this pull request unmergeable. Please resolve the merge conflicts.

@RalfJung

Copy link
Copy Markdown
Member

@nia-e I am going to close this PR since it's become inactive and work has moved to smaller follow-up PRs. Maybe it'd make sense to open an issue summarizing the plan and the current status?

@RalfJung RalfJung closed this Jul 11, 2026
@rustbot rustbot removed the S-waiting-on-author Status: Waiting for the PR author to address review comments label Jul 11, 2026
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.

4 participants