Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some nitpicks and letfovers from other PRs #2075

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ ignored-classes=
optparse.Values,
pathlib.PurePath,
thread._local,
GetTokenReq,
GetTokenRet,

# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
Expand Down
2 changes: 1 addition & 1 deletion CI-Examples/ra-tls-mbedtls/src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static int my_verify_callback(void* data, mbedtls_x509_crt* crt, int depth, uint
(struct ra_tls_verify_callback_results*)data);
}

static bool getenv_client_inside_sgx() {
static bool getenv_client_inside_sgx(void) {
char* str = getenv("RA_TLS_CLIENT_INSIDE_SGX");
if (!str)
return false;
Expand Down
2 changes: 1 addition & 1 deletion libos/src/sys/libos_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ long libos_syscall_sendfile(int out_fd, int in_fd, off_t* offset, size_t count)

out:
if (buf == g_sendfile_buf)
__atomic_store_n(&g_sendfile_buf_in_use, 0, __ATOMIC_RELEASE);
__atomic_store_n(&g_sendfile_buf_in_use, false, __ATOMIC_RELEASE);
else
free(buf);
put_handle(in_hdl);
Expand Down
30 changes: 10 additions & 20 deletions pal/src/host/linux-sgx/host_framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,17 @@ static void* g_zero_pages = NULL;
static size_t g_zero_pages_size = 0;

int open_sgx_driver(void) {
const char* paths_to_try[] = {
/* DCAP and upstreamed version used different paths in the past. */
"/dev/sgx_enclave",
"/dev/sgx/enclave",
};
int ret;
for (size_t i = 0; i < ARRAY_SIZE(paths_to_try); i++) {
ret = DO_SYSCALL(open, paths_to_try[i], O_RDWR | O_CLOEXEC, 0);
if (ret == -EACCES) {
log_error("Cannot open %s (permission denied). This may happen because the current "
"user has insufficient permissions to this device.", paths_to_try[i]);
return ret;
}
if (ret >= 0) {
g_isgx_device = ret;
return 0;
}
const char* path = "/dev/sgx_enclave";
int ret = DO_SYSCALL(open, path, O_RDWR | O_CLOEXEC, 0);
if (ret < 0) {
log_error("Cannot open %s (%s). This may happen because the current user has insufficient"
"permissions to this device, your kernel is too old or your machine doesn't "
"support SGX. Use is-sgx-available tool to get more information.",
path, unix_strerror(ret));
return ret;
}
log_error("Cannot open SGX driver device. Please make sure you're using an up-to-date kernel "
"or the standalone Intel SGX kernel module is loaded.");
return ret;
g_isgx_device = ret;
return 0;
}

static void get_optional_sgx_features(uint64_t xfrm, uint64_t xfrm_mask, uint64_t* out_xfrm) {
Expand Down
2 changes: 1 addition & 1 deletion pal/src/pal_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ noreturn void pal_main(uint64_t instance_id, /* current instance id */
PAL_HANDLE parent_process, /* parent process if it's a child */
PAL_HANDLE first_thread, /* first thread handle */
const char** arguments, /* application arguments */
const char** environments /* environment variables */,
const char** environments, /* environment variables */
void (*post_callback)(void) /* callback into host-specific loader */) {
if (!instance_id) {
assert(!parent_process);
Expand Down
1 change: 0 additions & 1 deletion python/gramine-sgx-sigstruct-view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def main(sigfile, verbose, output_format, output):
elif output_format == "json":
json.dump(sig_readable, output_txt, indent=4)
else:
# plaintext format imitates the legacy output of `gramine-sgx-get-token` tool
print('Attributes:', file=output_txt)
for key, value in sig_readable.items():
print(f' {key}: {value}', file=output_txt)
Expand Down