TEST_F(enclave, unclobbered_vdso)
{
- struct encl_op_put put_op;
- struct encl_op_get get_op;
+ struct encl_op_get_from_buf get_op;
+ struct encl_op_put_to_buf put_op;
ASSERT_TRUE(setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata));
memset(&self->run, 0, sizeof(self->run));
self->run.tcs = self->encl.encl_base;
- put_op.header.type = ENCL_OP_PUT;
+ put_op.header.type = ENCL_OP_PUT_TO_BUFFER;
put_op.value = MAGIC;
EXPECT_EQ(ENCL_CALL(&put_op, &self->run, false), 0);
EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
- get_op.header.type = ENCL_OP_GET;
+ get_op.header.type = ENCL_OP_GET_FROM_BUFFER;
get_op.value = 0;
EXPECT_EQ(ENCL_CALL(&get_op, &self->run, false), 0);
TEST_F(enclave, unclobbered_vdso_oversubscribed)
{
+ struct encl_op_get_from_buf get_op;
+ struct encl_op_put_to_buf put_op;
unsigned long total_mem;
- struct encl_op_put put_op;
- struct encl_op_get get_op;
total_mem = get_total_epc_mem();
ASSERT_NE(total_mem, 0);
memset(&self->run, 0, sizeof(self->run));
self->run.tcs = self->encl.encl_base;
- put_op.header.type = ENCL_OP_PUT;
+ put_op.header.type = ENCL_OP_PUT_TO_BUFFER;
put_op.value = MAGIC;
EXPECT_EQ(ENCL_CALL(&put_op, &self->run, false), 0);
EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
- get_op.header.type = ENCL_OP_GET;
+ get_op.header.type = ENCL_OP_GET_FROM_BUFFER;
get_op.value = 0;
EXPECT_EQ(ENCL_CALL(&get_op, &self->run, false), 0);
TEST_F(enclave, clobbered_vdso)
{
- struct encl_op_put put_op;
- struct encl_op_get get_op;
+ struct encl_op_get_from_buf get_op;
+ struct encl_op_put_to_buf put_op;
ASSERT_TRUE(setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata));
memset(&self->run, 0, sizeof(self->run));
self->run.tcs = self->encl.encl_base;
- put_op.header.type = ENCL_OP_PUT;
+ put_op.header.type = ENCL_OP_PUT_TO_BUFFER;
put_op.value = MAGIC;
EXPECT_EQ(ENCL_CALL(&put_op, &self->run, true), 0);
EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
- get_op.header.type = ENCL_OP_GET;
+ get_op.header.type = ENCL_OP_GET_FROM_BUFFER;
get_op.value = 0;
EXPECT_EQ(ENCL_CALL(&get_op, &self->run, true), 0);
TEST_F(enclave, clobbered_vdso_and_user_function)
{
- struct encl_op_put put_op;
- struct encl_op_get get_op;
+ struct encl_op_get_from_buf get_op;
+ struct encl_op_put_to_buf put_op;
ASSERT_TRUE(setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata));
self->run.user_handler = (__u64)test_handler;
self->run.user_data = 0xdeadbeef;
- put_op.header.type = ENCL_OP_PUT;
+ put_op.header.type = ENCL_OP_PUT_TO_BUFFER;
put_op.value = MAGIC;
EXPECT_EQ(ENCL_CALL(&put_op, &self->run, true), 0);
EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
- get_op.header.type = ENCL_OP_GET;
+ get_op.header.type = ENCL_OP_GET_FROM_BUFFER;
get_op.value = 0;
EXPECT_EQ(ENCL_CALL(&get_op, &self->run, true), 0);
return dest;
}
-static void do_encl_op_put(void *op)
+static void do_encl_op_put_to_buf(void *op)
{
- struct encl_op_put *op2 = op;
+ struct encl_op_put_to_buf *op2 = op;
memcpy(&encl_buffer[0], &op2->value, 8);
}
-static void do_encl_op_get(void *op)
+static void do_encl_op_get_from_buf(void *op)
{
- struct encl_op_get *op2 = op;
+ struct encl_op_get_from_buf *op2 = op;
memcpy(&op2->value, &encl_buffer[0], 8);
}
void encl_body(void *rdi, void *rsi)
{
const void (*encl_op_array[ENCL_OP_MAX])(void *) = {
- do_encl_op_put,
- do_encl_op_get,
+ do_encl_op_put_to_buf,
+ do_encl_op_get_from_buf,
};
struct encl_op_header *op = (struct encl_op_header *)rdi;