Skip to content

Commit 6eca705

Browse files
committed
Upgrade to sgx 1.0.9
1 parent e7d8507 commit 6eca705

File tree

7 files changed

+159
-20
lines changed

7 files changed

+159
-20
lines changed

sgx/gbdt-sgx-test/common/inc/dirent.h

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
2+
This file is part of the GNU C Library.
3+
4+
The GNU C Library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
The GNU C Library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with the GNU C Library; if not, see
16+
<http://www.gnu.org/licenses/>. */
17+
18+
#ifndef _DIRENT_H
19+
#define _DIRENT_H
20+
21+
struct dirent
22+
{
23+
#ifndef __USE_FILE_OFFSET64
24+
__ino_t d_ino;
25+
__off_t d_off;
26+
#else
27+
__ino64_t d_ino;
28+
__off64_t d_off;
29+
#endif
30+
unsigned short int d_reclen;
31+
unsigned char d_type;
32+
char d_name[256]; /* We must not include limits.h! */
33+
};
34+
35+
//#ifdef __USE_LARGEFILE64
36+
struct dirent64
37+
{
38+
__ino64_t d_ino;
39+
__off64_t d_off;
40+
unsigned short int d_reclen;
41+
unsigned char d_type;
42+
char d_name[256]; /* We must not include limits.h! */
43+
};
44+
//#endif
45+
46+
#define d_fileno d_ino /* Backwards compatibility. */
47+
48+
#undef _DIRENT_HAVE_D_NAMLEN
49+
#define _DIRENT_HAVE_D_RECLEN
50+
#define _DIRENT_HAVE_D_OFF
51+
#define _DIRENT_HAVE_D_TYPE
52+
53+
#if defined __OFF_T_MATCHES_OFF64_T && defined __INO_T_MATCHES_INO64_T
54+
/* Inform libc code that these two types are effectively identical. */
55+
# define _DIRENT_MATCHES_DIRENT64 1
56+
#else
57+
# define _DIRENT_MATCHES_DIRENT64 0
58+
#endif
59+
#endif

sgx/gbdt-sgx-test/edl/inc/dirent.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions
5+
// are met:
6+
//
7+
// * Redistributions of source code must retain the above copyright
8+
// notice, this list of conditions and the following disclaimer.
9+
// * Redistributions in binary form must reproduce the above copyright
10+
// notice, this list of conditions and the following disclaimer in
11+
// the documentation and/or other materials provided with the
12+
// distribution.
13+
// * Neither the name of Baidu, Inc., nor the names of its
14+
// contributors may be used to endorse or promote products derived
15+
// from this software without specific prior written permission.
16+
//
17+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
29+
#ifndef _EDL_DIRENT_H
30+
#define _EDL_DIRENT_H
31+
32+
struct dirent_t
33+
{
34+
uint64_t d_ino;
35+
int64_t d_off;
36+
unsigned short int d_reclen;
37+
unsigned char d_type;
38+
char d_name[256];
39+
};
40+
41+
struct dirent64_t
42+
{
43+
uint64_t d_ino;
44+
int64_t d_off;
45+
unsigned short int d_reclen;
46+
unsigned char d_type;
47+
char d_name[256];
48+
};
49+
50+
#endif

sgx/gbdt-sgx-test/edl/sgx_env.edl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ enclave {
3636
};
3737

3838
untrusted {
39-
char ** u_env_environ_ocall();
40-
char * u_env_getenv_ocall([in, string] const char *name);
41-
int u_env_setenv_ocall([out] int *error, [in, string] const char *name, [in, string] const char *value, int overwrite);
42-
int u_env_unsetenv_ocall([out] int *error, [in, string] const char *name);
39+
char ** u_environ_ocall();
40+
char * u_getenv_ocall([in, string] const char *name);
41+
int u_setenv_ocall([out] int *error, [in, string] const char *name, [in, string] const char *value, int overwrite);
42+
int u_unsetenv_ocall([out] int *error, [in, string] const char *name);
4343
};
4444
};

sgx/gbdt-sgx-test/edl/sgx_file.edl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
enclave {
3333

3434
include "inc/stat.h"
35+
include "inc/dirent.h"
3536

3637
trusted {
3738
/* define ECALLs here. */
@@ -64,5 +65,12 @@ enclave {
6465
size_t u_readlink_ocall([out] int *error, [in, string] const char *path, [out, size=bufsz] char *buf, size_t bufsz);
6566
int u_symlink_ocall([out] int *error, [in, string] const char *path1, [in, string] const char *path2);
6667
char * u_realpath_ocall([out] int *error, [in, string] const char *pathname);
68+
int u_mkdir_ocall([out] int *error, [in, string] const char *pathname, uint32_t mode);
69+
int u_rmdir_ocall([out] int *error, [in, string] const char *pathname);
70+
void * u_opendir_ocall([out] int *error, [in, string] const char *pathname);
71+
int u_readdir64_r_ocall([out] int *error, [user_check] void *dirp, [in, out] struct dirent64_t *entry, [out] struct dirent64_t **result);
72+
int u_closedir_ocall([out] int *error, [user_check] void *dirp);
73+
int u_dirfd_ocall([out] int *error, [user_check] void *dirp);
74+
int u_fstatat64_ocall([out] int *error, int dirfd, [in, string] const char *pathname, [out] struct stat64_t *buf, int flags);
6775
};
6876
};

sgx/gbdt-sgx-test/enclave/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ default = []
1414
gbdt_sgx = { path = "../../gbdt-sgx", default-features = false, features = ["mesalock_sgx", "input", "enable_training"] }
1515

1616
[target.'cfg(not(target_env = "sgx"))'.dependencies]
17-
sgx_types = { rev = "v1.0.8", git = "https://github.com/baidu/rust-sgx-sdk.git" }
18-
sgx_tstd = { rev = "v1.0.8", git = "https://github.com/baidu/rust-sgx-sdk.git" }
19-
sgx_tunittest = { rev = "v1.0.8", git = "https://github.com/baidu/rust-sgx-sdk.git" }
17+
sgx_types = { rev = "v1.0.9", git = "https://github.com/baidu/rust-sgx-sdk.git" }
18+
sgx_tstd = { rev = "v1.0.9", git = "https://github.com/baidu/rust-sgx-sdk.git" }
19+
sgx_tunittest = { rev = "v1.0.9", git = "https://github.com/baidu/rust-sgx-sdk.git" }

sgx/gbdt-sgx-test/enclave/Xargo.toml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
[dependencies]
22
alloc = {}
3-
panic_unwind = {}
4-
panic_abort = {}
53

64
[dependencies.sgx_types]
75
git = "https://github.com/baidu/rust-sgx-sdk.git"
86
stage = 1
97

8+
[dependencies.sgx_demangle]
9+
git = "https://github.com/baidu/rust-sgx-sdk.git"
10+
stage = 1
11+
12+
[dependencies.panic_abort]
13+
git = "https://github.com/baidu/rust-sgx-sdk.git"
14+
stage = 1
15+
1016
[dependencies.sgx_libc]
1117
git = "https://github.com/baidu/rust-sgx-sdk.git"
1218
stage = 2
@@ -31,6 +37,14 @@ stage = 2
3137
git = "https://github.com/baidu/rust-sgx-sdk.git"
3238
stage = 3
3339

40+
[dependencies.sgx_backtrace_sys]
41+
git = "https://github.com/baidu/rust-sgx-sdk.git"
42+
stage = 3
43+
44+
[dependencies.sgx_unwind]
45+
git = "https://github.com/baidu/rust-sgx-sdk.git"
46+
stage = 4
47+
3448
[dependencies.sgx_tdh]
3549
git = "https://github.com/baidu/rust-sgx-sdk.git"
3650
stage = 4
@@ -39,30 +53,38 @@ stage = 4
3953
git = "https://github.com/baidu/rust-sgx-sdk.git"
4054
stage = 4
4155

56+
[dependencies.sgx_tprotected_fs]
57+
git = "https://github.com/baidu/rust-sgx-sdk.git"
58+
stage = 4
59+
4260
[dependencies.sgx_alloc]
4361
git = "https://github.com/baidu/rust-sgx-sdk.git"
4462
stage = 4
4563

46-
[dependencies.std]
64+
[dependencies.panic_unwind]
4765
git = "https://github.com/baidu/rust-sgx-sdk.git"
48-
features = ["untrusted_fs"]
4966
stage = 5
5067

51-
[dependencies.sgx_rand]
68+
[dependencies.std]
5269
git = "https://github.com/baidu/rust-sgx-sdk.git"
5370
stage = 6
5471

72+
[dependencies.sgx_rand]
73+
git = "https://github.com/baidu/rust-sgx-sdk.git"
74+
stage = 7
75+
5576
[dependencies.sgx_serialize]
5677
git = "https://github.com/baidu/rust-sgx-sdk.git"
57-
stage = 6
78+
stage = 7
5879

5980
[dependencies.sgx_tunittest]
6081
git = "https://github.com/baidu/rust-sgx-sdk.git"
61-
stage = 6
82+
stage = 7
6283

63-
[dependencies.sgx_tprotected_fs]
84+
[dependencies.sgx_backtrace]
6485
git = "https://github.com/baidu/rust-sgx-sdk.git"
65-
stage = 4
86+
stage = 8
6687

67-
[patch.crates-io]
68-
libc = { git = "https://github.com/mesalock-linux/libc-sgx" }
88+
[dependencies.sgx_cov]
89+
git = "https://github.com/baidu/rust-sgx-sdk.git"
90+
stage = 8

sgx/gbdt-sgx/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ crate-type = ["rlib", "staticlib"]
2626
serde = { git = "https://github.com/mesalock-linux/serde-sgx.git" }
2727
serde_derive = { git = "https://github.com/mesalock-linux/serde-sgx.git" }
2828
serde_json = { git = "https://github.com/mesalock-linux/serde-json-sgx.git" }
29-
rand={ version = "0.6", optional = true, git = "https://github.com/mesalock-linux/rand-sgx.git", tag = "v0.6.5_sgx1.0.8" }
29+
rand={ version = "0.6", optional = true, git = "https://github.com/mesalock-linux/rand-sgx.git", tag = "v0.6.5_sgx1.0.9" }
3030
regex = { version = "1", git = "https://github.com/mesalock-linux/regex-sgx", optional = true }
3131
time = { version = "0.1", optional = true }
32-
sgx_tstd = { rev = "v1.0.8", git = "https://github.com/baidu/rust-sgx-sdk.git", optional = true }
32+
sgx_tstd = { rev = "v1.0.9", git = "https://github.com/baidu/rust-sgx-sdk.git", optional = true }
3333
cfg-if = "0.1"
3434

3535
[dev-dependencies]

0 commit comments

Comments
 (0)