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 dynamic-loader example #16

Merged
merged 4 commits into from
Sep 30, 2021
Merged

add dynamic-loader example #16

merged 4 commits into from
Sep 30, 2021

Conversation

gianlu33
Copy link
Member

Fixes #3

I made a very simple application that loads dynamically an SM at runtime, using sm_load().

The SM is implemented in sm1.c. This file is not included with the other source files when the application is built, but rather it is built separately and the binary file is automatically hardcoded as a byte array into sm1.h using a python script. Later on, this array is passed as input to the sm_load() function.

During the loading process, the SM needs information about some symbols (e.g., exit, __unprotected_entry), hence the static-symtab.c file is used to declare such symbols.

The logic of main.c is to be decided: @jovanbulck what should this example do/show other than loading dynamically an SM? Just temporarily, this logic checks if the SM's symbols are added correctly to the global symbol table (see sancus-tee/sancus-support#11)

CI: add dynamic-loader test program
@jovanbulck
Copy link
Member

Thanks a lot for the PR @gianlu33 ! This really helps to understand and maintain the dynamic-loading functionality!

I added the example to the GitHub Actions CI as per ccd91cf so we can test and adjust before merging 👍

I'll start a code review and I might directly push small changes, or I might follow up with requested changes if it's not clear

Copy link
Member

@jovanbulck jovanbulck left a comment

Choose a reason for hiding this comment

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

Left some comments, will see now if I can start addressing them partially already

dynamic-loader/Makefile Outdated Show resolved Hide resolved
dynamic-loader/Makefile Outdated Show resolved Hide resolved
dynamic-loader/hardcode_elf.py Outdated Show resolved Hide resolved
dynamic-loader/hardcode_elf.py Outdated Show resolved Hide resolved
dynamic-loader/main.c Outdated Show resolved Hide resolved
@gianlu33
Copy link
Member Author

I very much agree that it is better to compile the SM in the Makefile, thanks for making these changes :)

Let me know if you need something else from me!

@jovanbulck jovanbulck merged commit 0f97aad into sancus-tee:master Sep 30, 2021
@jovanbulck
Copy link
Member

This is now merged, I think it's very nice and really helps showing a nice aspect about Sancus! Thanks @gianlu33 for the PR! 👍

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.

Add example of dynamic loading and attestation
2 participants