From 04a801e0cda2cdd4998609498ea0eaec1c66c51b Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Tue, 26 Sep 2017 10:22:55 +0100 Subject: [PATCH] Squashed commit of the following: (#50) commit 9d8046e310efe860bb9d81e977a323f3905665c1 Author: Haitao Huang <4699115+haitaohuang@users.noreply.github.com> Date: Sat Sep 16 11:26:45 2017 -0500 Check and handle signal interrupts in sockets Signed-off-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com> commit 960ad91a4a8ec06020273a175471def37870fda6 Author: Haitao Huang <4699115+haitaohuang@users.noreply.github.com> Date: Sat Sep 16 11:27:35 2017 -0500 Add error code in oal for invalid inputs Signed-off-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com> commit e22c569335c1ec8d18f7df8105a68e9b9a82e691 Author: Li, Xun Date: Wed Sep 20 10:51:18 2017 +0800 Update libunwind for glibc 2.26 compatibility libunwind should include explicitly. glibc change sys/ucontext.h as a bug fix(https://sourceware.org/git/?p=glibc.git;a=commit;h=cfed8ece799b6e6540193a14b41d9de52dc3b08f) Signed-off-by: Li, Xun commit 9cda5c4774b2f4fc02fd031f98057cd88d14f2e0 Merge: 94c162c98 36918f071 Author: lzha101 Date: Wed Sep 20 09:58:29 2017 +0800 Merge pull request #165 from corda/chrisr3-stack-protector-fix Ensure trts_nsp.cpp is compiled without stack protection. Signed-off-by: Zhang Lili lili.z.zhang@intel.com commit 36918f071fd29c86335b0cea0e072c3f08a51eae Author: Chris Rankin Date: Tue Sep 19 07:31:57 2017 +0000 Ensure trts_nsp.cpp is compiled without stack protection. Signed-off-by: Chris Rankin commit 94c162c98bf95a034eadb41bfa6e6a35f410a0c8 Author: Kai Mast Date: Mon Sep 18 04:07:19 2017 -0400 g++7 fixes (#148) Signed-off-by: Li, Xun commit 8a72fed8737dc8e331889e6530925fc5a0be2ea0 Merge: 2133df2d4 635e3a370 Author: Li Xun Date: Mon Sep 18 15:58:10 2017 +0800 Merge pull request #159 from corda/chrisr3-gcc7-fix Resolve GCC 7.1 warnings about deprecated throw(std::bad_alloc) in C++11. Signed-off-by: Li, Xun commit 635e3a37081ad3f773a0ff24c89f1e6094034d28 Author: Chris Rankin Date: Wed Sep 13 10:31:11 2017 +0100 Resolve warnings about deprecated throw(std::bad_alloc) in C++11. --- .../common/inc/internal/oal/uae_oal_api.h | 1 + sgx-jvm/linux-sgx/common/inc/stdc++/new | 24 ++++++++--------- .../NonBlockingUnixCommunicationSocket.cpp | 26 ++++++++++++++++--- .../psw/ae/common/src/SocketTransporter.cpp | 2 +- .../ae/common/src/UnixCommunicationSocket.cpp | 13 +++++++--- .../linux-sgx/psw/uae_service/linux/Makefile | 8 ++++-- .../psw/uae_service/sgx_uae_service.cpp | 3 +++ .../uae_wrapper/src/AEServicesImpl.cpp | 2 +- .../linux/libunwind/src/setjmp/siglongjmp.c | 1 + .../sdk/cpprt/memory_manage/delete2.cpp | 2 +- .../sdk/cpprt/memory_manage/delete3.cpp | 2 +- .../sdk/cpprt/memory_manage/delete4.cpp | 2 +- .../sdk/cpprt/memory_manage/delete5.cpp | 2 +- .../sdk/cpprt/memory_manage/delete6.cpp | 2 +- .../sdk/cpprt/memory_manage/new1.cpp | 2 +- .../sdk/cpprt/memory_manage/new2.cpp | 2 +- .../sdk/cpprt/memory_manage/new3.cpp | 2 +- .../sdk/cpprt/memory_manage/new4.cpp | 2 +- .../sdk/cpprt/memory_manage/new5.cpp | 2 +- .../sdk/cpprt/memory_manage/new6.cpp | 2 +- .../sdk/cpprt/memory_manage/new_handler.cpp | 2 +- sgx-jvm/linux-sgx/sdk/trts/Makefile | 2 +- 22 files changed, 70 insertions(+), 36 deletions(-) diff --git a/sgx-jvm/linux-sgx/common/inc/internal/oal/uae_oal_api.h b/sgx-jvm/linux-sgx/common/inc/internal/oal/uae_oal_api.h index 8d305d0017..74b13e37f8 100644 --- a/sgx-jvm/linux-sgx/common/inc/internal/oal/uae_oal_api.h +++ b/sgx-jvm/linux-sgx/common/inc/internal/oal/uae_oal_api.h @@ -42,6 +42,7 @@ typedef enum{ UAE_OAL_ERROR_UNEXPECTED , UAE_OAL_ERROR_AESM_UNAVAILABLE , UAE_OAL_ERROR_TIMEOUT , + UAE_OAL_ERROR_INVALID , } uae_oal_status_t; /*OAL methods from here forward */ diff --git a/sgx-jvm/linux-sgx/common/inc/stdc++/new b/sgx-jvm/linux-sgx/common/inc/stdc++/new index b120435fc4..17553e9f06 100644 --- a/sgx-jvm/linux-sgx/common/inc/stdc++/new +++ b/sgx-jvm/linux-sgx/common/inc/stdc++/new @@ -48,22 +48,22 @@ namespace std * The function to call when allocation fails. By default, there is no * handler and a bad allocation exception is thrown if an allocation fails. */ - new_handler set_new_handler(new_handler handler) throw(); + new_handler set_new_handler(new_handler handler); }; -void* SGXAPI operator new (size_t) throw (std::bad_alloc); -void* SGXAPI operator new[] (size_t) throw (std::bad_alloc); +void* SGXAPI operator new (size_t); +void* SGXAPI operator new[] (size_t); -void* SGXAPI operator new (size_t, const std::nothrow_t&) throw(); -void* SGXAPI operator new (size_t, void*) throw(); -void* SGXAPI operator new[] (size_t, const std::nothrow_t&) throw(); -void* SGXAPI operator new[] (size_t, void*) throw(); +void* SGXAPI operator new (size_t, const std::nothrow_t&); +void* SGXAPI operator new (size_t, void*); +void* SGXAPI operator new[] (size_t, const std::nothrow_t&); +void* SGXAPI operator new[] (size_t, void*); void SGXAPI operator delete (void*) throw (); -void SGXAPI operator delete (void*, const std::nothrow_t&) throw(); -void SGXAPI operator delete (void*, void*) throw(); -void SGXAPI operator delete[] (void*) throw (); -void SGXAPI operator delete[] (void*, const std::nothrow_t&) throw(); -void SGXAPI operator delete[] (void*, void*) throw(); +void SGXAPI operator delete (void*, const std::nothrow_t&); +void SGXAPI operator delete (void*, void*); +void SGXAPI operator delete[] (void*); +void SGXAPI operator delete[] (void*, const std::nothrow_t&); +void SGXAPI operator delete[] (void*, void*); #endif /* _NEW_ */ diff --git a/sgx-jvm/linux-sgx/psw/ae/common/src/NonBlockingUnixCommunicationSocket.cpp b/sgx-jvm/linux-sgx/psw/ae/common/src/NonBlockingUnixCommunicationSocket.cpp index 6fac26a42b..74ae671cbe 100644 --- a/sgx-jvm/linux-sgx/psw/ae/common/src/NonBlockingUnixCommunicationSocket.cpp +++ b/sgx-jvm/linux-sgx/psw/ae/common/src/NonBlockingUnixCommunicationSocket.cpp @@ -43,7 +43,7 @@ #include #include #include - +#include NonBlockingUnixCommunicationSocket::~NonBlockingUnixCommunicationSocket() { if (mEvents != NULL) @@ -136,6 +136,10 @@ char* NonBlockingUnixCommunicationSocket::readRaw(ssize_t length) do{ //try a direct read (maybe all data is available already) step = read(mSocket, recBuf, length); + if(step == -1 && errno == EINTR && CheckForTimeout() == false){ + SE_TRACE_WARNING("read is interrupted by signal\n"); + continue; + } if (step == -1 && errno != EAGAIN) { errorDetected = true; @@ -154,7 +158,10 @@ char* NonBlockingUnixCommunicationSocket::readRaw(ssize_t length) } //wait for events - eventNum = epoll_wait(mEpoll, mEvents, MAX_EVENTS, epollTimeout); + do { + eventNum = epoll_wait(mEpoll, mEvents, MAX_EVENTS, epollTimeout); + } while (eventNum == -1 && errno == EINTR && CheckForTimeout() == false); + if (eventNum == -1) { errorDetected = true; @@ -253,6 +260,12 @@ ssize_t NonBlockingUnixCommunicationSocket::partialRead(char* buffer, ssize_t ma remaining = maxLength - totalRead; step = read(mSocket, buffer + totalRead, (remaining > chunkSize ? chunkSize : remaining)); + + if(step == -1 && errno == EINTR && CheckForTimeout() == false){ + SE_TRACE_WARNING("read was interrupted by signal\n"); + continue; + } + if (step == -1) { if (errno != EAGAIN) @@ -291,6 +304,10 @@ ssize_t NonBlockingUnixCommunicationSocket::writeRaw(const char* data, ssize_t do { step = write(mSocket, data + total_write, length - total_write); + if(step == -1 && errno == EINTR && CheckForTimeout() == false){ + SE_TRACE_WARNING("write was interrupted by signal\n"); + continue; + } if (step == -1 && errno != EAGAIN) { @@ -343,8 +360,9 @@ ssize_t NonBlockingUnixCommunicationSocket::writeRaw(const char* data, ssize_t continue; } } - - eventNum = epoll_wait(mEpoll, mEvents, MAX_EVENTS, epollTimeout); + do { + eventNum = epoll_wait(mEpoll, mEvents, MAX_EVENTS, epollTimeout); + } while (eventNum == -1 && errno == EINTR && CheckForTimeout() == false); if (eventNum == -1) { errorDetected = true; diff --git a/sgx-jvm/linux-sgx/psw/ae/common/src/SocketTransporter.cpp b/sgx-jvm/linux-sgx/psw/ae/common/src/SocketTransporter.cpp index 7a35ebbb91..9054b33a6f 100644 --- a/sgx-jvm/linux-sgx/psw/ae/common/src/SocketTransporter.cpp +++ b/sgx-jvm/linux-sgx/psw/ae/common/src/SocketTransporter.cpp @@ -82,7 +82,7 @@ uae_oal_status_t SocketTransporter::sendMessage(AEMessage *message, ICommunicati uae_oal_status_t SocketTransporter::transact(IAERequest* request, IAEResponse* response, uint32_t timeout) { if (request == NULL || response == NULL) - return UAE_OAL_ERROR_UNEXPECTED; + return UAE_OAL_ERROR_INVALID; ICommunicationSocket* communicationSocket = mSocketFactory->NewCommunicationSocket(); diff --git a/sgx-jvm/linux-sgx/psw/ae/common/src/UnixCommunicationSocket.cpp b/sgx-jvm/linux-sgx/psw/ae/common/src/UnixCommunicationSocket.cpp index ace7c88773..904d85602c 100644 --- a/sgx-jvm/linux-sgx/psw/ae/common/src/UnixCommunicationSocket.cpp +++ b/sgx-jvm/linux-sgx/psw/ae/common/src/UnixCommunicationSocket.cpp @@ -34,10 +34,10 @@ #include #include #include - +#include #include #include - +#include #include @@ -147,6 +147,10 @@ ssize_t UnixCommunicationSocket::writeRaw(const char* data, ssize_t length) do { ssize_t step = write(mSocket, data+written, length-written); + if(step == -1 && errno == EINTR && CheckForTimeout() == false){ + SE_TRACE_WARNING("write was interrupted by signal\n"); + continue; + } if (step < 0 || CheckForTimeout()) { //this connection is probably closed @@ -174,7 +178,10 @@ char* UnixCommunicationSocket::readRaw(ssize_t length) do { ssize_t step = read(mSocket, recBuf + total_read, length - total_read); - + if(step == -1 && errno == EINTR && CheckForTimeout() == false){ + SE_TRACE_WARNING("read was interrupted by signal\n"); + continue; + } //check connection closed by peer if (step <= 0 || CheckForTimeout()) { diff --git a/sgx-jvm/linux-sgx/psw/uae_service/linux/Makefile b/sgx-jvm/linux-sgx/psw/uae_service/linux/Makefile index f2d1349ad0..5bf0e5c898 100644 --- a/sgx-jvm/linux-sgx/psw/uae_service/linux/Makefile +++ b/sgx-jvm/linux-sgx/psw/uae_service/linux/Makefile @@ -74,8 +74,9 @@ PROTPBUF_CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=0 EXTERNAL_LIB += -lprotobuf vpath %.cpp .. $(COMMON_DIR)/src $(IPC_COMMON_SRC_DIR) $(IPC_COMMON_PROTO_DIR) $(UAE_SRC_DIR) $(AE_COMMON_DIR) +vpath %.c $(COMMON_DIR)/src - +C_SRC := se_trace.c IPC_SRC := AECloseSessionRequest.cpp \ AEGetQuoteResponse.cpp \ @@ -122,7 +123,7 @@ SRC := AEServicesImpl.cpp \ uae_service_version.cpp \ uae_service_assert.cpp -OBJ := $(SRC:.cpp=.o) $(IPC_SRC:.cpp=.o) $(PROTOBUF_SRC:.cc=.o) +OBJ := $(C_SRC:.c=.o) $(SRC:.cpp=.o) $(IPC_SRC:.cpp=.o) $(PROTOBUF_SRC:.cc=.o) LDUFLAGS:= -pthread -L$(BUILD_DIR) LDUFLAGS += -Wl,--version-script=uae_service.lds -Wl,--gc-sections @@ -163,6 +164,9 @@ messages.pb.o : $(IPC_COMMON_PROTO_DIR)/messages.pb.cc $(CXX) $(filter-out -Wshadow, $(CXXFLAGS)) -c $< -o $@ %.o :%.cpp $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@ +%.o: %.c + $(CC) $(CFLAGS) $(INCLUDE) -Werror -fPIC -c $< -o $@ + $(BUILD_DIR): @$(MKDIR) $@ diff --git a/sgx-jvm/linux-sgx/psw/uae_service/sgx_uae_service.cpp b/sgx-jvm/linux-sgx/psw/uae_service/sgx_uae_service.cpp index a298df2584..5755bbc14d 100644 --- a/sgx-jvm/linux-sgx/psw/uae_service/sgx_uae_service.cpp +++ b/sgx-jvm/linux-sgx/psw/uae_service/sgx_uae_service.cpp @@ -623,6 +623,9 @@ sgx_status_t oal_map_status(uae_oal_status_t status) case UAE_OAL_ERROR_TIMEOUT: retVal = SGX_ERROR_SERVICE_TIMEOUT; break; + case UAE_OAL_ERROR_INVALID: + retVal = SGX_ERROR_INVALID_PARAMETER; + break; default: retVal = SGX_ERROR_UNEXPECTED; } diff --git a/sgx-jvm/linux-sgx/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp b/sgx-jvm/linux-sgx/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp index 3ae5311c5b..5b04c54dc2 100644 --- a/sgx-jvm/linux-sgx/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp +++ b/sgx-jvm/linux-sgx/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp @@ -54,7 +54,7 @@ uae_oal_status_t AEServicesImpl::InternalInterface(IAERequest* request, IAERespo { if(request->check() == false) { - return UAE_OAL_ERROR_UNEXPECTED; + return UAE_OAL_ERROR_INVALID; } uae_oal_status_t ipc_status = mTransporter->transact(request, response, timeout_msec); diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/linux/libunwind/src/setjmp/siglongjmp.c b/sgx-jvm/linux-sgx/sdk/cpprt/linux/libunwind/src/setjmp/siglongjmp.c index 4fee4010ae..3308fcdfad 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/linux/libunwind/src/setjmp/siglongjmp.c +++ b/sgx-jvm/linux-sgx/sdk/cpprt/linux/libunwind/src/setjmp/siglongjmp.c @@ -26,6 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define UNW_LOCAL_ONLY #include +#include #include "libunwind_i.h" #include "jmpbuf.h" diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete2.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete2.cpp index ed6bfd783b..e4dc42ed48 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete2.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete2.cpp @@ -36,7 +36,7 @@ #include "sgx_trts.h" #include "internal/util.h" -SGX_WEAK void SGXAPI operator delete (void* ptr, const std::nothrow_t& nothrow_constant) throw() +SGX_WEAK void SGXAPI operator delete (void* ptr, const std::nothrow_t& nothrow_constant) { UNUSED(nothrow_constant); diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete3.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete3.cpp index 6900f2aef0..93cbf11085 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete3.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete3.cpp @@ -36,7 +36,7 @@ #include "sgx_trts.h" #include "internal/util.h" -SGX_WEAK void SGXAPI operator delete (void* ptr, void* voidptr2) throw() +SGX_WEAK void SGXAPI operator delete (void* ptr, void* voidptr2) { UNUSED(ptr); UNUSED(voidptr2); diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete4.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete4.cpp index 916a5b454b..2b729ad3a0 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete4.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete4.cpp @@ -37,7 +37,7 @@ #include "internal/se_cdefs.h" //Deallocate storage space of array -SGX_WEAK void SGXAPI operator delete[] (void* ptr) throw () +SGX_WEAK void SGXAPI operator delete[] (void* ptr) { operator delete(ptr); } diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete5.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete5.cpp index 78c39c2e58..2e4ac7795a 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete5.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete5.cpp @@ -36,7 +36,7 @@ #include "sgx_trts.h" #include "internal/se_cdefs.h" -SGX_WEAK void SGXAPI operator delete[] (void* ptr, const std::nothrow_t& nothrow_constant) throw() +SGX_WEAK void SGXAPI operator delete[] (void* ptr, const std::nothrow_t& nothrow_constant) { operator delete(ptr, nothrow_constant); } diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete6.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete6.cpp index 5ec022edb1..d12200e563 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete6.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/delete6.cpp @@ -36,7 +36,7 @@ #include "sgx_trts.h" #include "internal/util.h" -SGX_WEAK void SGXAPI operator delete[] (void* ptr, void* voidptr2) throw() +SGX_WEAK void SGXAPI operator delete[] (void* ptr, void* voidptr2) { UNUSED(ptr); UNUSED(voidptr2); diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new1.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new1.cpp index d3bd5f70c6..54fb2335da 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new1.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new1.cpp @@ -39,7 +39,7 @@ //aligned to represent an object of that size //and returns a non-null pointer to the first byte of this block. //On failure, it throws a bad_alloc exception. -SGX_WEAK void* SGXAPI operator new(size_t dwBytes) throw(std::bad_alloc) +SGX_WEAK void* SGXAPI operator new(size_t dwBytes) { void* address = malloc(dwBytes); while ( address == NULL ){ diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new2.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new2.cpp index 50a6cdce60..793b92a1db 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new2.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new2.cpp @@ -37,7 +37,7 @@ //nothrow version. //on failure it returns a null pointer instead of throwing an exception. -SGX_WEAK void* SGXAPI operator new (size_t dwBytes, const std::nothrow_t& nothrow_constant) throw() +SGX_WEAK void* SGXAPI operator new (size_t dwBytes, const std::nothrow_t& nothrow_constant) { UNUSED(nothrow_constant); diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new3.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new3.cpp index 56b3e220ad..396f2ea0b2 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new3.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new3.cpp @@ -37,7 +37,7 @@ //placement version //that does not allocate memory - it simply returns ptr. //Notice though that the constructor for the object (if any) will still be called by the operator expression. -SGX_WEAK void* SGXAPI operator new (size_t dwBytes, void* ptr) throw() +SGX_WEAK void* SGXAPI operator new (size_t dwBytes, void* ptr) { if( !sgx_is_within_enclave(ptr, dwBytes) ){ //compiler will check the pointer before call object construct, so it is OK to return NULL here diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new4.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new4.cpp index b8fa871955..c590ef6682 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new4.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new4.cpp @@ -37,7 +37,7 @@ #include "internal/se_cdefs.h" //Allocate storage space for array -SGX_WEAK void* SGXAPI operator new[](size_t dwBytes) throw(std::bad_alloc) +SGX_WEAK void* SGXAPI operator new[](size_t dwBytes) { return operator new(dwBytes); } diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new5.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new5.cpp index 4b9a50f120..c9a70593c0 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new5.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new5.cpp @@ -36,7 +36,7 @@ #include "sgx_trts.h" #include "internal/se_cdefs.h" -SGX_WEAK void* SGXAPI operator new[] (size_t dwBytes, const std::nothrow_t& nothrow_constant) throw() +SGX_WEAK void* SGXAPI operator new[] (size_t dwBytes, const std::nothrow_t& nothrow_constant) { return operator new(dwBytes, nothrow_constant); } diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new6.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new6.cpp index 6b5bbc3f3b..503a2ff018 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new6.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new6.cpp @@ -36,7 +36,7 @@ #include "sgx_trts.h" #include "internal/util.h" -SGX_WEAK void* SGXAPI operator new[] (size_t dwBytes, void* ptr) throw() +SGX_WEAK void* SGXAPI operator new[] (size_t dwBytes, void* ptr) { if( !sgx_is_within_enclave(ptr, dwBytes) ){ //compiler will check the pointer before call object construct, so it is OK to return NULL here diff --git a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new_handler.cpp b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new_handler.cpp index 550850f57c..a55395f559 100644 --- a/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new_handler.cpp +++ b/sgx-jvm/linux-sgx/sdk/cpprt/memory_manage/new_handler.cpp @@ -53,7 +53,7 @@ namespace std{ // Return Value // new_handler - The value of the current new_handler function if this has been previously set by this function // NULL -if this is the first call to set_new_handler - new_handler set_new_handler(new_handler handle) throw() + new_handler set_new_handler(new_handler handle) { sgx_spin_lock(&handler_lock); new_handler retHandle = new_handl; diff --git a/sgx-jvm/linux-sgx/sdk/trts/Makefile b/sgx-jvm/linux-sgx/sdk/trts/Makefile index 840fac201f..a9b12c1242 100644 --- a/sgx-jvm/linux-sgx/sdk/trts/Makefile +++ b/sgx-jvm/linux-sgx/sdk/trts/Makefile @@ -40,7 +40,7 @@ CXXFLAGS += $(ENCLAVE_CXXFLAGS) \ -fno-exceptions \ -fno-rtti -TCXXFLAGS := $(filter-out -fstack-protector-strong, $(CXXFLAGS)) +TCXXFLAGS := $(patsubst -fstack-protector%,-fno-stack-protector,$(CXXFLAGS)) OBJS1 := init_enclave.o \ trts.o \