<AWT Dev>  Review Request: 8225101 Crash at sun.awt.X11.XlibWrapper.XkbGetUpdatedMap when change keybord map
Sergey.Bylokhov at oracle.com
Sat Sep 7 03:05:57 UTC 2019
Please review the fix for JDK 14.
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