提交 207a059f 编写于 作者: jia zhang's avatar jia zhang

rune/libenclave: Preload libsgx_launch.so

Due to the design of runelet, the Enclave Runtime PAL is loaded
in host but launched in container. The fact that certain libraries
from Intel SGX PSW would use dlopen() to further load libsgx_launch.so,
which means the container has to have it. In  order to ensure all
libraries dependent by Enclave Runtime PAL are completely loaded in
host, preload them prior to switch into container.
Signed-off-by: jia zhang's avatarJia Zhang <zhang.jia@linux.alibaba.com>
上级 7a24a609
package intelsgx // import "github.com/opencontainers/runc/libenclave/intelsgx"
/*
#cgo linux LDFLAGS: -ldl
#include <stdlib.h>
#include <dlfcn.h>
*/
import "C"
import (
"unsafe"
)
// Due to the design of runelet, the Enclave Runtime PAL is loaded
// in host but launched in container. The fact that certain libraries
// from Intel SGX PSW would use dlopen() to further load
// libsgx_launch.so, which means the container has to have it. In
// order to ensure all libraries dependent by Enclave Runtime PAL
// are completely loaded in host, preload them prior to switch
// into container.
func preloadSgxPswLib() {
path := C.CString("libsgx_launch.so")
C.dlopen(path, C.RTLD_NOW)
C.free(unsafe.Pointer(path))
}
func init() {
preloadSgxPswLib()
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册