Skip to content

native_lib/trace: fix and reenable #4435

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

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Conversation

nia-e
Copy link
Contributor

@nia-e nia-e commented Jul 2, 2025

Per discussion in various PRs (#4401, #4405), this addresses (some of) the points raised. Also using this to check if CI passes on all architectures.

@nia-e nia-e force-pushed the trace-fixups branch 4 times, most recently from 37fbac4 to d2ed49d Compare July 2, 2025 03:27
@nia-e
Copy link
Contributor Author

nia-e commented Jul 2, 2025

The only options I see for making the builds work nicely regardless of arch are either (a) copy-pasting a massive cfg macro everywhere; (b) copy-pasting said massive macro only a couple times to declare some stub functions; or (c) give in and add a small build script. Given the size of Miri I assume the choice to not have said build script was very deliberate, so I can try to do one of the other options (or maybe I'm missing something!) but for now this hopefully will build. This would have solved everything trivially, but oh well

@nia-e nia-e force-pushed the trace-fixups branch 2 times, most recently from 0110f5a to 6907e9d Compare July 2, 2025 03:58
@RalfJung
Copy link
Member

RalfJung commented Jul 2, 2025

It should be entirely possible to do this with a single cfg that decides whether we include the "real" implementation of native_lib::tracing, or a fallback.

//#[cfg(target_os = "linux")]
//pub mod trace;
#[cfg(trace)]
pub mod trace;
Copy link
Member

Choose a reason for hiding this comment

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

To reduce the amount of cfg in this file, I would suggest something like this:

#[cfg_attr(not(all(target_os = "linux", any(target_arch = "x86_64", ...), path = "trace/stub.rs")]
mod trace;

and then the stub.rs file contains just a bunch of empty functions and dummy type aliases so that to the outside, it looks like all the same functions and types exist.

src/alloc/mod.rs Outdated
@@ -1,5 +1,5 @@
mod alloc_bytes;
#[cfg(target_os = "linux")]
Copy link
Member

Choose a reason for hiding this comment

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

Let's just keep using that allocator on all Linux targets, no harm in that.

@RalfJung
Copy link
Member

RalfJung commented Jul 5, 2025

@rustbot author

@rustbot rustbot added the S-waiting-on-author Status: Waiting for the PR author to address review comments label Jul 5, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 5, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@nia-e nia-e force-pushed the trace-fixups branch 2 times, most recently from 3b1584e to 93015d6 Compare July 5, 2025 10:09
@nia-e nia-e force-pushed the trace-fixups branch 4 times, most recently from 9e54dab to f2eb0e3 Compare July 5, 2025 11:39
@nia-e nia-e force-pushed the trace-fixups branch 3 times, most recently from 60837c7 to f411f4f Compare July 5, 2025 12:29
@nia-e nia-e force-pushed the trace-fixups branch 5 times, most recently from ef187be to 199bf13 Compare July 5, 2025 18:49
@nia-e nia-e force-pushed the trace-fixups branch 2 times, most recently from a06efe1 to f17c0ce Compare July 6, 2025 07:39
@RalfJung
Copy link
Member

RalfJung commented Jul 7, 2025

@rustbot ready
(I know this is redundant but I need something in my inbox to represent this ;)

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

I have rebased and pushed a commit with some cleanups, please check if those make sense.

@@ -417,71 +412,13 @@ fn handle_segfault(
if acc_ty.is_writable() {
Copy link
Member

Choose a reason for hiding this comment

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

Can it actually happen that the same operation is both a read and a write? Is that used for instance for atomic fetch-and-add and operations like that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Waiting for a review to complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants