bytecodealliance / bytecodealliance/wasmtime

Cranelift: emit_small_memory_copy ignores alignment

Open
#3,583 1 comment 0 reactions 0 assignees View on GitHub
bug cranelift
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

`cranelift_frontend::FunctionBuilder::emit_small_memory_copy`([documentation](https://docs.rs/cranelift-frontend/0.78.0/cranelift_frontend/struct.FunctionBuilder.html#method.emit_small_memory_copy)) takes the arguments `dest_align` and `src_align`, which it uses only for an assertion and then ignores. It chooses an access size which may be larger than the alignment and calls `flags.set_aligned();` and proceeds to doing unaligned memory access. This seems to be a mistake.

Reported by Veverak at https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/emit_small_memory_copy.20ignores.20alignment/near/263576215

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.