Replies: 4 comments 10 replies
-
There was some discussion of this here: #2728 (comment)
|
Beta Was this translation helpful? Give feedback.
-
I expected that Rust standard library (and maybe custom libraries) relies on OS behaving sane, with memory safety at stake (e.g. using UNIX socket for synchronisation - receive cannot happen before send). Or using memory-mapped files internally.
|
Beta Was this translation helpful? Give feedback.
-
@vi I think this is a kind of grey zone (and also rabbit hole). For example, you can do In general, any interaction with OS can lead to OS or other processes breaking our process in arbitrary way. For example imagine that user has following "program" running in background:
It seems that rust spec should contain some list of assumptions that the environment is not too cruel (CPU doesn't have bugs, OS returns nonoverlapping chunks of memory in response to |
Beta Was this translation helpful? Give feedback.
-
I'm not sure why |
Beta Was this translation helpful? Give feedback.
-
tokio::fs::File::from_raw_fd
is unsafe, buttokio::io::unix::AsyncFd::new
is safe.Is it intentional or an oversight? It may be safe because of just polling around isn't expected to affect file descriptors too much. It may be unsafe because of typically things that allow specifying arbitrary file descriptor number are unsafe.
Either way safety should somehow be mentioned in documentation.
Beta Was this translation helpful? Give feedback.
All reactions