aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge E. Moreira <jemoreira@google.com>2021-04-28 19:47:19 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-04-28 19:47:19 +0000
commit5f2f9d19631c261705763eb6a4f603074991132c (patch)
tree1592abd7c598471ceea699c4c3cc3a7bfab5f360
parent0a3932291af4a27253659213de72651a13763e65 (diff)
parentc0c05a6e22b9fa3219129db0949daf966db0c753 (diff)
downloadcrosvm-5f2f9d19631c261705763eb6a4f603074991132c.tar.gz
Revert "Conditionally apply linux-only operations" am: 4b8b49f07e am: c0c05a6e22
Original change: https://android-review.googlesource.com/c/platform/external/crosvm/+/1684112 Change-Id: I3ffacb84d9ec03b5397cf0fa01e2eb8e91e07e8e
-rw-r--r--devices/src/proxy.rs3
-rw-r--r--devices/src/virtio/fs/worker.rs24
2 files changed, 10 insertions, 17 deletions
diff --git a/devices/src/proxy.rs b/devices/src/proxy.rs
index 5e22786d6..4afa7b38c 100644
--- a/devices/src/proxy.rs
+++ b/devices/src/proxy.rs
@@ -158,9 +158,6 @@ impl ProxyDevice {
let debug_label_trimmed =
&debug_label.as_bytes()[..std::cmp::min(max_len, debug_label.len())];
let thread_name = CString::new(debug_label_trimmed).unwrap();
- // TODO(crbug.com/1199487): remove this once libc provides the wrapper for all
- // targets
- #[cfg(all(target_os = "linux", target_env = "gnu"))]
let _ = libc::pthread_setname_np(libc::pthread_self(), thread_name.as_ptr());
device.on_sandboxed();
child_proc(child_tube, &mut device);
diff --git a/devices/src/virtio/fs/worker.rs b/devices/src/virtio/fs/worker.rs
index 65a47a9c6..19fec1159 100644
--- a/devices/src/virtio/fs/worker.rs
+++ b/devices/src/virtio/fs/worker.rs
@@ -188,22 +188,18 @@ impl<F: FileSystem + Sync> Worker<F> {
// cases.
const SECBIT_NO_SETUID_FIXUP: i32 = 1 << 2;
- // TODO(crbug.com/1199487): Remove this once libc provides the wrapper for all targets.
- #[cfg(target_os = "linux")]
- {
- // Safe because this doesn't modify any memory and we check the return value.
- let mut securebits = unsafe { libc::prctl(libc::PR_GET_SECUREBITS) };
- if securebits < 0 {
- return Err(Error::GetSecurebits(io::Error::last_os_error()));
- }
+ // Safe because this doesn't modify any memory and we check the return value.
+ let mut securebits = unsafe { libc::prctl(libc::PR_GET_SECUREBITS) };
+ if securebits < 0 {
+ return Err(Error::GetSecurebits(io::Error::last_os_error()));
+ }
- securebits |= SECBIT_NO_SETUID_FIXUP;
+ securebits |= SECBIT_NO_SETUID_FIXUP;
- // Safe because this doesn't modify any memory and we check the return value.
- let ret = unsafe { libc::prctl(libc::PR_SET_SECUREBITS, securebits) };
- if ret < 0 {
- return Err(Error::SetSecurebits(io::Error::last_os_error()));
- }
+ // Safe because this doesn't modify any memory and we check the return value.
+ let ret = unsafe { libc::prctl(libc::PR_SET_SECUREBITS, securebits) };
+ if ret < 0 {
+ return Err(Error::SetSecurebits(io::Error::last_os_error()));
}
#[derive(PollToken)]