mirror of
https://github.com/corda/corda.git
synced 2024-12-27 08:22:35 +00:00
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 <xun.li@intel.com> Date: Wed Sep 20 10:51:18 2017 +0800 Update libunwind for glibc 2.26 compatibility libunwind should include <signal.h> 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 <xun.li@intel.com> commit 9cda5c4774b2f4fc02fd031f98057cd88d14f2e0 Merge: 94c162c98 36918f071 Author: lzha101 <lili.z.zhang@intel.com> 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 <chris.rankin@r3.com> Date: Tue Sep 19 07:31:57 2017 +0000 Ensure trts_nsp.cpp is compiled without stack protection. Signed-off-by: Chris Rankin <chris.rankin@r3.com> commit 94c162c98bf95a034eadb41bfa6e6a35f410a0c8 Author: Kai Mast <kaimast@cs.cornell.edu> Date: Mon Sep 18 04:07:19 2017 -0400 g++7 fixes (#148) Signed-off-by: Li, Xun<xun.li@intel.com> commit 8a72fed8737dc8e331889e6530925fc5a0be2ea0 Merge: 2133df2d4 635e3a370 Author: Li Xun <xun.li@intel.com> 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 <xun.li@intel.com> commit 635e3a37081ad3f773a0ff24c89f1e6094034d28 Author: Chris Rankin <chris.rankin@r3.com> Date: Wed Sep 13 10:31:11 2017 +0100 Resolve warnings about deprecated throw(std::bad_alloc) in C++11.
This commit is contained in:
parent
4afe8c2a97
commit
04a801e0cd
@ -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 */
|
||||
|
@ -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_ */
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <se_trace.h>
|
||||
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;
|
||||
|
@ -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();
|
||||
|
@ -34,10 +34,10 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <IAERequest.h>
|
||||
#include <IAEResponse.h>
|
||||
|
||||
#include <se_trace.h>
|
||||
#include <UnixCommunicationSocket.h>
|
||||
|
||||
|
||||
@ -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())
|
||||
{
|
||||
|
@ -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) $@
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -26,6 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#define UNW_LOCAL_ONLY
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "libunwind_i.h"
|
||||
#include "jmpbuf.h"
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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 ){
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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 \
|
||||
|
Loading…
Reference in New Issue
Block a user