Skip to content

AOT code ends up in non-executable memory by try_merge_data_and_text() #3825

Open
@sasq64

Description

@sasq64

Subject of the issue

Running AOT code on MacOS; works fine without --xip, but with the flag I crash on access error when trying to call native code.

Test case

Your environment

  • MacOS Sonoma 14.2
  • WAMR 2.1.2

Steps to reproduce

Build a wasm-file and compile to aot with wamrc --target aarch64v8 --xip

Expected behavior

Should not crash

Actual behavior

Crashes with access error in non executable memory

Extra Info

Changing aot_loader.c:2163 from

sections = loader_mmap((uint32)total_size, false, NULL, 0);
to
sections = loader_mmap((uint32)total_size, true, NULL, 0);

fixes the issue for me.

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