Skip to content

x64: Misaligned load fault with sunk float operation when AVX disabled #10408

@alexcrichton

Description

@alexcrichton

Currently on the main branch this fails:

$ cargo run -q wast --target x86_64-unknown-linux-gnu -Oopt-level=0 ./tests/misc_testsuite/issue4890.wast
Error: failed to run script file './tests/misc_testsuite/issue4890.wast'

Caused by:
    0: failed directive on ./tests/misc_testsuite/issue4890.wast:12:1
    1: error while executing at wasm backtrace:
           0:   0x2f - <unknown>!<wasm function 0>
    2: wasm trap: out of bounds memory access

This test shouldn't fail, however, and it should pass. Bisection points to #10316 (ddaaed6).

Using #10405 I get

$ cargo run -q objdump foo.cwasm --traps --addresses
00000000 wasm[0]::function[0]:
         0: pushq   %rbp
         1: movq    %rsp, %rbp
         4: movl    %edx, %r11d
         7: addq    0x50(%rdi), %r11
         b: movl    $0x80000000, %r8d
        11: movd    %r8d, %xmm1
        16: movdqa  %xmm1, %xmm0
        1a: andnps  0xf(%rip), %xmm0
        21: andps   1(%r11), %xmm1
            ╰─╼ trap: MemoryOutOfBounds
        26: orps    %xmm1, %xmm0
        29: movq    %rbp, %rsp
        2c: popq    %rbp
        2d: retq
        2e: addb    %al, (%rax)
        30: addb    %al, (%rax)
        32: addb    %al, (%rax)
        34: addb    %al, (%rax)
        36: addb    %al, (%rax)
        38: addb    %al, (%rax)
        3a: addb    %al, (%rax)
        3c: addb    %al, (%rax)
        3e: addb    %al, (%rax)

and the bug here is indeed that MemoryOutOfBounds trap happening. That's due to misalignment though instead of something being out-of-bounds so we're erroneously catching the segfault.

cc @abrown @rahulchaphalkar

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions