Skip to content

Use after free in ExecutableAllocator::AllocateThunksFromTemplate() #134128

Closed

Description

@PavlNekrasov

When ReserveDoubleMappedMemory() fails in ExecutableAllocator::AllocateThunksFromTemplate(), BackoutBlock(block, isFreeBlock) deletes the block if it was not taken from the free list

void* result = VMToOSInterface::ReserveDoubleMappedMemory(m_doubleMemoryMapperHandle, block->offset, templateSize * 2, 0, 0);
if (result != NULL)
{
block->baseRX = result;
AddRXBlock(block);
}
else
{
BackoutBlock(block, isFreeBlock);
}

Execution then continues and dereferences block->baseRX, which is freed memory in that case and a stale value otherwise
void *pTemplateAddressAllocated = VMToOSInterface::AllocateThunksFromTemplate(pTemplate, templateSize, block->baseRX, dataPageGenerator);

Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
Reporter: Pavel Nekrasov ([email protected]).

Activity

  1. added
    untriaged
    on Sep 17, 2026
  2. added
    needs-area-label
    on Sep 17, 2026
  3. dotnet-policy-service commented on Sep 17, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke
    See info in area-owners.md if you want to be subscribed.

  4. removed
    needs-area-label
    on Sep 18, 2026
  5. added a commit that references this issue on Sep 21, 2026
    8123b7a
  6. removed
    untriaged
    on Sep 21, 2026
  7. locked and limited conversation to collaborators on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions