Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
inclavare-containers
提交
b510b4b7
I
inclavare-containers
项目概览
openanolis
/
inclavare-containers
通知
4
Star
7
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
0
分析
仓库
DevOps
项目成员
Pages
I
inclavare-containers
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b510b4b7
编写于
8月 12, 2020
作者:
H
haosanzi
提交者:
GitHub
8月 12, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rune/libenclave/skeleton: Support PAI API v2
Signed-off-by:
N
Shirong Hao
<
shirong@linux.alibaba.com
>
上级
1da86f11
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
96 addition
and
6 deletion
+96
-6
rune/libenclave/internal/runtime/pal/skeleton/Makefile
rune/libenclave/internal/runtime/pal/skeleton/Makefile
+7
-1
rune/libenclave/internal/runtime/pal/skeleton/liberpal-skeleton-v2.c
...lave/internal/runtime/pal/skeleton/liberpal-skeleton-v2.c
+70
-0
rune/libenclave/internal/runtime/pal/skeleton/liberpal-skeleton.c
...enclave/internal/runtime/pal/skeleton/liberpal-skeleton.c
+2
-5
rune/libenclave/internal/runtime/pal/skeleton/liberpal-skeleton.h
...enclave/internal/runtime/pal/skeleton/liberpal-skeleton.h
+17
-0
未找到文件。
rune/libenclave/internal/runtime/pal/skeleton/Makefile
浏览文件 @
b510b4b7
...
...
@@ -12,7 +12,7 @@ HOST_LDFLAGS := -fPIC -shared -Wl,-Bsymbolic
IS_OOT_DRIVER
:=
$(
shell
[
!
-e
/dev/isgx
]
)
IS_SGX_FLC
:=
$(
shell
lscpu |
grep
-q
sgx_lc
)
TEST_CUSTOM_PROGS
:=
$(OUTPUT)
/encl.bin
$(OUTPUT)
/encl.ss
$(OUTPUT)
/liberpal-skeleton-v1.so
$(OUTPUT)
/signing_key.pem
TEST_CUSTOM_PROGS
:=
$(OUTPUT)
/encl.bin
$(OUTPUT)
/encl.ss
$(OUTPUT)
/liberpal-skeleton-v1.so
$(OUTPUT)
/
liberpal-skeleton-v2.so
$(OUTPUT)
/
signing_key.pem
ifeq
($(IS_OOT_DRIVER),1)
TEST_CUSTOM_PROGS
+=
$(OUTPUT)
/encl.token
...
...
@@ -28,6 +28,12 @@ $(OUTPUT)/liberpal-skeleton-v1.so: $(OUTPUT)/sgx_call.o $(OUTPUT)/liberpal-skele
$(OUTPUT)/liberpal-skeleton-v1.o
:
liberpal-skeleton-v1.c liberpal-skeleton.c
$(CC)
$(HOST_CFLAGS)
-c
$<
-o
$@
$(OUTPUT)/liberpal-skeleton-v2.so
:
$(OUTPUT)/sgx_call.o $(OUTPUT)/liberpal-skeleton-v2.o $(OUTPUT)/liberpal-skeleton.o
$(CC)
$(HOST_LDFLAGS)
-o
$@
$^
$(OUTPUT)/liberpal-skeleton-v2.o
:
liberpal-skeleton-v2.c liberpal-skeleton.c
$(CC)
$(HOST_CFLAGS)
-c
$<
-o
$@
$(OUTPUT)/liberpal-skeleton.o
:
liberpal-skeleton.c
$(CC)
$(HOST_CFLAGS)
-c
$<
-o
$@
...
...
rune/libenclave/internal/runtime/pal/skeleton/liberpal-skeleton-v2.c
0 → 100644
浏览文件 @
b510b4b7
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
#include "liberpal-skeleton.h"
int
pal_get_version
(
void
)
{
return
2
;
}
int
pal_init
(
pal_attr_t
*
attr
)
{
if
(
is_oot_driver
)
{
fprintf
(
stderr
,
"Skeleton PAL API v2 doesn't support SGX OOT driver!
\n
"
);
return
-
1
;
}
return
__pal_init
(
attr
);
}
int
pal_create_process
(
pal_create_process_args
*
args
)
{
if
(
args
==
NULL
||
args
->
path
==
NULL
||
args
->
argv
==
NULL
||
args
->
pid
==
NULL
||
args
->
stdio
==
NULL
)
{
errno
=
EINVAL
;
return
-
1
;
}
int
pid
;
if
((
pid
=
fork
())
<
0
)
return
-
1
;
else
if
(
pid
==
0
)
{
int
exit_code
,
ret
;
ret
=
__pal_exec
(
args
->
path
,
args
->
argv
,
args
->
stdio
,
&
exit_code
);
exit
(
ret
?
ret
:
exit_code
);
}
else
*
args
->
pid
=
pid
;
return
0
;
}
int
pal_exec
(
pal_exec_args
*
attr
)
{
if
(
attr
==
NULL
||
attr
->
exit_value
==
NULL
)
{
errno
=
EINVAL
;
return
-
1
;
}
int
status
;
waitpid
(
attr
->
pid
,
&
status
,
0
);
if
(
WIFEXITED
(
status
)
||
WIFSIGNALED
(
status
))
*
attr
->
exit_value
=
WEXITSTATUS
(
status
);
return
0
;
}
int
pal_kill
(
int
pid
,
int
sig
)
{
/* No implementation */
return
0
;
}
int
pal_destroy
(
void
)
{
return
__pal_destory
();
}
rune/libenclave/internal/runtime/pal/skeleton/liberpal-skeleton.c
浏览文件 @
b510b4b7
...
...
@@ -4,7 +4,6 @@
#include <elf.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
...
...
@@ -36,9 +35,9 @@
static
struct
sgx_secs
secs
;
static
bool
initialized
=
false
;
static
char
*
sgx_dev_path
;
static
bool
is_oot_driver
;
static
bool
no_sgx_flc
=
false
;
static
bool
fork_test
=
false
;
bool
is_oot_driver
;
/*
* For SGX in-tree driver, dev_fd cannot be closed until an enclave instance
* intends to exit.
...
...
@@ -60,7 +59,7 @@ static bool is_sgx_device(const char *dev)
return
false
;
}
static
void
detect_driver_type
(
void
)
__attribute__
((
constructor
))
static
void
detect_driver_type
(
void
)
{
if
(
is_sgx_device
(
"/dev/isgx"
))
{
sgx_dev_path
=
"/dev/isgx"
;
...
...
@@ -410,8 +409,6 @@ int __pal_init(pal_attr_t *attr)
parse_args
(
attr
->
args
);
detect_driver_type
();
tcs_busy
=
mmap
(
NULL
,
PAGE_SIZE
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
|
MAP_ANONYMOUS
,
-
1
,
0
);
if
(
tcs_busy
==
MAP_FAILED
)
...
...
rune/libenclave/internal/runtime/pal/skeleton/liberpal-skeleton.h
浏览文件 @
b510b4b7
#ifndef LIBERPAL_SKELETON_H
#define LIBERPAL_SKELETON_H
#include <stdbool.h>
extern
bool
is_oot_driver
;
typedef
struct
{
const
char
*
args
;
const
char
*
log_level
;
...
...
@@ -10,6 +14,19 @@ typedef struct {
int
stdin
,
stdout
,
stderr
;
}
pal_stdio_fds
;
typedef
struct
{
char
*
path
;
char
**
argv
;
char
**
env
;
pal_stdio_fds
*
stdio
;
int
*
pid
;
}
pal_create_process_args
;
typedef
struct
{
int
pid
;
int
*
exit_value
;
}
pal_exec_args
;
int
__pal_init
(
pal_attr_t
*
attr
);
int
__pal_exec
(
char
*
path
,
char
*
argv
[],
pal_stdio_fds
*
stdio
,
int
*
exit_code
);
int
__pal_destory
(
void
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录