Fix assertion of free a wrong heap #9600
Merged
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
Fix an assertion issue #9599.
lib_mallocis defined as macro and it will be expanded tokmm_allocif__KERNEL__is defined ormallocif__KERNEL__is not defined.lib_freeis defined as macro and it will be expanded tokmm_freeif__KERNEL__is defined orfreeif__KERNEL__is not defined.For
fs, it is a kernel module and build with__KERNEL__defined. so thelib_freein this module iskmm_freein fact.For
libcis is only a library (not belong to kernel), it build without__KERNEL__defined. solib_mallocused in this modue ismallocin fact.Think about a case like this:
in
fsmodule,asprintfwas used to alloc and initialize the memory, and this memory is freed vialib_free. This is the case #9599 addressed.The fix use the flag of flat build mode. if under flat mode, the
__KERNEL__will not be consider. as it is not real kernel or user distinguished under this buils modeImpact
Should no
Testing
The issue #9599 has been fixed.