Stream: cranelift

Topic: Hit unwrap declaring function


view this post on Zulip StackDoubleFlow (Oct 06 2021 at 00:47):

Hello there, I receive a crash when using cranelift to declare a function: https://pastebin.com/jRg7uWcv
I haven't been receiving this crash until today, and as far as I can tell, I just made some functions slightly longer, and I lowered the total count of functions.

The number of functions I declare here is very large (sometimes over 50k) so maybe that is contributing to the issue?

For what it's worth, here is where the crash takes place in my code: https://github.com/MCHPR/MCHPRS/blob/4bcb935b3690ee48fcd54ebd8237a3b96902353a/src/redpiler/backend/cranelift.rs#L1205
Let me know if more information is required :)

Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
A multithreaded Minecraft server built for redstone. - MCHPRS/cranelift.rs at 4bcb935b3690ee48fcd54ebd8237a3b96902353a · MCHPR/MCHPRS

view this post on Zulip bjorn3 (Oct 06 2021 at 11:48):

The crash happens at https://github.com/bytecodealliance/wasmtime/blob/91482f39d0ab29cab4939e5484701877693ba599/cranelift/jit/src/backend.rs#L248

Standalone JIT-style runtime for WebAssembly, using Cranelift - wasmtime/backend.rs at 91482f39d0ab29cab4939e5484701877693ba599 · bytecodealliance/wasmtime

view this post on Zulip bjorn3 (Oct 06 2021 at 11:50):

The number of functions I declare here is very large (sometimes over 50k) so maybe that is contributing to the issue?

That is probably the issue. cranelift-jit currently can't handle the PLT and GOT being more than 2^31 bytes apart. This can happen if you define a lot of functions such that the memory allocations become far apart. It could also happen I think if another thread concurrently allocates memory.

view this post on Zulip bjorn3 (Oct 06 2021 at 11:53):

I think one option to fix this would be to have the GOT and PLT be part of the same allocation and use different memory protections instead of usr diffetent allocations.


Last updated: Dec 23 2024 at 12:05 UTC