-
-
Notifications
You must be signed in to change notification settings - Fork 771
TBF Header Permissions #2172
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
TBF Header Permissions #2172
Conversation
@gkelly I think this is related to your syscall filtering work. |
c329e7b
to
1c06903
Compare
You are correct to say that this PR is not secure under Tock's threat model. Unfortunately, I think solving this limitation requires figuring out the app ID story. I don't think we can have a secure mechanism to enforce "only app X can do Y" unless we have a mechanism to verify that an app that claims it is X is actually X. What we might need is a concept of resource ownership. Who "owns" a particular system call (i.e. determines who can call it)? Is it the kernel? I'm going to try to hash this out more on the core WG call and/or dev mailinglist. |
An app ID will have the same problem. Eventually the app ID will be stored in the TBF header as well. My thinking here is that the loader (which we trust) can check this. For example for Tockloader could take a config file like this:
Then Tockloader can compare the config file permissions with the individual app permissions to make sure they match. Then it can generate and sign a binary ready to deploy. I'm not clear how ownership would help. Would an app own a driver? What happens if that app is compromised? I think it makes sense to have the kernel enforce access. The question is how to tell the kernel to do that. Hard coding a function in Rust in a board specific function is one option, but seems too inflexible. Also how would that function know which app can do what, unless we trust something in the TBF header? |
1c06903
to
018b50d
Compare
Is this PR still reflective of the current state of the discussion? |
I think it is |
Based on the current state of discussion:
So yes, it is consistent with the current state of the discussion. It is not a mechanism to isolate a possibly-malicious app on its own. |
That was my understanding as well. |
Is tock/elf2tab#28 up to date with the design here, or are you waiting for approvals on this PR before updating the elf2tab PR? |
tock/elf2tab#28 is up to date. |
Ping! |
018b50d
to
dcf335d
Compare
I looked through this PR and the corresponding elf2tab PR and think the design looks reasonable. I assume the idea is that this would be implemented by the already existing system call filtering mechanism -- perhaps the docs should mention that somewhere? |
dcf335d
to
7f4cc85
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the discussion on the core call, this proposal was generally accepted, with one change, the exact format of a permissions object. In order to support sparse identifier spaces (although perhaps not as efficiently), there should be an offset field. Detailed comments inline.
7f4cc85
to
edc6886
Compare
Ping! |
1 similar comment
Ping! |
This must be ready to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with Brad's doc updates
cc @phil-levis you need to dismiss your "request changes" for this to be mergeable |
Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
edc6886
to
21a4732
Compare
Updated and ready to go |
Ready to go! |
bors r+ |
2177: TBF Header Persisent Access Control r=hudson-ayers a=alistair23 ### Pull Request Overview This PR builds on top of: #2172 to add a list of write and read permissions for persistent storage. Apps can have a single write_id to allow them to write data with that id and multiple read IDs to read back the data. This allows the flexibility to read from multiple apps if required. ### Testing Strategy ### TODO or Help Wanted ### Documentation Updated - [X] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [X] Ran `make prepush`. Co-authored-by: Alistair Francis <[email protected]>
Pull Request Overview
This PR is a second attempt at my original
app_id
PR.This is similar to an old PR: #1300
This PR adds a permission section to the TBF header. This permission section will contain a list of syscalls that the app is allowed and going to perform.
This only allows apps to interact with approved capsules. There are cases where we only want a single app to use a capsule. Take for example a Root of Trust (RoT) that uses I2C to control other devices. In this case we only want 1 approved app to have that control, while other (possibly malicious) apps are blocked from accessing the hardware.
We also then have a 64-bit bit mask of the commands that are allowed. Currently some capsules have large command numbers (like 100, 200 ect) and they will need to be updated in order to work with a bit mask.
The options can also be auto generated for apps. I can currently auto-generate them based on the compiled code for libtock-rs.
Security
From a thread model perspective this isn't ideal as we don't expect to always trust the TBF, see: https://github.com/tock/tock/blob/master/doc/threat_model/TBF_Headers.md
For secure applications though we can have the loader enforce/double check the permissions.
Testing Strategy
I have tested this by adding support to Elf2tab and by auto-generating the list in libtock-rs.See tock/elf2tab#28 for Elf2tab details.TODO or Help Wanted
A implementation in Tock after this is approved.
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.