Rust nightly update - basic_timing_cache_channel
Make sure this compiles with th newer nightly
This commit is contained in:
parent
3b85161eb2
commit
e4c838e8b0
@ -9,5 +9,5 @@ edition = "2018"
|
||||
[dependencies]
|
||||
cache_utils = { path = "../cache_utils" }
|
||||
cache_side_channel = { path = "../cache_side_channel" }
|
||||
nix = "0.18.0"
|
||||
nix = "0.20.0"
|
||||
covert_channels_evaluation = {path = "../covert_channels_evaluation"}
|
||||
|
@ -26,7 +26,8 @@ use cache_utils::complex_addressing::CacheSlicing;
|
||||
use cache_utils::mmap::MMappedMemory;
|
||||
use cache_utils::{find_core_per_socket, flush, maccess, noop};
|
||||
use covert_channels_evaluation::{BitIterator, CovertChannel};
|
||||
use nix::sched::{sched_getaffinity, CpuSet};
|
||||
use nix::sched::sched_getaffinity;
|
||||
use nix::sched::CpuSet;
|
||||
use nix::unistd::Pid;
|
||||
use std::collections::HashSet;
|
||||
use std::fmt;
|
||||
@ -537,10 +538,14 @@ impl<T: TimingChannelPrimitives> MultipleAddrCacheSideChannel for TopologyAwareT
|
||||
}
|
||||
|
||||
impl<T: TimingChannelPrimitives> CovertChannel for TopologyAwareTimingChannel<T> {
|
||||
type Handle = CovertChannelHandle<TopologyAwareTimingChannel<T>>;
|
||||
type CovertChannelHandle = CovertChannelHandle<TopologyAwareTimingChannel<T>>;
|
||||
const BIT_PER_PAGE: usize = 1;
|
||||
|
||||
unsafe fn transmit<'a>(&self, handle: &mut Self::Handle, bits: &mut BitIterator<'a>) {
|
||||
unsafe fn transmit<'a>(
|
||||
&self,
|
||||
handle: &mut Self::CovertChannelHandle,
|
||||
bits: &mut BitIterator<'a>,
|
||||
) {
|
||||
let page = handle.0.addr;
|
||||
|
||||
if let Some(b) = bits.next() {
|
||||
@ -552,7 +557,7 @@ impl<T: TimingChannelPrimitives> CovertChannel for TopologyAwareTimingChannel<T>
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn receive(&self, handle: &mut Self::Handle) -> Vec<bool> {
|
||||
unsafe fn receive(&self, handle: &mut Self::CovertChannelHandle) -> Vec<bool> {
|
||||
let r = unsafe { self.test_one_impl(&mut handle.0) };
|
||||
match r {
|
||||
Err(e) => panic!("{:?}", e),
|
||||
@ -564,7 +569,7 @@ impl<T: TimingChannelPrimitives> CovertChannel for TopologyAwareTimingChannel<T>
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn ready_page(&mut self, page: *const u8) -> Result<Self::Handle, ()> {
|
||||
unsafe fn ready_page(&mut self, page: *const u8) -> Result<Self::CovertChannelHandle, ()> {
|
||||
let vpn: VPN = get_vpn(page);
|
||||
// Check if the page has already been readied. If so should error out ?
|
||||
if let Some(preferred) = self.preferred_address.get(&vpn) {
|
||||
@ -613,7 +618,7 @@ impl<T: TimingChannelPrimitives> CovertChannel for TopologyAwareTimingChannel<T>
|
||||
if self.get_slice(addr) == best_slice {
|
||||
self.preferred_address.insert(vpn, addr);
|
||||
// Create the right handle
|
||||
let mut handle = Self::Handle {
|
||||
let mut handle = Self::CovertChannelHandle {
|
||||
0: TopologyAwareTimingChannelHandle {
|
||||
threshold: self
|
||||
.thresholds
|
||||
|
@ -6,7 +6,8 @@ use cache_side_channel::{
|
||||
use cache_utils::calibration::{get_vpn, only_flush, only_reload, HashMap, Threshold, VPN};
|
||||
use cache_utils::flush;
|
||||
use covert_channels_evaluation::{BitIterator, CovertChannel};
|
||||
use nix::sched::{sched_getaffinity, CpuSet};
|
||||
use nix::sched::sched_getaffinity;
|
||||
use nix::sched::CpuSet;
|
||||
use nix::unistd::Pid;
|
||||
use std::fmt::Debug;
|
||||
|
||||
@ -102,10 +103,14 @@ impl<T: TimingChannelPrimitives> CoreSpec for NaiveTimingChannel<T> {
|
||||
}
|
||||
|
||||
impl<T: TimingChannelPrimitives + Send + Sync> CovertChannel for NaiveTimingChannel<T> {
|
||||
type Handle = NaiveTimingChannelHandle;
|
||||
type CovertChannelHandle = NaiveTimingChannelHandle;
|
||||
const BIT_PER_PAGE: usize = 1;
|
||||
|
||||
unsafe fn transmit<'a>(&self, handle: &mut Self::Handle, bits: &mut BitIterator<'a>) {
|
||||
unsafe fn transmit<'a>(
|
||||
&self,
|
||||
handle: &mut Self::CovertChannelHandle,
|
||||
bits: &mut BitIterator<'a>,
|
||||
) {
|
||||
if let Some(b) = bits.next() {
|
||||
if b {
|
||||
unsafe { only_reload(handle.addr) };
|
||||
@ -115,7 +120,7 @@ impl<T: TimingChannelPrimitives + Send + Sync> CovertChannel for NaiveTimingChan
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn receive(&self, handle: &mut Self::Handle) -> Vec<bool> {
|
||||
unsafe fn receive(&self, handle: &mut Self::CovertChannelHandle) -> Vec<bool> {
|
||||
let r = unsafe { self.test_impl(handle) };
|
||||
match r {
|
||||
Err(e) => panic!(),
|
||||
@ -126,7 +131,7 @@ impl<T: TimingChannelPrimitives + Send + Sync> CovertChannel for NaiveTimingChan
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn ready_page(&mut self, page: *const u8) -> Result<Self::Handle, ()> {
|
||||
unsafe fn ready_page(&mut self, page: *const u8) -> Result<Self::CovertChannelHandle, ()> {
|
||||
unsafe { self.calibrate_impl(page) }.map_err(|_| ())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user