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

ITCM init #910

Open
jordens opened this issue Jun 19, 2024 · 5 comments
Open

ITCM init #910

jordens opened this issue Jun 19, 2024 · 5 comments

Comments

@jordens
Copy link
Member

jordens commented Jun 19, 2024

let dst = slice::from_raw_parts_mut(sitcm, len);

That destination slice is uninitialized, thus insta-UB. Needs to be MaybeUninit.

@ryan-summers
Copy link
Member

Not only that, but the pointer provenance of the sitcm pointer only permits us to technically write 4 bytes (because the static mut __sitcm: u32.

@ryan-summers
Copy link
Member

Ref rust-embedded/wg#771, it might be the case that pointer provenance is not actually an issue

@jordens
Copy link
Member Author

jordens commented Jun 28, 2024

Way back I had argued that this is like an FFI interface where one crates slices from addresses and lengths in a similar way without virtual machine knowing much about them.
I.e. specifically the src slice must be fine to create like this. How else would one do it?
And if the src slice is fine (initialized, doesn't break aliasing rules), so is the dst slice.

@jordens
Copy link
Member Author

jordens commented Jul 9, 2024

Closing as "not a problem".

@jordens jordens closed this as completed Jul 9, 2024
@jordens
Copy link
Member Author

jordens commented Dec 3, 2024

As per rust-lang/unsafe-code-guidelines#259 we may want to try using ZSTs for the symbols though.

@jordens jordens reopened this Dec 3, 2024
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

No branches or pull requests

2 participants