From bd5702fa05338608a02062960ebebaa254cbe0de Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Thu, 27 Feb 2020 13:12:10 +0000 Subject: [PATCH 1/4] Fix recent OpenEnclave + snmalloc Release build --- src/mem/largealloc.h | 1 + src/pal/pal_open_enclave.h | 4 ++-- src/test/func/fixed_region/fixed_region.cc | 4 ++-- src/test/func/two_alloc_types/main.cc | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mem/largealloc.h b/src/mem/largealloc.h index 5c1437b..e4f3887 100644 --- a/src/mem/largealloc.h +++ b/src/mem/largealloc.h @@ -8,6 +8,7 @@ #include "baseslab.h" #include "sizeclass.h" +#include #include namespace snmalloc diff --git a/src/pal/pal_open_enclave.h b/src/pal/pal_open_enclave.h index 3b33378..88ecbd8 100644 --- a/src/pal/pal_open_enclave.h +++ b/src/pal/pal_open_enclave.h @@ -4,7 +4,7 @@ #ifdef OPEN_ENCLAVE extern "C" const void* __oe_get_heap_base(); extern "C" const void* __oe_get_heap_end(); -extern "C" void* oe_memset(void* p, int c, size_t size); +extern "C" void* oe_memset_s(void* p, size_t p_size, int c, size_t size); extern "C" void oe_abort(); namespace snmalloc @@ -54,7 +54,7 @@ namespace snmalloc template void zero(void* p, size_t size) noexcept { - oe_memset(p, 0, size); + oe_memset_s(p, size, 0, size); } }; } diff --git a/src/test/func/fixed_region/fixed_region.cc b/src/test/func/fixed_region/fixed_region.cc index c8a8177..183ae24 100644 --- a/src/test/func/fixed_region/fixed_region.cc +++ b/src/test/func/fixed_region/fixed_region.cc @@ -17,9 +17,9 @@ extern "C" const void* __oe_get_heap_end() return oe_end; } -extern "C" void* oe_memset(void* p, int c, size_t size) +extern "C" void* oe_memset_s(void* p, size_t p_size, int c, size_t size) { - std::cout << "Memset " << p << " - " << size << std::endl; + std::cout << "Memset " << p << " (" << p_size << ") - " << size << std::endl; return memset(p, c, size); } diff --git a/src/test/func/two_alloc_types/main.cc b/src/test/func/two_alloc_types/main.cc index 74ae32f..119e1e5 100644 --- a/src/test/func/two_alloc_types/main.cc +++ b/src/test/func/two_alloc_types/main.cc @@ -17,8 +17,9 @@ extern "C" const void* __oe_get_heap_end() return oe_end; } -extern "C" void* oe_memset(void* p, int c, size_t size) +extern "C" void* oe_memset_s(void* p, size_t p_size, int c, size_t size) { + (void) p_size; return memset(p, c, size); } From fdc582b619c36d54de76bb92ca54bd8c5a5cc261 Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Thu, 27 Feb 2020 16:21:24 +0000 Subject: [PATCH 2/4] Fix formatting --- src/mem/largealloc.h | 2 +- src/test/func/two_alloc_types/main.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mem/largealloc.h b/src/mem/largealloc.h index e4f3887..583acc4 100644 --- a/src/mem/largealloc.h +++ b/src/mem/largealloc.h @@ -8,8 +8,8 @@ #include "baseslab.h" #include "sizeclass.h" -#include #include +#include namespace snmalloc { diff --git a/src/test/func/two_alloc_types/main.cc b/src/test/func/two_alloc_types/main.cc index 119e1e5..ef681bd 100644 --- a/src/test/func/two_alloc_types/main.cc +++ b/src/test/func/two_alloc_types/main.cc @@ -19,7 +19,7 @@ extern "C" const void* __oe_get_heap_end() extern "C" void* oe_memset_s(void* p, size_t p_size, int c, size_t size) { - (void) p_size; + (void)p_size; return memset(p, c, size); } From 87153545ed94ba06a9b6cae70e9865979cd2d031 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Thu, 27 Feb 2020 16:40:21 +0000 Subject: [PATCH 3/4] Update src/test/func/two_alloc_types/main.cc --- src/test/func/two_alloc_types/main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/func/two_alloc_types/main.cc b/src/test/func/two_alloc_types/main.cc index ef681bd..dbcb38c 100644 --- a/src/test/func/two_alloc_types/main.cc +++ b/src/test/func/two_alloc_types/main.cc @@ -19,7 +19,7 @@ extern "C" const void* __oe_get_heap_end() extern "C" void* oe_memset_s(void* p, size_t p_size, int c, size_t size) { - (void)p_size; +UNUSED(p_size); return memset(p, c, size); } From 9f31f8075c7e1bfbec68957a6ee917ed51508a30 Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Thu, 27 Feb 2020 17:24:07 +0000 Subject: [PATCH 4/4] Use UNUSED --- src/test/func/two_alloc_types/main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/func/two_alloc_types/main.cc b/src/test/func/two_alloc_types/main.cc index ef681bd..341f32d 100644 --- a/src/test/func/two_alloc_types/main.cc +++ b/src/test/func/two_alloc_types/main.cc @@ -19,7 +19,7 @@ extern "C" const void* __oe_get_heap_end() extern "C" void* oe_memset_s(void* p, size_t p_size, int c, size_t size) { - (void)p_size; + UNUSED(p_size); return memset(p, c, size); }