-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(tauri): deprecate Manager::unmanage
to fix use-after-free
#12723
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
Conversation
Package Changes Through c7d380eThere are 8 changes which include tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri with minor, @tauri-apps/api with minor, @tauri-apps/cli with minor, tauri-bundler with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
I totally get the sentiment here but completely removing it like this is a bit awkward considering that this api was added on user request. I've never dealt with such issues though so idk. would love to hear some more opinions here. p.s. to be clear, i'm 100% with you on the deprecation itself, just very unsure about making it noop |
maybe add a new |
how about using an Arc internally instead of a box? |
Do you mean replacing |
same implementation as now, but instead of using a Box, we use Arc and on each |
Then the implementation of |
I left a few comments on that implementation but it would be better to just add it here so we can discuss it better |
follow #12745 (comment)
@amrbashir Do you mean to keep the original unsafe behavior of |
yeah keep the original unsafe behavior for now, keep |
ping @amrbashir |
|
Manager::unmanage
to fix use-after-free
Manager::unmanage
to fix use-after-free
Soundness is excluded from the stability guarantees of Rust, as was the breaking change in the stdlib of making |
got a source for that? i do remember something like that but can't find anything rn.
except that this change is "opt-in" by being tied to edition 2024 (meaning in edition 2021 it's not an unsafe fn).
I don't understand what that means, including the phrasing before your edit. |
This isn't tied to edition, but to stdlib version. Upgrading the version will result in breakage, it was just that the edition boundary was as good as any for such an exceptional change. Retaining the 2021 edition in the I decided to phrase it more diplomatically, but a function that in its public api is declared as safe is misstating its soundness if it can be used to obtain UB. |
assuming we're still talking about just set_var then that doesn't seem to be true. I use 1.86 in a edition 2021 project and set_var is not an unsafe fn. If i change the edition it starts complaining. Literally just tested it. Apologies if i misunderstood the stdlib version part.
Ah got it. Yeah, that's fair and i'd agree |
Excuse my mistake, I never checked and was going by the documentation that states it is unsafe regardless of version. That is a bit surprising, thanks for surfacing that. The current API seems like it could remain safe, I'm working on a PR. |
close #12721
As a reference, here is another implementation that retains
Manager::unmanage
.For semantic compatibility, I don't think it's ideal in terms of performance and ergonomics.
I prefer the solution of deprecating
Manager::unmanage
, as the need to remove state seems to be a rare requirement (I personally can't think of a use case, and you can always achieve it withMutex
andOption
).