<AWT Dev> [14] Review Request: 8225101 Crash at sun.awt.X11.XlibWrapper.XkbGetUpdatedMap when change keybord map

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Sat Sep 7 03:05:57 UTC 2019


Hello.
Please review the fix for JDK 14.

Bug: https://bugs.openjdk.java.net/browse/JDK-8225101
Fix: http://cr.openjdk.java.net/~serb/8225101/webrev.00

This is the fix of the bug caused by dereferencing 0 in XkbMapNotify notification.

The sun.awt.X11.XToolkit class contains a native pointer "awt_XKBDescPtr" which
is initialized at the start of the application or by the "XkbNewKeyboardNotify"
notification. And deallocated by the same "XkbNewKeyboardNotify" or via "ShutdownHook"

The "awt_XKBDescPtr" in the changed code in the webrev might be NULL in two situations:
  - Sometime before the "XlibWrapper.XkbGetMap" returned NULL for some reason.
  - The shutdown hook start to execute in parallel and dispose of the current keyboard info and
    sets "awt_XKBDescPtr" to 0

I was able to reproduce the bug by some script which floods the XServer with millions of
keyboard requests, which makes the system unresponsive but allow to get the timings to
reproduce the bug.

As a fix, I suggest using "awt_XKBDescPtr" in "XkbMapNotify" only if it is not 0, as we
already do in all other places.


-- 
Best regards, Sergey.


More information about the awt-dev mailing list