-
-
Notifications
You must be signed in to change notification settings - Fork 771
kernel: process standard: do not store reference to process name #4061
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
Conversation
@@ -996,7 +993,7 @@ impl<C: Chip> Process for ProcessStandard<'_, C> { | |||
} | |||
|
|||
fn get_process_name(&self) -> &'static str { | |||
self.process_name | |||
self.header.get_package_name().unwrap_or("") |
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.
I don't think we trust the process name, so it might not matter. But this might open us up to a name changing while running
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.
Only the kernel can edit a TBF header.
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.
Not really though. If the flash is external it can be modified by a physical attacker. We don't check the signature again so we wouldn't catch a change in the process name
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.
I don't understand why you are choosing to make this point. With this we get the same reference to the same memory address as before. Instead of two copies of that reference we now use one.
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.
I just read your description and thought it was stored in RAM
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.
I just read your description and thought it was stored in RAM
This has me confused. I think there are platforms where the header's stored in flash, and there are platforms where its stored in RAM. As a basic assumption, we should expect that the backing storage of a process, its header(s) and footer(s) is under exclusive control of the CPU and cannot be modified by an attacker -- that vector is way outside our threat model.
I think this is different for when loading processes from external flash. In that case, with this design, we ought to copy headers into private memory and re-verify after loading. If we don't, we break many other assumptions in the kernel too.
Pull Request Overview
This removes
process_name
from theProcessStandard
struct and instead usesself.header.get_package_name().unwrap_or("")
. This saves 8 bytes of RAM for the PCB. The code change is pretty minimal, and I think we only storeprocess_name
because of legacy reasons.Testing Strategy
travis
TODO or Help Wanted
n/a
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.