Skip to content

Commit 08a18cd

Browse files
authored
Report timeout in interpretation of AtomicWait (#6452)
To avoid slow-running fuzz cases, we report a host limit when interpreting atomic.wait with any non-zero timeout. However, in the allowed case where the timeout is zero, we were incorrectly interpreting the wait as returning 0, meaning that it was woken up, instead of 2, meaning that the timeout expired. Fix it to return 2.
1 parent b10d59d commit 08a18cd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/wasm-interpreter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3398,7 +3398,7 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
33983398
if (timeout.getSingleValue().getInteger() != 0) {
33993399
hostLimit("threads support");
34003400
}
3401-
return Literal(int32_t(0)); // equal
3401+
return Literal(int32_t(2)); // Timed out
34023402
}
34033403
Flow visitAtomicNotify(AtomicNotify* curr) {
34043404
NOTE_ENTER("AtomicNotify");

test/lit/exec/atomic.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
(memory $0 23 256 shared)
99

1010
;; CHECK: [fuzz-exec] calling wait_and_log
11-
;; CHECK-NEXT: [LoggingExternalInterface logging 0]
11+
;; CHECK-NEXT: [LoggingExternalInterface logging 2]
1212
(func $wait_and_log (export "wait_and_log")
1313
(call $log
1414
(memory.atomic.wait64

0 commit comments

Comments
 (0)