coredump: coredump server support#682
coredump: coredump server support#682etiaro wants to merge 9 commits intoetiaro/kernel-sighandlersfrom
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @etiaro, 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 coredump server functionality to the Phoenix-RTOS kernel. Its primary purpose is to capture the state of a crashed process, including its memory segments, threads, and context, to facilitate post-mortem debugging. This is achieved by integrating the coredump mechanism into the kernel's exception and process management systems, ensuring that fatal errors trigger a coredump rather than just halting the system.
Highlights
- Coredump Server Implementation: A new coredump server is added, capable of enqueuing crashed processes and providing their memory and thread information upon request.
- Enhanced Exception Handling: The kernel's exception handlers across various architectures are updated to initiate a coredump sequence instead of simply halting the CPU on fatal exceptions.
- Process and Thread Management Integration: Core process and thread management routines are modified to support the coredump lifecycle, including marking processes for coredump, handling thread termination during coredump, and managing memory deallocation.
- Build System Updates: The build system is updated to compile and link the new coredump server components into the kernel.
- Context and Relocation Handling: Improvements are made to how CPU contexts are saved and restored, and relocation information for processes (especially for NOMMU builds) is now accessible for coredump purposes.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces coredump server support, a significant feature involving extensive changes across exception handling, process management, and thread lifecycle. The core logic is implemented in the new coredump module. While the overall approach is sound, I've identified several critical issues, including potential NULL pointer dereferences and a memory leak in proc_join. I've also provided suggestions to improve robustness and fix bugs in the coredump data handling. Please address these points to ensure the stability of this new functionality.
5660cd1 to
194e1b9
Compare
1ec9788 to
4634bcc
Compare
f7f2833 to
1089083
Compare
448164a to
29d3166
Compare
1089083 to
4b21ec0
Compare
4b21ec0 to
df5951b
Compare
29d3166 to
301c469
Compare
14f63ce to
7f22143
Compare
7f22143 to
28cea5a
Compare
df5951b to
72f56f2
Compare
c119a6d to
875fc96
Compare
a9dc6fd to
6f6489d
Compare
875fc96 to
c9d7b36
Compare
6f6489d to
e23ee2e
Compare
Previous approach to signal handling split between userspace libphoenix and kernel made it hard, if not impossible, to provide full POSIX-compliance. JIRA: RTOS-736
Reduce size of process_t struct by allocating sigactions array only when needed. JIRA: RTOS-736
POSIX requirement: It is not possible to block those signals which cannot be ignored. This shall be enforced by the system without causing an error to be indicated JIRA: RTOS-736
Make behavior of direct thread signaling consistent with signaling whole process JIRA: RTOS-736
Before this change, a vforked process that received a signal would die and its parent would not be resumed nor killed. Now the parent is resumed and the vforked process is killed. JIRA: RTOS-1101
Removed signalPost syscall as it duplicates functionality of sys_tkill JIRA: RTOS-736
Required for saving symbol offsets in NOMMU coredump JIRA: RTOS-1062
Introduces coredump.h with new coredump thread and proc_crash function to introduce functionality of crashing processes coredump. * add proc_sendFromMap to send messages with data from crashed process address space * delay kstack kfree to ghost removal so that thread context is available during coredumping JIRA: RTOS-1054
JIRA: RTOS-1054
c9d7b36 to
b299c02
Compare
e23ee2e to
123c1c6
Compare
3390b9e to
11d9d21
Compare
Description
Introduces kernel thread that uses messaging to inform coredump server process about crashed processes and provide any data required for creating coredump for post-mortem analysis with GDB.
Motivation and Context
Types of changes
How Has This Been Tested?
Checklist:
Special treatment