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

Mechanism to detect invalid serialization of objects that wrap OS resources #1049

Open
dgrove-oss opened this issue Jan 26, 2022 · 0 comments
Labels
kind: enhancement ✨ A new feature or use case

Comments

@dgrove-oss
Copy link
Collaborator

We need a reliable mechanism of preventing objects that wrap OS resources from being serialized to the initial runtime heap. These are represent latent bugs, as it is not possible for us to serialize the OS resource from build time to runtime. Examples include Threads, pthread_mutexes, file descriptors, etc.

We catch some of these now (like Thread) because we raise an error when there is an attempt to serialize compound native types (eg the phread_mutex field of Thread).

The SerializeAs annotations will handle some of these cases by allowing us to indicate that the serialized native resource is invalid. This can handle at least some of the scenarios with FileDescriptor, as the higher-level I/O classes will raise an error if an operation is performed on a closed FileDescriptor.

We probably also need a "NonSerializable" annotation that could be applied to a type to raise an error if an instance of that type tries to sneak into the serialized heap. One use case for this would be Thread.

@dgrove-oss dgrove-oss added the kind: enhancement ✨ A new feature or use case label Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement ✨ A new feature or use case
Projects
None yet
Development

No branches or pull requests

1 participant