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

Add proper tracing options, remove getenv calls from enclave code. #806

Open
wants to merge 16 commits into
base: oe_port
Choose a base branch
from

Conversation

wintersteiger
Copy link
Contributor

This adds proper tracing options, which removes the need for getenv calls in the enclave. Fixes #780.

Goes with lsds/sgx-lkl-musl#36.

@wintersteiger
Copy link
Contributor Author

There's one relevant getenv call in musl, see https://github.com/lsds/sgx-lkl-musl/blob/a6360f883fd906b18c1878254547ad72da28d7e6/ldso/dynlink.c#L822. This is now the only tracing/debug env var that gets passed through to the enclave as an env var:

const char* sgxlkl_auto_passthrough[1] = {"SGXLKL_DEBUGMOUNT"};

I'm not sure this is still useful (see bunch of commented code further up in the file). Can I remove it?

src/lkl/setup.c Outdated Show resolved Hide resolved
src/lkl/setup.c Outdated Show resolved Hide resolved
src/lkl/setup.c Outdated Show resolved Hide resolved
src/lkl/setup.c Show resolved Hide resolved
src/main-oe/env.c Show resolved Hide resolved
src/enclave/enclave_init.c Outdated Show resolved Hide resolved
src/enclave/enclave_init.c Show resolved Hide resolved
src/enclave/enclave_signal.c Show resolved Hide resolved
src/enclave/enclave_init.c Show resolved Hide resolved
src/enclave/enclave_init.c Show resolved Hide resolved
src/include/shared/oe_compat.h Outdated Show resolved Hide resolved
src/lkl/setup.c Show resolved Hide resolved
src/lkl/setup.c Outdated Show resolved Hide resolved
src/lkl/setup.c Outdated Show resolved Hide resolved
src/main-oe/env.c Show resolved Hide resolved
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
Copy link
Member

@prp prp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left minor questions.

src/enclave/enclave_oe.c Show resolved Hide resolved
src/include/enclave/enclave_state.h Show resolved Hide resolved
@prp
Copy link
Member

prp commented Sep 17, 2020

There's one relevant getenv call in musl, see https://github.com/lsds/sgx-lkl-musl/blob/a6360f883fd906b18c1878254547ad72da28d7e6/ldso/dynlink.c#L822. This is now the only tracing/debug env var that gets passed through to the enclave as an env var:

const char* sgxlkl_auto_passthrough[1] = {"SGXLKL_DEBUGMOUNT"};

I'm not sure this is still useful (see bunch of commented code further up in the file). Can I remove it?

This is part of a mechanism that, instead of loading debug symbols inside the enclave and then passing a pointer to gdb, it allows the enclave image to be mounted outside and thus gdb can access the files with symbols directly. For large applications (e.g. TF), this results in much better performance during debugging.

@wintersteiger
Copy link
Contributor Author

Great, thanks for the explanation, then it makes sense to keep it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove getenv calls before libc startup
3 participants