Stream: wasmtime

Topic: RISC-V and icache maintenance


view this post on Zulip Alex Crichton (Jun 04 2024 at 17:59):

I'm curious if @Afonso Bordado or others perhaps know what's going on here. At the CG meeting right now https://github.com/spinkube/containerd-shim-spin/issues/128 was brought up during a presentation as a blocker for running Wasmtime on riscv64 which boils down to:

thread '<unnamed>' panicked at /.../wasmtime-18.0.4/src/runtime/code_memory.rs:254:18:
Failed cache clear: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }

which corresponds to this part of the code I believe, specifically the risc-v-specific syscalls to manage the icache. That was originally added long ago and it's using syscalls that I don't personally know anything about, but Afonso (or others) do y'all know more to know why EPERM might be popping out?

I am trying to get containerd (through docker) to run wasm-files on my VisionFive 2 board which has a RISCV64 processor. Here are the platform details: $ lsb_release -a No LSB modules are available...
A fast and secure runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.

view this post on Zulip Afonso Bordado (Jun 04 2024 at 18:04):

I'm not entirely sure what is going on there. IIRC I tested that code on a VisionFive 2 as well, but with a super old kernel, so something might have changed.

If I'm not mistaken docker filters the allowed syscalls, and it might be that that one isn't allowed. (This is just a wild guess)

I'll try to reproduce that locally

view this post on Zulip Alex Crichton (Jun 04 2024 at 18:05):

good point, looking at the syscall itself it looks like EPERM isn't ever returned

Linux kernel source tree. Contribute to torvalds/linux development by creating an account on GitHub.

view this post on Zulip Alex Crichton (Jun 04 2024 at 18:05):

so a syscall filter sounds pretty likely

view this post on Zulip Afonso Bordado (Jun 04 2024 at 18:11):

It looks like some other projects have had similar issues with the JRE:
https://github.com/adoptium/adoptium-support/issues/697#issuecomment-1600734899

Error inside riscv64 docker container. on host javac works. ./jdk/bin/java --version # # A fatal error has been detected by the Java Runtime Environment: # # SIGILL (0x4) at pc=0x0000003f78361a88, ...

view this post on Zulip Alex Crichton (Jun 04 2024 at 18:11):

aha excellent thanks!


Last updated: Oct 23 2024 at 20:03 UTC