kernel: fix dangling multiboot cmdline and libc env pointers#2371
Open
uadhran wants to merge 1 commit into
Open
kernel: fix dangling multiboot cmdline and libc env pointers#2371uadhran wants to merge 1 commit into
uadhran wants to merge 1 commit into
Conversation
Store the bootloader-provided multiboot cmdline pointer instead of .data() from a temporary pmr::string. Keep early-boot free of strdup/malloc. Use static storage for init_libc env strings. Tested: nix-build unittests.nix — 85/85 passed Closes: includeos#2368
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kernel::state().cmdlineinstead of.data()from a temporarystd::pmr::string(dangling after the full-expression). Memory is already reserved via_multiboot_free_begin()when the string sits past_end.strdup/malloc on this path (see Early boot memory corruption sometimes causes chain crashes #2252 / Disallow syscalls before libc is initialised, remove all existing early boot syscalls #2273).init_libc: env strings for__libc_start_mainuse static buffers instead of temporarypmr::string.data().Closes: #2368
Test plan
nix-build unittests.nix— 85/85 passedmultiboot.cppin the unit build log./test/test.shintegration suite not run