Fuzzer: DAE generates invalid code
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 47/100
Direção de pesquisa
Start with src/passes/DeadArgumentElimination.cpp and the dae-optimizing pass; reproduce the validator failure using the reduced WAT and command in the issue. Trace how callers are tracked when call_ref becomes a direct call, and check whether the enclosing expression is re-finalized after return-type refinement. Done means the reduced case validates after the pass and relevant tests pass.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Run from the latest main bee0b57. Reduced WAT:
(module
(rec
(type $0 (sub (shared (func (result (ref null $1))))))
(type $1 (sub (shared (array f32))))
(type $2 (sub $0 (shared (func (result (ref null $1))))))
(type $3 (sub (struct)))
(type $4 (func (param (ref null $2)) (result f64)))
(type $5 (func (result (ref $6))))
(type $6 (shared (func (param (ref $3)) (result v128))))
(type $7 (func))
)
(elem declare func $1 $2)
(func $1 (type $6) (param $0 (ref $3)) (result v128)
(unreachable)
)
(func $2 (type $5) (result (ref $6))
(unreachable)
)
(func $3 (type $5) (result (ref $6))
(local $10 i32)
(select (result (ref $6))
(call_ref $5
(ref.func $2)
)
(ref.func $1)
(stringview_wtf16.get_codeunit
(string.const "\e2\82\ac")
(block (result i32)
(local.set $10
(i32.const 1)
)
(local.get $10)
)
)
)
)
(func $4 (type $7)
(drop
(call $3)
)
)
)
Command:
BINARYEN_PASS_DEBUG=1 bin/wasm-opt -all --closed-world --dae-optimizing fuzzed.wat
Output:
[wasm-validator error in function 3] stale type found in 3 on 0x561b46e160d8
(marked as (ref $func.0), should be (ref (exact $func.0)))
, on
(select (result (ref (exact $6)))
(call $2)
(ref.func $1)
(stringview_wtf16.get_codeunit
(string.const "\e2\82\ac")
(i32.const 1)
)
)
Fatal: Last pass (dae-optimizing) broke validation.
Replacing the call_ref with a direct call $2 makes the bug go away.
AI-generated hypothesis
In DeadArgumentElimination.cpp:
callersis computed once, from directCalls only. Initially$3reaches$2only viacall_ref, socallers[$2] = {}.- Iteration 1:
$4drops$3's result, soremoveReturnValue($3)runs and$3goes intoworthOptimizing.optimizeAfterInliningthen rewritescall_ref (ref.func $2)intocall $2. - Iteration 2:
$2now has a seen direct call, sorefineReturnTypes($2)refines its result to(ref (shared nofunc))and updates theCall's type.refinedCallersis populated from the stalecallers[$2], which is empty, so$3is neverReFinalized. The enclosingselectkeeps(ref $6)while its LUB is now(ref (exact $6)).
The comment above callers says over-approximating it is safe; this is an under-approximation, since new direct callers appear mid-pass via devirtualization.
- Linguagem predominante
- WebAssembly
- Estrelas
- 8.7k
- Forks
- 897
- Merge médio
- 1d 23h
- PRs com merge (30d)
- 107
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de WebAssembly/binaryen
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
WebAssembly/binaryen#9135 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 Meio dia Facilidade para iniciantes 76/100
WebAssembly/binaryen#9018 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 15/100
WebAssembly/binaryen#9260 · 5 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 62/100
WebAssembly/binaryen#9257 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
WebAssembly/binaryen#9249 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de WebAssembly/binaryen
Issues semelhantes
-
bug priority: P2
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
confirmed generated by fuzzer llvm:optimizations miscompilation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
llvm/llvm-project#234325 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
gren-lang/compiler-common#41 ·
-
area:codegen backend:hlsl bug coverage direction:output
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia