Commit 3bee8d3
committed
fix realloc from small sized allocations with above PAGE_SIZE alignment
Large allocations don't always have a size larger than the maximum slab
size class because alignment larger than PAGE_SIZE is handled via large
allocations. The general case in realloc was assuming small sizes imply
slab allocations which isn't guaranteed.
Alignment above PAGE_SIZE is rare and realloc doesn't preserve alignment
so passing aligned allocations to realloc is also rare. In practice, it
ends up doing invalid accesses within the reserved metadata region which
will almost always crash due to it being largely PROT_NONE memory and it
having an extremely high likelihood of indexing into the PROT_NONE areas
rather than the actual metadata. That means if this impacted an app, it
would currently be crashing in practice. Due to the reserved region for
metadata and the fact that it would be crashing, this can be ruled out
as a security concern but is potentially an extremely rare compatibility
issue if there's any code using this.
Reported-by: Stefan Rus <stefan@photonspark.com>1 parent 1044b54 commit 3bee8d3
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1530 | 1530 | | |
1531 | 1531 | | |
1532 | 1532 | | |
1533 | | - | |
| 1533 | + | |
| 1534 | + | |
1534 | 1535 | | |
1535 | 1536 | | |
1536 | 1537 | | |
| |||
1647 | 1648 | | |
1648 | 1649 | | |
1649 | 1650 | | |
1650 | | - | |
| 1651 | + | |
1651 | 1652 | | |
1652 | 1653 | | |
1653 | 1654 | | |
| |||
0 commit comments