Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Wasm: munmap possible problem #8330

@yowl

Description

@yowl

Emscripten basically maps mmap/munmap to malloc/free. The second parameter to munmap is effectively unused https://github.com/emscripten-core/emscripten/blob/3abb4a6993ef97d652eae673cd79ffcdf97732dd/src/library_syscall.js#L275 I think this means that

if (startPadding != 0)
{
int ret = munmap(pRetVal, startPadding);
assert(ret == 0);
}
size_t endPadding = alignedSize - (startPadding + size);
if (endPadding != 0)
{
int ret = munmap((void *)((size_t)pAlignedRetVal + size), endPadding);
assert(ret == 0);
}
is going to be a problem. startPadding never seems to be non zero, but endPadding often is.

If the alignment == OS_PAGE_SIZE for Wasm that might be a workaround, or maybe VirtualReserveInner and VirtualRelease that just went to malloc/free ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions