Skip to content

Commit

Permalink
Upgrade to sgx 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dingelish committed Apr 23, 2020
1 parent 1da8e71 commit eec927f
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 22 deletions.
32 changes: 16 additions & 16 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ name: gbdt-sgx-xargo-1604-sw

steps:
- name: sim-compile
image: baiduxlab/sgx-rust:1604-1.1.1
image: baiduxlab/sgx-rust:1604-1.1.2
pull: always
environment:
SGX_MODE: SW
Expand All @@ -394,7 +394,7 @@ steps:
- cd sgx && make -C gbdt-sgx-test

- name: sim-test
image: baiduxlab/sgx-rust:1604-1.1.1
image: baiduxlab/sgx-rust:1604-1.1.2
pull: always
commands:
- . /opt/sgxsdk/environment
Expand All @@ -410,7 +410,7 @@ name: gbdt-sgx-xargo-1604-hw

steps:
- name: hw-compile
image: baiduxlab/sgx-rust:1604-1.1.1
image: baiduxlab/sgx-rust:1604-1.1.2
pull: always
environment:
SGX_MODE: HW
Expand All @@ -421,7 +421,7 @@ steps:
- cd sgx && make -C gbdt-sgx-test

- name: hw-test
image: baiduxlab/sgx-rust:1604-1.1.1
image: baiduxlab/sgx-rust:1604-1.1.2
pull: always
privileged: true
volumes:
Expand Down Expand Up @@ -453,7 +453,7 @@ name: gbdt-sgx-xargo-1804-sw

steps:
- name: sim-compile
image: baiduxlab/sgx-rust:1804-1.1.1
image: baiduxlab/sgx-rust:1804-1.1.2
pull: always
environment:
SGX_MODE: SW
Expand All @@ -464,7 +464,7 @@ steps:
- cd sgx && make -C gbdt-sgx-test

- name: sim-test
image: baiduxlab/sgx-rust:1804-1.1.1
image: baiduxlab/sgx-rust:1804-1.1.2
pull: always
commands:
- . /opt/sgxsdk/environment
Expand All @@ -480,7 +480,7 @@ name: gbdt-sgx-xargo-1804-hw

steps:
- name: hw-compile
image: baiduxlab/sgx-rust:1804-1.1.1
image: baiduxlab/sgx-rust:1804-1.1.2
pull: always
environment:
SGX_MODE: HW
Expand All @@ -491,7 +491,7 @@ steps:
- cd sgx && make -C gbdt-sgx-test

- name: hw-test
image: baiduxlab/sgx-rust:1804-1.1.1
image: baiduxlab/sgx-rust:1804-1.1.2
pull: always
privileged: true
volumes:
Expand Down Expand Up @@ -523,7 +523,7 @@ name: gbdt-sgx-1604-sw

steps:
- name: sim-compile
image: baiduxlab/sgx-rust:1604-1.1.1
image: baiduxlab/sgx-rust:1604-1.1.2
pull: always
environment:
SGX_MODE: SW
Expand All @@ -534,7 +534,7 @@ steps:
- make -C sgx/gbdt-sgx-test

- name: sim-test
image: baiduxlab/sgx-rust:1604-1.1.1
image: baiduxlab/sgx-rust:1604-1.1.2
pull: always
commands:
- . /opt/sgxsdk/environment
Expand All @@ -550,7 +550,7 @@ name: gbdt-sgx-1604-hw

steps:
- name: hw-compile
image: baiduxlab/sgx-rust:1604-1.1.1
image: baiduxlab/sgx-rust:1604-1.1.2
pull: always
environment:
SGX_MODE: HW
Expand All @@ -561,7 +561,7 @@ steps:
- make -C sgx/gbdt-sgx-test

- name: hw-test
image: baiduxlab/sgx-rust:1604-1.1.1
image: baiduxlab/sgx-rust:1604-1.1.2
pull: always
privileged: true
volumes:
Expand Down Expand Up @@ -593,7 +593,7 @@ name: gbdt-sgx-1804-sw

steps:
- name: sim-compile
image: baiduxlab/sgx-rust:1804-1.1.1
image: baiduxlab/sgx-rust:1804-1.1.2
pull: always
environment:
SGX_MODE: SW
Expand All @@ -604,7 +604,7 @@ steps:
- make -C sgx/gbdt-sgx-test

- name: sim-test
image: baiduxlab/sgx-rust:1804-1.1.1
image: baiduxlab/sgx-rust:1804-1.1.2
pull: always
commands:
- . /opt/sgxsdk/environment
Expand All @@ -620,7 +620,7 @@ name: gbdt-sgx-1804-hw

steps:
- name: hw-compile
image: baiduxlab/sgx-rust:1804-1.1.1
image: baiduxlab/sgx-rust:1804-1.1.2
pull: always
environment:
SGX_MODE: HW
Expand All @@ -631,7 +631,7 @@ steps:
- make -C sgx/gbdt-sgx-test

- name: hw-test
image: baiduxlab/sgx-rust:1804-1.1.1
image: baiduxlab/sgx-rust:1804-1.1.2
pull: always
privileged: true
volumes:
Expand Down
72 changes: 72 additions & 0 deletions sgx/gbdt-sgx-test/common/inc/signal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

#ifndef _SIGNAL_H
#define _SIGNAL_H

#define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
typedef struct
{
unsigned long int __val[_SIGSET_NWORDS];
} __sigset_t;

typedef __sigset_t sigset_t;

struct sigaction
{
/* Signal handler. */
#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
union
{
/* Used if SA_SIGINFO is not set. */
void (*sa_handler) (int);
/* Used if SA_SIGINFO is set. */
void (*sa_sigaction) (int, siginfo_t *, void *);
}
__sigaction_handler;
#define sa_handler __sigaction_handler.sa_handler
#define sa_sigaction __sigaction_handler.sa_sigaction
#else
void (*sa_handler) (int);
#endif

/* Additional set of signals to be blocked. */
__sigset_t sa_mask;

/* Special flags. */
int sa_flags;

/* Restore handler. */
void (*sa_restorer) (void);
};

#define __SI_MAX_SIZE 128
#define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)

typedef struct
{
int si_signo; /* Signal number. */

int si_errno; /* If non-zero, an errno value associated with
this signal, as defined in <errno.h>. */
int si_code; /* Signal code. */

int __pad0;
int _pad[__SI_PAD_SIZE];
} siginfo_t;

#endif
28 changes: 28 additions & 0 deletions sgx/gbdt-sgx-test/edl/sgx_process.edl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

enclave {

trusted {
/* define ECALLs here. */

};

untrusted {
int u_getpid_ocall();
};
};
43 changes: 43 additions & 0 deletions sgx/gbdt-sgx-test/edl/sgx_signal.edl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

enclave {
include "signal.h"

trusted {
/* define ECALLs here. */
public int t_signal_handler_ecall([in]const siginfo_t *info);
};

untrusted {
int u_sigaction_ocall([out]int *error,
int signum,
[in] const struct sigaction *act,
[out] struct sigaction *oldact,
uint64_t enclave_id);

int u_sigprocmask_ocall([out]int *error,
int signum,
[in] const sigset_t *set,
[out] sigset_t *oldset);

int u_raise_ocall(int signum) allow(t_signal_handler_ecall);

void u_signal_clear_ocall(uint64_t enclave_id);
};
};

1 change: 1 addition & 0 deletions sgx/gbdt-sgx-test/edl/sgx_thread.edl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enclave {
include "time.h"

from "intel/sgx_pthread.edl" import *;
from "sgx_sys.edl" import *;

trusted {
/* define ECALLs here. */
Expand Down
6 changes: 3 additions & 3 deletions sgx/gbdt-sgx-test/enclave/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ default = []
gbdt_sgx = { path = "../../gbdt-sgx", default-features = false, features = ["mesalock_sgx", "input", "enable_training"] }

[target.'cfg(not(target_env = "sgx"))'.dependencies]
sgx_types = { rev = "v1.1.1", git = "https://github.com/apache/teaclave-sgx-sdk.git" }
sgx_tstd = { rev = "v1.1.1", git = "https://github.com/apache/teaclave-sgx-sdk.git" }
sgx_tunittest = { rev = "v1.1.1", git = "https://github.com/apache/teaclave-sgx-sdk.git" }
sgx_types = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" }
sgx_tstd = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" }
sgx_tunittest = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk.git" }
6 changes: 5 additions & 1 deletion sgx/gbdt-sgx-test/enclave/Xargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ stage = 4

[dependencies.std]
git = "https://github.com/apache/teaclave-sgx-sdk.git"
features = ["untrusted_fs", "backtrace", "net"]
stage = 5
features = ["backtrace"]

[dependencies.sgx_no_tstd]
git = "https://github.com/apache/teaclave-sgx-sdk.git"
Expand All @@ -89,3 +89,7 @@ stage = 7
[dependencies.sgx_cov]
git = "https://github.com/apache/teaclave-sgx-sdk.git"
stage = 7

[dependencies.sgx_signal]
git = "https://github.com/apache/teaclave-sgx-sdk.git"
stage = 7
4 changes: 2 additions & 2 deletions sgx/gbdt-sgx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ crate-type = ["rlib", "staticlib"]
serde = { git = "https://github.com/mesalock-linux/serde-sgx" }
serde_derive = { git = "https://github.com/mesalock-linux/serde-sgx" }
serde_json = { git = "https://github.com/mesalock-linux/serde-json-sgx" }
rand = { version = "0.7", optional = true, git = "https://github.com/mesalock-linux/rand-sgx", tag = "v0.6.5_sgx1.1.1" }
rand = { version = "0.7", optional = true, git = "https://github.com/mesalock-linux/rand-sgx", tag = "v0.7.3_sgx1.1.2" }
regex = { version = "1", git = "https://github.com/mesalock-linux/regex-sgx", optional = true }
time = { version = "0.1", optional = true }
sgx_tstd = { rev = "v1.1.1", git = "https://github.com/apache/teaclave-sgx-sdk", optional = true }
sgx_tstd = { rev = "v1.1.2", git = "https://github.com/apache/teaclave-sgx-sdk", optional = true }
cfg-if = "0.1"

[dev-dependencies]
Expand Down

0 comments on commit eec927f

Please sign in to comment.