Skip to content

Fix memory leaks by halting the kernel#50

Merged
jserv merged 1 commit intosysprog21:mainfrom
RinHizakura:main
Apr 7, 2026
Merged

Fix memory leaks by halting the kernel#50
jserv merged 1 commit intosysprog21:mainfrom
RinHizakura:main

Conversation

@RinHizakura
Copy link
Copy Markdown
Contributor

@RinHizakura RinHizakura commented Apr 7, 2026

To stop the running kernel, lkl_sys_halt needs to be called to release the allocated resources.

This fixes the error reported by KASAN.


Summary by cubic

Halt the LKL kernel during cleanup to release resources and fix KASAN-reported memory leaks. Adds kbox_halt_kernel() and uses it in kbox_run_image on both error and shutdown paths.

  • Bug Fixes
    • Added kbox_halt_kernel() wrapping lkl_sys_halt() with error logging; declared lkl_sys_halt() in lkl-wrap.h.
    • Consolidated early failures to new err_post_boot and call kbox_halt_kernel() in both err_post_boot and err_net for consistent cleanup before network teardown.

Written for commit 0000002. Summary will update on new commits.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

To stop the running kernel, lkl_sys_halt
needs to be called to release the allocated
resources.

Change-Id: Ic288db5c61a16915a16ff6f120d8885faecf19ca
@jserv jserv merged commit 07b22d9 into sysprog21:main Apr 7, 2026
5 checks passed
@jserv
Copy link
Copy Markdown
Contributor

jserv commented Apr 7, 2026

Thank @RinHizakura for contributing!

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