diff options
author | Andrew Walbran <qwandor@google.com> | 2023-07-21 17:23:56 +0100 |
---|---|---|
committer | Andrew Walbran <qwandor@google.com> | 2023-07-28 10:32:08 +0100 |
commit | a47698a88fc422c208628f443d156e64343c51ca (patch) | |
tree | 292dcebe59c1d9f2108eac6e5ffd60ff0299b911 /keystore2/test_utils | |
parent | 6e9f564dd640b2a4c5a72b870d2932a3dc35c8c2 (diff) | |
download | security-a47698a88fc422c208628f443d156e64343c51ca.tar.gz |
Add, standardise or temporarily opt out of safety comments for keystore2.
These will soon be required by a lint.
Some functions were incorrectly marked as safe which were not actually
safe, so I've fixed those too.
Bug: 290018030
Test: m rust
Change-Id: I38df6a8162d430617f123ab1aace38b741458fce
Diffstat (limited to 'keystore2/test_utils')
-rw-r--r-- | keystore2/test_utils/run_as.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/keystore2/test_utils/run_as.rs b/keystore2/test_utils/run_as.rs index 2485ab57..be643b6b 100644 --- a/keystore2/test_utils/run_as.rs +++ b/keystore2/test_utils/run_as.rs @@ -255,7 +255,9 @@ where let (response_reader, mut response_writer) = pipe_channel().expect("Failed to create cmd pipe."); - match fork() { + // SAFETY: Our caller guarantees that the process only has a single thread, so calling + // non-async-signal-safe functions in the child is in fact safe. + match unsafe { fork() } { Ok(ForkResult::Parent { child, .. }) => { drop(response_writer); drop(cmd_reader); @@ -314,7 +316,9 @@ where selinux::Context::new(se_context).expect("Unable to construct selinux::Context."); let (mut reader, mut writer) = pipe_channel::<R>().expect("Failed to create pipe."); - match fork() { + // SAFETY: Our caller guarantees that the process only has a single thread, so calling + // non-async-signal-safe functions in the child is in fact safe. + match unsafe { fork() } { Ok(ForkResult::Parent { child, .. }) => { drop(writer); let status = waitpid(child, None).expect("Failed while waiting for child."); |