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

Import third-party Lua libs usable in LuaSGX #4

Open
Lorel opened this issue Feb 25, 2017 · 9 comments
Open

Import third-party Lua libs usable in LuaSGX #4

Lorel opened this issue Feb 25, 2017 · 9 comments
Assignees

Comments

@Lorel
Copy link
Owner

Lorel commented Feb 25, 2017

Particularly, we'd like to use LuaCSV(C library) inside an enclave

@Lorel Lorel added this to the Debs submission milestone Feb 25, 2017
@Lorel
Copy link
Owner Author

Lorel commented Feb 26, 2017

LuaCSV has been imported in LuaSGX by rafael
It can be called from the global variable ccsv
So we can use this workaround for Debs (-> I remove the issue from the milestone)
But for future usage, we need a mechanism to import third-party libraries

@Lorel Lorel changed the title Import third-part Lua libs usable in LuaSGX Import third-party Lua libs usable in LuaSGX Feb 26, 2017
@Lorel Lorel removed this from the Debs submission milestone Feb 26, 2017
@rafaelppires
Copy link
Collaborator

rafaelppires commented Feb 26, 2017

It is not possible to dynamically add machine code to enclaves after they were created. Only by statically linking the additional code into the signed shared library that is loaded as enclave.

@Lorel
Copy link
Owner Author

Lorel commented Feb 26, 2017

@rafaelppires you're able to do it, you just have done it, so it is possible
could you do a doc on how you added LuaCSV to LuaSGX?
it would be a good start

anyway:

@rafaelppires
Copy link
Collaborator

rafaelppires commented Feb 26, 2017

I thought you meant by 'import' the usual '.so' way of doing it.

@Lorel
Copy link
Owner Author

Lorel commented Feb 26, 2017

I know that we cannot import a lib into an enclave on-the-fly
But we can automatize the build process of LuaSGX inside a Docker image
That's why I'd need a doc about how you process that

@rafaelppires
Copy link
Collaborator

It is rather manual. It depends on the code. For the cjson I did a static library and linked it to the enclave. The csv was simpler, so I just added it as source file. Each approach requires a different manipulation of the Makefile. The enclave code also changes to add the initialization call for the new packages.

@Lorel
Copy link
Owner Author

Lorel commented Feb 26, 2017

so I wait for your documentation about that to see how we can deal with that
but like I said, there is not any hurry for that

@vschiavoni
Copy link
Collaborator

vschiavoni commented Feb 26, 2017 via email

@rafaelppires
Copy link
Collaborator

rafaelpp [5:51 PM]
(...) like I said in the github: it depends. What I did for cjson was different from csv, because of their sizes. Each package can have its particularities and, in fact, it is not a good idea for security.

aurelien [5:53 PM]
Can you explain me how you processed for these two cases in a documentation, and why it is a bad idea for security in the same document ?

rafaelpp [5:53 PM]
not now or in the following days
but yes

aurelien [5:55 PM]
As soon as you can, it is not needed for our next target, but we should seriously think about this approach for later, in case if we go further

rafaelpp [6:04 PM]
I see. The security reason is basically because you should put the fewer possible inside enclaves. If you allow anything, you increase your trusted computing base, and the area of attack. The extreme is when the assurance given by SGX becomes useless (if someone puts malware inside your lua package or even bad code - sth that allows buffer overflows or uses forbidden instructions inside enclaves, for instance).
That is the same reason one should not allow arbitrary amounts of data to enter the enclave at a given time and having a limit is better (like the one of 8K) for security reasons.
There is a tradeoff between flexibility and security, and SGX is about security

aurelien [6:14 PM]
so here you think we should abort securestreams because it doesn't comply with SGX by design :thinking_face:

rafaelpp [6:15 PM]
not at all
but the less inside, the better

aurelien [6:17 PM]
but you understand that we can not propose a dataflow programming framework where some processes are executed inside SGX enclaves with so many restrictions ?

rafaelpp [6:17 PM]
that's the price you pay for having security: the restrictions

aurelien [6:18 PM]
please, just give me the recipes you used for include these two libraries, and let think together what we can do in the future, ok?

rafaelpp [6:19 PM]
sure

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

No branches or pull requests

3 participants