Skip to content

Conversation

sosthene-nitrokey
Copy link
Contributor

@sosthene-nitrokey sosthene-nitrokey commented Jun 16, 2025

Fix a lifetime issue with the File::open function

This contains a breaking change because the unsafe open function
did not take the correct lifetime.

It think it's an acceptable breaking change because the previous behaviour was wrong
and any code that depends on it likely has a use after free.

Make Filesystem Send

Filesystem is still !Sync, so this allows putting the filesystem behind a Mutex
and sharing it across threads but still prevents concurrent operations from multiple threads.

Close #109

@Ddystopia and @Psy-Kai this might interest you

This also a breaking change because the `unsafe` `open` function
did not take the correct lifetime.

It think it's an acceptable breaking change because the previous behaviour was buggy
and any code that depends on it likely has a use after free.
`Filesystem` is still `!Sync`, so this allows putting the filesystem behind a `Mutex`
and sharing it across threads but still prevents concurrent operations from multiple threads.

See trussed-dev#108 (comment)
@sosthene-nitrokey sosthene-nitrokey force-pushed the thread-safe-improvements branch from bf725ca to 9758ff3 Compare June 20, 2025 10:26
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

Successfully merging this pull request may close these issues.

Remove RefCell in File
3 participants