Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kernel] Perform sbrk address wrap check #2134

Merged
merged 1 commit into from
Dec 14, 2024
Merged

[kernel] Perform sbrk address wrap check #2134

merged 1 commit into from
Dec 14, 2024

Conversation

ghaerr
Copy link
Owner

@ghaerr ghaerr commented Dec 14, 2024

Yet another fix - signed arithmetic address wrap check is now performed in the kernel. This check was previously in v7malloc but not in standard malloc.

Address wrap could occur in malloc/sbrk when the heap break is at a high address, and a large allocation request occurs that overflows the 16-bit process heap break address when calculating the new break address. This was previously not checked for an would result in the break set to a low address, corrupting data.

A message "SBRK FAIL, OUT OF HEAP (address wrap)" is now displayed, and the allocation denied, which will end up with malloc safely returning NULL.

@ghaerr ghaerr merged commit f1c7683 into master Dec 14, 2024
2 checks passed
@ghaerr ghaerr deleted the vmalloc4 branch December 14, 2024 15:02
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.

1 participant