Make a workaround for EGO when fstat returns NOT_SUPPORT (#1970)
The problem was found by a `Golang + WAMR (as CGO)` wrapped by EGO in SGX Enclave. `fstat()` in EGO returns dummy values: - EGO uses a `mount` configuration to define the mount points that apply the host file system presented to the Encalve. - EGO has a different programming model: the entire application runs inside the enclave. Manual ECALLs/OCALLs by application code are neither required nor possible. Add platform ego and add macro control for the return value checking of `fd_determine_type_rights` in libc-wasi to resolve the issue.
This commit is contained in:
6
core/shared/platform/ego/platform_init.c
Normal file
6
core/shared/platform/ego/platform_init.c
Normal file
@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "../linux/platform_init.c"
|
||||
6
core/shared/platform/ego/platform_internal.h
Normal file
6
core/shared/platform/ego/platform_internal.h
Normal file
@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "../linux/platform_internal.h"
|
||||
20
core/shared/platform/ego/shared_platform.cmake
Normal file
20
core/shared/platform/ego/shared_platform.cmake
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
set (PLATFORM_SHARED_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
add_definitions(-DBH_PLATFORM_EGO)
|
||||
|
||||
include_directories(${PLATFORM_SHARED_DIR})
|
||||
include_directories(${PLATFORM_SHARED_DIR}/../include)
|
||||
|
||||
include (${CMAKE_CURRENT_LIST_DIR}/../common/posix/platform_api_posix.cmake)
|
||||
|
||||
set (PLATFORM_SHARED_SOURCE
|
||||
${PLATFORM_COMMON_POSIX_SOURCE}
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform_init.c
|
||||
)
|
||||
|
||||
LIST (APPEND RUNTIME_LIB_HEADER_LIST
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform_internal.h
|
||||
)
|
||||
Reference in New Issue
Block a user