-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi, thanks for your time to read this issue.
Our static analyzer find a potential unsound issue in SharedMutex
, where the drop
fuction needs to check if the pthread_mutex
is unlocked and destroying a locked pthread_mutex
is considered as undefined behaviors in doc.
Lines 123 to 128 in f1a207a
fn drop(&mut self) { | |
if getpid() == self.owner_pid { | |
check_libc_err(unsafe { pthread_mutex_destroy(self.mutex.get_mut()) }) | |
.expect("cannot destroy mutex"); | |
} | |
} |
A potentail PoC code is like:
#[deny(unsafe_code)]
use process_sync::SharedMutex;
fn main() {
if let Ok(mut s) = SharedMutex::new(){
if let Ok(_) = s.lock(){
drop(s);
}
}
}
FYI, a good way to handle is like std
library:
Thanks again for your time.
Metadata
Metadata
Assignees
Labels
No labels