Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

bradjc
Copy link
Contributor

@bradjc bradjc commented Jul 3, 2024

Pull Request Overview

This removes process_name from the ProcessStandard struct and instead uses self.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 store process_name because of legacy reasons.

Testing Strategy

travis

TODO or Help Wanted

n/a

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@github-actions github-actions bot added the kernel label Jul 3, 2024
@@ -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("")
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Member

@lschuermann lschuermann Jul 4, 2024

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.

@lschuermann lschuermann added this pull request to the merge queue Jul 5, 2024
Merged via the queue into master with commit 5b7af97 Jul 5, 2024
@lschuermann lschuermann deleted the kernel-process-standard-nonameref branch July 5, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants