Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a fundamental change to the kernel's memory and resource management by implementing kernel partitioning. This new capability allows for the creation of isolated execution environments, enhancing system robustness and security by strictly controlling memory access and scheduling for different applications. The changes include new commands for partition and scheduler window management, alongside significant updates to the underlying HAL and syspage structures to support this new architecture. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces kernel partitioning, a significant architectural change, adding new commands part and sched and updating the app command. The MPU handling is refactored to be per-partition. A high-severity out-of-bounds write vulnerability was identified in the MPU HAL implementations for ARMv7-M and ARMv7-R, where hardware-reported region counts are trusted without validation against software buffer sizes. Furthermore, logic errors in the part command's argument parsing prevent it from functioning correctly when flags are used, and there are minor issues related to documentation and code clarity.
95269e1 to
3fbe3eb
Compare
| if (syspage_common.syspage->schedWindows == NULL) { | ||
| window->next = window; | ||
| window->prev = window; | ||
| syspage_common.syspage->schedWindows = window; | ||
| } | ||
| else { | ||
| window->prev = syspage_common.syspage->schedWindows->prev; | ||
| syspage_common.syspage->schedWindows->prev->next = window; | ||
| window->next = syspage_common.syspage->schedWindows; | ||
| syspage_common.syspage->schedWindows->prev = window; | ||
| } |
There was a problem hiding this comment.
Couldn't you use LIST_ADD from lib/list.h instead? Same in syspage_partAdd()
There was a problem hiding this comment.
Cannot be used due to packed attribute of syspage_t
This commit introduces loader support for full MPU regions reconfiguration on context switch, allowing for more flexibile configuration of memory maps on MPU targets. Changes include * MPU configuration during app command, based on hal_syspage_prog_t structure with program configuration of MPU regions in form of ready-to-copy register values * reimplementation of mpu command, showing generated mpu configuration on per-app basis * passing all maps at once to hal/mpu module, allowing future map merging to reduce count of used MPU regions JIRA: RTOS-1149
3fbe3eb to
6a769f0
Compare
6a769f0 to
c95a845
Compare
Introduce part command to create partitions, for now only holding memory configuration on NOMMU targets. Move MPU configuration from syspage_prog_t to new syspage_part_t, add allocable and accessible maps for each partition. For backward compatibility of configuration, by default app command creates a partition with first dmap being the only allocable map, and flags allowing IPC to all other partitions and spawning processes inside other partitions JIRA: RTOS-1149
c95a845 to
d1e0621
Compare
Introduce command for scheduler configuration JIRA: RTOS-1149
JIRA: RTOS-1149
Enable part command to allow for lwip configuration with uncached maps. JIRA: RTOS-1149
d1e0621 to
f7f21ab
Compare
Description
Add loader-side support for kernel partitioning.
Key changes:
partcommand for creating partitions with configurable memory maps (allocable and accessible) and flags (e.g. IPC permission)schedcommand for scheduler temporal windows configurationmpucommand to show per-app MPU configurationsyspage_part_tappcommandbackward-compatible partition is created by default for each app.
Motivation and Context
This is the companion change to the kernel partitioning support. Currently system configuration mechanisms are based on plo-scripts, so partitioning configuration follows that convetion.
Types of changes
How Has This Been Tested?
Checklist:
Special treatment