sgx-lkl icon indicating copy to clipboard operation
sgx-lkl copied to clipboard

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

Open wintersteiger opened this issue 5 years ago • 3 comments

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

Goes with https://github.com/lsds/sgx-lkl-musl/pull/36.

wintersteiger avatar Aug 19 '20 11:08 wintersteiger

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: https://github.com/lsds/sgx-lkl/blob/9979a88fa90cca275dcb0822deef5e0393cea88a/src/main-oe/sgxlkl_params.c#L3 I'm not sure this is still useful (see bunch of commented code further up in the file). Can I remove it?

wintersteiger avatar Aug 19 '20 11:08 wintersteiger

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: https://github.com/lsds/sgx-lkl/blob/9979a88fa90cca275dcb0822deef5e0393cea88a/src/main-oe/sgxlkl_params.c#L3

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.

prp avatar Sep 17 '20 10:09 prp

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

wintersteiger avatar Sep 17 '20 10:09 wintersteiger