From b894c2f111b1ce5d91c77620bb52e6719b81aacf Mon Sep 17 00:00:00 2001 From: Tobi Ajila Date: Thu, 27 Oct 2022 16:09:14 -0400 Subject: [PATCH] Set interrupt field before native call There is a potential race if the interrupt field is set after the interrupt call where another thread may query interrupt status before the field is set. Fixes: https://github.com/eclipse-openj9/openj9/issues/16174 Signed-off-by: Tobi Ajila --- src/java.base/share/classes/java/lang/Thread.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index 6c820b03b53..422f8e19330 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -1755,8 +1755,8 @@ public void interrupt() { } synchronized (interruptLock) { - interrupt0(); // inform VM of interrupt interrupted = true; + interrupt0(); // inform VM of interrupt // thread may be blocked in an I/O operation Interruptible b = nioBlocker;