Hi Penny,

On 10/05/2022 03:27, Penny Zheng wrote:
The code in free_heap_pages() will try to merge pages with the
successor/predecessor if pages are suitably aligned. So if the pages
reserved are right next to the pages given to the heap allocator,
free_heap_pages() will merge them, and give the reserved pages to heap
allocator accidently as a result.

So in order to avoid the above scenario, this commit updates free_heap_pages()
to check whether the predecessor and/or successor has PGC_reserved set,
when trying to merge the about-to-be-freed chunk with the predecessor
and/or successor.

Signed-off-by: Penny Zheng <penny.zh...@arm.com>
Suggested-by: Julien Grall <jgr...@amazon.com>

NIT: In general, the tags are historically ordered. I.e I first sugested and then you wrote the patch. So the two tags should be inverted.

This can be done on commit:

Reviewed-by: Julien Grall <jgr...@amazon.com>

Cheers,

--
Julien Grall

Reply via email to