Skip to content

Commit

Permalink
Bug fix for using failing to initialise meta-data
Browse files Browse the repository at this point in the history
If the Superslab meta-data is larger than an OS page, then the
subsequent pages could be decommited. This removes the skipped
initialisation in that case.
  • Loading branch information
mjp41 committed Nov 10, 2020
1 parent 8990c34 commit 01b282a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mem/superslab.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ namespace snmalloc
{
allocator = alloc;

if (kind != Super)
// If Superslab is larger than a page, then we cannot guarantee it still
// has a valid layout as the subsequent pages could have been freed and
// zeroed, hence only skip initialisation if smaller.
if (kind != Super || (sizeof(Superslab) >= OS_PAGE_SIZE))
{
if (kind != Fresh)
{
Expand Down

0 comments on commit 01b282a

Please sign in to comment.