Monday, January 18, 2016

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 sandboxing. SGX was designed to protect limited subsets of application logic. Haven makes it usable for unmodified application binaries. This was difficult because applications load code and data at runtime, dynamically allocate and change protection on virtual memory, execute arbitrary user-mode instructions including some not supported by SGX, raise and handle exceptions and use thread local storage. If the application needs to use memory, it is done via LibOS. If the application need to use unsupported instructions, they are emulated. if the application has exceptions from execution. they are validate and handled within an enclave. Haven extends the Drawbridge - a shield module below the LibOS in the enclave and an untrusted runtime outside the enclave. This design implements a shielded runtime in the enclave by calling out to the untrusted host. In fact, this design may apply to LibOS in Linux and not just windows. Both picoprocess and LibOS can be used in Linux with a similar design because the design improves what is available on both platforms for a shielded execution.
#codinginterview
There's a line of B barbers where you have to take a haircut but you are the N'th person standing in a line and the shop has just opened. Each of the barber cuts hair such that the kth barber takes exactly Mk time and doesn't take a break. Mk's are multiples of each other. Which one will cut your hair ?
Answer:
B=2 N =4
M0 = 10, M1 = 5
Answer is 1. First barber.Because at the end of ten minutes three people would have cut their hair and so the next person would go to first barber.
Similarly B= 3 N = 12, M0,..Mk = 7,7,7
Answer is 3 Third barber) Because at the end of seven minutes, three people would have cut their hair and after four iterations, the last barber would have taken the last one.
B= 3 N =8
M0 ..Mk = 4 2 1
Answer is 1 because at the end of four minutes, seven people would have cut their hair and so the next person goes to first barber.
int GetBarber(int B, int N, List<int>M)
{
assert (M.Any(x => x<= 0) == false);
int max = M.Max();
int count = 0;
foreach (int I in M) count+= max/I;
return N%count == 0 ? B : N%count;
}

No comments:

Post a Comment