Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behavior for atomic load #3167

Closed
zzjas opened this issue Sep 1, 2022 · 5 comments
Closed

Weird behavior for atomic load #3167

zzjas opened this issue Sep 1, 2022 · 5 comments
Assignees
Labels
bug Something isn't working priority-medium Medium priority issue
Milestone

Comments

@zzjas
Copy link

zzjas commented Sep 1, 2022

Describe the bug

i32.atomic.load won't give a runtime error for out-of-bounds access.

Steps to reproduce

(module
    (memory 1)
    (func (export "_start")
        i32.const 0xffff_fff0
        i32.atomic.load offset=16
        drop
    )
)

Run with wasmer --enable-all atomic.wat

Expected behavior

We think this should be a runtime OOB error but wasmer will return normally.

If the 0xffff_fff0 is changed to 0xfff0, wasmer will then give OOB error. Or if the i32.atomic.load is changed to i32.load, wasmer will also give the error.

Please excuse us if this behavior is intended. Also, the test is collected from bytecodealliance/wasmtime#3132 in case the discussion there might be useful.

Thanks.

@zzjas zzjas added the bug Something isn't working label Sep 1, 2022
@zzjas
Copy link
Author

zzjas commented Sep 1, 2022

Sorry forgot to add this. It was tested using
wasmer version: 2.3.0
OS: macOS 12.5.1 (M1 Chip)

@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 2, 2022

What compiler are you using? Cranelift (the default one) or Singlepass?

@zzjas
Copy link
Author

zzjas commented Sep 2, 2022

Cranelift

@ptitSeb
Copy link
Contributor

ptitSeb commented Sep 2, 2022

Ok, thanks. I'll have a look at it. It seems there is the same "warp around" issue as with wasmtime.

@syrusakbary syrusakbary added the priority-medium Medium priority issue label Sep 6, 2022
@syrusakbary syrusakbary added this to the v3.x milestone Sep 6, 2022
@ptitSeb ptitSeb mentioned this issue Sep 6, 2022
11 tasks
@ptitSeb ptitSeb modified the milestones: v3.x, v3.1 Nov 16, 2022
bors bot added a commit that referenced this issue Nov 29, 2022
3153: SharedMemory & Atomics r=ptitSeb a=ptitSeb

# Description
Enabled SharedMemory and the Atomics extension proposal

- [x] Enable Atomic extension by default
- [x] Fix "imports" tests #3154
- [x] Add function for memory.atomic.wait32, memory.atomic.wait64 and memory.atomic.notify opcodes #3155
- [x] Add support for the new wait/notify opcodes in Cranelift compiler #3156 
- [x] Add support for the new wait/notify opcodes in LLVM compiler #3157
- [x] Add support for atomic access opcodes in AArch64/Singlepass compiler #3159
- [x] Add support for the new wait/notify opcodes in Singlepass compiler #3158
- [x] Fix Atomic issues on x86_64 Singlepass compiler not related to Wait/Notify opcodes #3161
- [x] Fix Atomic issues on Cranelift compiler not related to Wait/Notify opcodes #3162
- [x] Fix Atomic issues on LLVM compiler not related to Wait/Notify opcodes #3163
- [x] Fix the ticket #3167 on Cranelift

For #3304 

Co-authored-by: John Sharratt's Shared Account <[email protected]>
Co-authored-by: ptitSeb <[email protected]>
Co-authored-by: Syrus Akbary <[email protected]>
@ptitSeb
Copy link
Contributor

ptitSeb commented Dec 6, 2022

Merged

@ptitSeb ptitSeb closed this as completed Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants