`PAGESIZE` macro set to garbage value in shared libraries
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Domain
- build-system, compilers
Research direction
Start in __macro__PAGESIZE.h and inspect the preprocessor guard used for LLVM v22 and later, then trace how wasm-ld defines __wasm_first_page_end for shared libraries. Compare that path with the imported __heap_end and related symbols mentioned in the issue. Done means shared-library builds use a valid PAGESIZE and dlmalloc no longer reaches the alignment-related sbrk abort.
Written by the indexing model from the issue text.
Description
While experimenting with C++ exception handling support for shared libraries, I discovered that the support for custom page sizes in __macro__PAGESIZE.h (which is only enabled for LLVM v22 and later) is broken for shared libraries, leading to an alignment-related abort() in sbrk when dlmalloc asks for more memory.
I was able to work around this by adding a && !defined __pic__ clause to the preprocessor guard, causing PAGESIZE to be hard-coded to the traditional 0x10000 value when compiling with -fPIC. I'm not sure what the proper way to handle custom page sizes in shared libraries is, but perhaps rather than rely on wasm-ld to define __wasm_first_page_end, it could be imported from env similar to e.g. __heap_end and friends.
- Dominant language
- C
- Stars
- 1k
- Forks
- 268
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 20
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WebAssembly/wasi-libc
-
wasip2: enabling O_APPEND with fcntl reuses the old positional output stream and overwrites the fileOpen
Difficulty 3/5 1-2 days Newbie friendliness 70/100
WebAssembly/wasi-libc#919 ·
Maintainers usually reply within 1 day
-
wasip2/wasip3: reads never see data appended to a file after reaching EOFPossibly taken @libsmol claimed this 24 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 61/100
WebAssembly/wasi-libc#889 ·
Maintainers usually reply within 1 day
-
Contradicting `SOL_TCP` and `SOL_UDP` definition for p1May be free again A pull request for this issue was closed without being merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
WebAssembly/wasi-libc#855 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
WebAssembly/wasi-libc#815 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
WebAssembly/wasi-libc#809 · 2 comments ·
Maintainers usually reply within 1 day
All issues in WebAssembly/wasi-libc
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
389ds/389-ds-base#8152 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
isolation2 lockmodes fails on cassert builds: extra AccessShareLock on partition rootPossibly taken @tuhaihe claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/cloudberry#2356 ·
Maintainers usually reply within 2 days
-
windows-artifacts: the win-arm64 job uses a Visual Studio generator missing from windows-11-armOpen
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 91/100