We continue discussing the paper "Shielding applications from an untrusted cloud with Haven,” written by Andrew Baumann, Marcus Peinado, and Galen Hunt. We were discussing memory and storage protection. We were discussing memory and storage where the shield module not only encrypts data but also implements its own filesystem so that disk blocks can be independently encrypted.A Merkle tree protects the integrity of the overall disk. The crypto metadata is stored in separate blocks from the filesystem.A scheme of two hash versions is used to maintain consistency after crashes. Just like memory and storage, the host can also exploit thread scheduling such as by allowing two threads to concurrently acquire a mutex. This is mitigated by a user mode scheduler that the shield module. At startup, a fixed number of threads is created that is configurable. These act as virtual cpus supporting many more application threads inside the enclave.Run queues and synchronization objects are maintained using atomic instructions for safety. The untrusted interface's event and interrupt mechanisms support suspending/resuming and signalling the virtual cpus. The shield does not support process creation. With Windows OS, very few applications fork a new process and even when they do the subprocess can be run in a different portion of the parents address space.
#codingexercise
Given a 2D array of R rows and C columns filled with N elements such that inner walls within the array have fewer elements on either side, find the number of such walls that that have elements on both sides
we mentioned the solution and sample code earlier. Today we implement counting the number of inner walls that have occupancy on both sides.
bool getCountInnerWalls(int[,] used, int row, int col)
{
int count = 0;
for (int i = 0; i < row-1; i ++)
for (int j = 0; j < col-1; j++)
{
if (used[i,j] && used[i,j+1]) count ++;
if (used[i,j] && used[i+1,j]) count++;
}
for (int j =0; j < row-1; j++)
{
if (used[row-1,j] && used[row-1, j+1]) count++;
}
for (int i =0 ; i < col -1; i++)
{
if (used[i,col-1] && used[i+1, col-1]) count++;
}
return count;
}
#codingexercise
Given a 2D array of R rows and C columns filled with N elements such that inner walls within the array have fewer elements on either side, find the number of such walls that that have elements on both sides
we mentioned the solution and sample code earlier. Today we implement counting the number of inner walls that have occupancy on both sides.
bool getCountInnerWalls(int[,] used, int row, int col)
{
int count = 0;
for (int i = 0; i < row-1; i ++)
for (int j = 0; j < col-1; j++)
{
if (used[i,j] && used[i,j+1]) count ++;
if (used[i,j] && used[i+1,j]) count++;
}
for (int j =0; j < row-1; j++)
{
if (used[row-1,j] && used[row-1, j+1]) count++;
}
for (int i =0 ; i < col -1; i++)
{
if (used[i,col-1] && used[i+1, col-1]) count++;
}
return count;
}
No comments:
Post a Comment