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

Maybe unsound in new_unchecked #5

Open
lwz23 opened this issue Dec 10, 2024 · 2 comments
Open

Maybe unsound in new_unchecked #5

lwz23 opened this issue Dec 10, 2024 · 2 comments

Comments

@lwz23
Copy link

lwz23 commented Dec 10, 2024

Hello, thank you for your contribution in this project, I am scanning the unsoundness problem in rust project.
I notice the following code:

impl<'rt> RuntimeHandle<'rt> {
    // Creates a new RuntimeHandle; it's the caller's responsibility to make
    // sure that the runtime is not destroyed while objects under this runtime
    // are still being used
    pub fn new_unchecked(ptr: *mut sys::Runtime) -> Self {
        RuntimeHandle(ptr, PhantomData)
    }

If it is caller's responsibility to make responsibility to make are still being used, maybe this function should be marked as unsafe and doc it with ///SAFETY? This is more in line with rust's security requirements, In Rust, if only safe code is used that results in UB being considered unsound and violating Rust's security guarantees.

@lwz23
Copy link
Author

lwz23 commented Dec 16, 2024

ping

@laptou
Copy link
Owner

laptou commented Dec 19, 2024

That's true, it probably should be marked as unsafe. Can you make a PR for this?

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