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

sgx-gdb does not work with sgx_create_enclave_from_buffer_ex #482

Open
sethmoo opened this issue Jan 14, 2020 · 2 comments
Open

sgx-gdb does not work with sgx_create_enclave_from_buffer_ex #482

sethmoo opened this issue Jan 14, 2020 · 2 comments

Comments

@sethmoo
Copy link
Contributor

sethmoo commented Jan 14, 2020

If an enclave is loaded with sgx_create_enclave_from_buffer_ex, then the sgx-gdb doesn't work. We get a Python exception every time the gdb extension script is called:
Python Exception <class 'gdb.error'> No symbol table is loaded. Use the "file" command.:

It appears that retrieve_enclave_info assumes the enclave was loaded by file:

enclave_path = struct.unpack_from(fmt, name_str)[0].decode(encoding='UTF-8')

If an enclave is loaded from a buffer the debug_enclave_info_t object won't have lpFileName populated. Thus, the debugger extensions cannot load the symbols, and gdb gets quite sad.

@andyzyb
Copy link
Contributor

andyzyb commented Jan 15, 2020

I think this is expected. The current design of sgx-gdb needs the enclave file to support debugging.

@sethmoo
Copy link
Contributor Author

sethmoo commented Jan 15, 2020

If the enclave is loaded via buffer, couldn't the gdb plugin gather the symbol information from the buffer itself? IIRC, the buffer is no different from an external file, in terms of contents. It's just loaded from memory instead of an external file. Thus, all the information needed to load symbols should still be there.

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

No branches or pull requests

2 participants