Conversation
Previous handling of ENOMEM during physical page allocation ignored that _map_map can merge new allocation with existing entries, leading to invalid map state, accidental virtual address reallocation and leaking physical pages. JIRA: RTOS-1235
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 significantly enhances kernel stability by refining the error handling within the virtual memory mapping ( 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 addresses a critical bug in the error handling logic within _vm_mmap when dealing with out-of-memory conditions. The previous manual cleanup mechanism was flawed, particularly in scenarios involving merged memory map entries, which could lead to an invalid map state and resource leaks. The change correctly replaces this with a call to _vm_munmap, ensuring a robust and reliable cleanup by leveraging the existing unmapping functionality. This not only fixes the bug but also simplifies the code and improves its maintainability.
|
Included in larger #749 |
Description
Previous handling of ENOMEM during physical page allocation ignored that _map_map can merge new allocation with existing entries, leading to invalid map state, accidental virtual address reallocation and leaking physical pages.
Use of dedicated _vm_munmap function instead of manual cleanup ensures reliability and avoids code duplication. Correct manual cleanup would require handling multiple cases separately (lmerge, lmerge
Motivation and Context
This is part of series of PRs that increase kernel stability when system is out of memory, inspired by work on reliability of separation given by partitioning mechanisms and related to fork bomb issue phoenix-rtos/phoenis-rtos-project#560
JIRA: RTOS-1235
Types of changes
How Has This Been Tested?
Checklist:
Special treatment