Skip to content

Commit edb071b

Browse files
committed
Clean up leftovers from EPID/legacy drivers deprecation
Signed-off-by: Michał Kowalczyk <[email protected]>
1 parent faa837b commit edb071b

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

.pylintrc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ ignored-classes=
160160
optparse.Values,
161161
pathlib.PurePath,
162162
thread._local,
163-
GetTokenReq,
164-
GetTokenRet,
165163

166164
# List of module names for which member attributes should not be checked
167165
# (useful for modules/projects where namespaces are manipulated during runtime

Documentation/devel/coding-style.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,10 @@ Meson
200200
tied to the script name (see :file:`meson.build` there). The scripts should
201201
be written in Python except for things that clearly benefit from being
202202
written in ``sh``.
203+
204+
Tools outputs
205+
-------------
206+
207+
When writing a Gramine tool which outputs data (e.g. dumps some SGX structures)
208+
please follow the formatting and conventions used in
209+
:program:`gramine-sgx-sigstruct-view`.

pal/src/host/linux-sgx/host_framework.c

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,17 @@ static void* g_zero_pages = NULL;
1313
static size_t g_zero_pages_size = 0;
1414

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

3929
static void get_optional_sgx_features(uint64_t xfrm, uint64_t xfrm_mask, uint64_t* out_xfrm) {

python/gramine-sgx-sigstruct-view

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def main(sigfile, verbose, output_format, output):
4949
elif output_format == "json":
5050
json.dump(sig_readable, output_txt, indent=4)
5151
else:
52-
# plaintext format imitates the legacy output of `gramine-sgx-get-token` tool
5352
print('Attributes:', file=output_txt)
5453
for key, value in sig_readable.items():
5554
print(f' {key}: {value}', file=output_txt)

0 commit comments

Comments
 (0)