Skip to content

coredump: coredump server support#682

Open
etiaro wants to merge 9 commits intoetiaro/kernel-sighandlersfrom
etiaro/coredump-server
Open

coredump: coredump server support#682
etiaro wants to merge 9 commits intoetiaro/kernel-sighandlersfrom
etiaro/coredump-server

Conversation

@etiaro
Copy link
Copy Markdown
Contributor

@etiaro etiaro commented Aug 11, 2025

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: ia32-generic-qemu, armv7r5f-zynqmp-qemu, sparcv8leon-generic-qemu

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

@etiaro etiaro changed the title Etiaro/coredump server coredump: coredump server support Aug 11, 2025
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. 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.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@etiaro etiaro force-pushed the etiaro/coredump-server branch 3 times, most recently from 5660cd1 to 194e1b9 Compare August 12, 2025 15:19
@etiaro etiaro force-pushed the etiaro/coredump-server branch 4 times, most recently from 1ec9788 to 4634bcc Compare August 13, 2025 12:53
@etiaro etiaro marked this pull request as ready for review August 13, 2025 12:53
@etiaro etiaro force-pushed the etiaro/kernel-sighandlers branch from f7f2833 to 1089083 Compare August 18, 2025 13:04
@etiaro etiaro force-pushed the etiaro/coredump-server branch 4 times, most recently from 448164a to 29d3166 Compare August 22, 2025 12:45
@etiaro etiaro force-pushed the etiaro/kernel-sighandlers branch from 1089083 to 4b21ec0 Compare August 22, 2025 12:45
@etiaro etiaro force-pushed the etiaro/kernel-sighandlers branch from 4b21ec0 to df5951b Compare October 17, 2025 10:25
@etiaro etiaro force-pushed the etiaro/coredump-server branch from 29d3166 to 301c469 Compare October 20, 2025 16:01
@etiaro etiaro force-pushed the etiaro/coredump-server branch 2 times, most recently from 14f63ce to 7f22143 Compare November 4, 2025 16:57
@etiaro etiaro force-pushed the etiaro/coredump-server branch from 7f22143 to 28cea5a Compare November 4, 2025 17:41
@etiaro etiaro force-pushed the etiaro/kernel-sighandlers branch from df5951b to 72f56f2 Compare January 30, 2026 12:02
@etiaro etiaro force-pushed the etiaro/kernel-sighandlers branch 4 times, most recently from c119a6d to 875fc96 Compare February 10, 2026 14:55
@etiaro etiaro force-pushed the etiaro/coredump-server branch 2 times, most recently from a9dc6fd to 6f6489d Compare February 10, 2026 15:38
@etiaro etiaro force-pushed the etiaro/kernel-sighandlers branch from 875fc96 to c9d7b36 Compare February 10, 2026 16:17
@etiaro etiaro force-pushed the etiaro/coredump-server branch from 6f6489d to e23ee2e Compare February 10, 2026 16:18
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
@etiaro etiaro force-pushed the etiaro/kernel-sighandlers branch from c9d7b36 to b299c02 Compare February 10, 2026 16:58
@etiaro etiaro force-pushed the etiaro/coredump-server branch from e23ee2e to 123c1c6 Compare February 10, 2026 16:58
@etiaro etiaro force-pushed the etiaro/kernel-sighandlers branch 7 times, most recently from 3390b9e to 11d9d21 Compare February 26, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants