Skip to content

Conversation

@pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Jan 10, 2023

Currently the stack range is

  • end of memory (by LLVM)
  • and size is hardcoded

LLVM doesn't give us better range until WASI SDK has llvm/llvm-project@1532be9

inspired by emscripten

@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label Jan 10, 2023
@pavelsavara pavelsavara added this to the 8.0.0 milestone Jan 10, 2023
@pavelsavara pavelsavara self-assigned this Jan 10, 2023
@ghost ghost added the area-GC-mono label Jan 10, 2023
@ghost
Copy link

ghost commented Jan 10, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

null

Author: pavelsavara
Assignees: pavelsavara
Labels:

arch-wasm

Milestone: 8.0.0

@pavelsavara pavelsavara requested review from kg and radical January 10, 2023 20:42
@pavelsavara pavelsavara changed the title [draft] WASI gc fix WASI gc fix Jan 10, 2023
@pavelsavara pavelsavara mentioned this pull request Jan 10, 2023
34 tasks
@pavelsavara pavelsavara changed the title WASI gc fix WASI gc - fix stack range Jan 10, 2023
@vargaz
Copy link
Contributor

vargaz commented Jan 11, 2023

Doesn't wasi have pthread_attr_getstack () or a similar API ? Is it planned ?

@pavelsavara
Copy link
Member Author

Doesn't wasi have pthread_attr_getstack () or a similar API ? Is it planned ?

Since we are talking about shadow stack in the linear memory, the wasm VM itself would not probably allocate the buffer.
In emscripten it's part of the thread structure

https://github.com/emscripten-core/emscripten/blob/cfe2bdfe2692457cb5f5770672f6e5ccb3ffc2f2/src/library_pthread.js#L999-L1000

I guess POSIX layer in the WASI-SDK could do the allocation, but right now the SDK doesn't even have pthread.h

Threads are WASI proposal at the moment.
There is wasmtime --wasm-features threads which doesn't mean it has WASI nor POSIX API.
It looks like WASI API draft to me.

https://github.com/bytecodealliance/wasmtime/blob/4f0445b9e803dacfce6527e5f380724c91bfd669/examples/threads.c#LL179C45-L179C49

I don't know enough yet about any of it, but it's on my radar.

@pavelsavara pavelsavara marked this pull request as ready for review January 11, 2023 08:48
@pavelsavara pavelsavara merged commit 21af7c4 into dotnet:main Jan 11, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Feb 10, 2023
@pavelsavara pavelsavara deleted the wasi_fix_gc branch September 2, 2024 15:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-GC-mono

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants