C API: wasm_valtype_kind() aborts the process for v128

オープン
#15,088 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c, rust
領域
api

調査の方向性

Start in crates/c-api/src/types/val.rs at the ValType::V128 arm, then check the wasm_valkind_t definition in wasm.h and the existing wasmtime_valtype_new() handling. Determine the supported behavior for v128 and check the relevant C API tests and documentation. Done means this call no longer aborts the process and its behavior is documented or otherwise defined.

索引モデルが issue の本文から書いたものです。

説明

bug wasmtime:c-api wasmtime:docs

Thanks for filing a bug report! Please fill out the TODOs below.

Note: if you want to report a security issue, please read our security policy!

Test Case

No Wasm file is needed; the C API call alone reproduces it:

#include <stdio.h>
#include <wasm.h>
#include <wasmtime.h>

int main(void) {
  wasm_valtype_t *t = wasmtime_wasm_valtype_v128();
  printf("calling wasm_valtype_kind on a v128 valtype...\n");
  fflush(stdout);
  wasm_valkind_t k = wasm_valtype_kind(t); /* aborts */
  printf("kind = %d\n", (int)k);
  wasm_valtype_delete(t);
  return 0;
}
Steps to Reproduce
  • Build the program above against the Wasmtime C API (cc repro.c -lwasmtime).
  • Run it.
Expected Results

wasm_valtype_kind() does not take the host process down. wasm.h's wasm_valkind_t has no v128
member, so either a documented Wasmtime-specific value is returned for v128, or the function's
documentation says it must not be called on v128 types and points to wasmtime_valtype_new(),
which already handles v128 (wasmtime_valtype_t::V128) and is what the C++ API uses.

Actual Results

The process aborts:

calling wasm_valtype_kind on a v128 valtype...
`support for v128 ` is not implemented
Aborted (exit code 134)

The cause is the // TODO arm in crates/c-api/src/types/val.rs:

pub extern "C" fn wasm_valtype_kind(vt: &wasm_valtype_t) -> wasm_valkind_t {
    match vt {
        ...
        // TODO
        ValType::V128 => crate::abort("support for v128 "),

It is still there on main (81231fd, 2026-10-30).

Versions and Environment

Wasmtime version or commit: 50.0.1 (the libwasmtime shipped in the wasmtime-py 50.0.1 wheel); the
same code is on main at 81231fd

Operating system: Linux (Ubuntu 24.04)

Architecture: x86_64

Extra Info

Embedders that inspect function or global types with the standard wasm.h API hit this as soon as a
module uses v128 in a signature. wasmtime-py 50.0.1 does (its ValType.__eq__/__str__ call
wasm_valtype_kind()), so calling an export with a v128 parameter aborts the Python interpreter:
bytecodealliance/wasmtime-py#348. We found it while running the WebAssembly spec suite
(test/core/simd) through wasmtime-py as a reference implementation.

主要言語
Rust
スター
18.8k
フォーク
1.9k
平均マージ
22時間 5分
マージ済み PR(30日)
375

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/wasmtime のほかの issue

bytecodealliance/wasmtime の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。