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

Use deref_pointer_as instead of deref_pointer #4140

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

Conversation

geetanshjuneja
Copy link
Contributor

@geetanshjuneja geetanshjuneja commented Jan 17, 2025

Links to #3841.

This PR is still under progress.

src/shims/time.rs Outdated Show resolved Hide resolved
src/shims/unix/foreign_items.rs Outdated Show resolved Hide resolved
src/shims/unix/fs.rs Outdated Show resolved Hide resolved
src/shims/unix/unnamed_socket.rs Show resolved Hide resolved
@geetanshjuneja
Copy link
Contributor Author

geetanshjuneja commented Jan 18, 2025

@RalfJung since libc isn't reliably available on Windows targets, I won't be able to get windows specificlayouts like this.libc_ty_layout("CONSOLE_SCREEN_BUFFER_INFO"). What should I do in this case?

@RalfJung
Copy link
Member

Yeah CONSOLE_SCREEN_BUFFER_INFO is not in libc. It's a Windows API type. I'd say remove that one from the PR for now and open a Zulip thread; either we can find this type declaration somewhere else or we have to write some helpers to declare such struct types entirely ourselves.

@RalfJung
Copy link
Member

RalfJung commented Jan 19, 2025

Wait, did you add more deref_pointerderef_pointer_as after my first review? Please don't do that, and especially please don't do that without explicitly posting a comment saying that you did! The general expectation is that once a review was done, the PR will not be extended in scope any more; all remaining changes are for resolving review concerns.

I will have to do a complete re-review, and since I am traveling this will take at least a week, maybe two.

@geetanshjuneja
Copy link
Contributor Author

geetanshjuneja commented Jan 19, 2025

Wait, did you add more deref_pointerderef_pointer_as after my first review? Please don't do that, and especially please don't do that without explicitly posting a comment saying that you did!

Sorry for not mentioning earlier that the PR is incomplete and making you review it unnecessarily. I have now made all the changes except for the windows part.

I will have to do a complete re-review, and since I am traveling this will take at least a week, maybe two.

I am not in a hurry, do re-review whenever you are free.

@geetanshjuneja
Copy link
Contributor Author

@RalfJung plz review 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.

Almost there :)

@@ -132,16 +132,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
this.assert_target_os_is_unix("localtime_r");
this.check_no_isolation("`localtime_r`")?;

let timep = this.deref_pointer(timep)?;
let timep_layout = this.libc_ty_layout("time_t");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let timep_layout = this.libc_ty_layout("time_t");
let time_layout = this.libc_ty_layout("time_t");

This is not the layout of a pointer, after all. timep is just a pointer-to-time.

@@ -85,7 +86,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

let id = this.init_once_get_data(init_once_op)?.id;
let flags = this.read_scalar(flags_op)?.to_u32()?;
let pending_place = this.deref_pointer(pending_op)?;
// PBOOL is a typedef of int
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// PBOOL is a typedef of int
// PBOOL is int*

@RalfJung
Copy link
Member

@rustbot author
Please post @rustbot ready when the PR is ready for the next round of review.

@rustbot rustbot added the S-waiting-on-author Status: Waiting for the PR author to address review comments label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: Waiting for the PR author to address review comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants