<html><body><p><font size="2">Hi Sergey,</font><br><br><font size="2">Thank you for the review and suggestions.</font><br><font size="2">Function getNumButtons() make use of XInput extention to query for number of buttons. In case if it is not available, it assumes that there are 3 mouse buttons. Hence, we returned 3 when XListInputDevices() fails.</font><br><br><font size="2">if (local_num_buttons == 0 ) {   </font><br><font size="2">   local_num_buttons = 3;</font><br><font size="2">}</font><br><br><font size="2">I've verified that the testcase passes with the earlier provided patch.</font><br><font size="2">Also, as per your suggestion I have initialized "ndevices" to zero just before calling the XListInputDevices to verify whether it remains unmodified in the error scenario or not.</font><br><font size="2">But I can see that it gets modified in the error scenario too.</font><br><font size="2">I am further testing this behaviour with different level of libXi6 versions and will let you know the test results.</font><br><br><font size="2">I have also attached hs_err log file which got generated without any patch.</font><br><br><i>(See attached file: hs_err_pid10187.log)</i><font size="2"><br></font><br><font size="2">With Thanks and Regards,</font><br><font size="2">Jitendra Singh.</font><br><img width="16" height="16" src="cid:2__=8FBB0B48DFB5862A8f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Sergey Bylokhov ---11/15/2017 01:57:38 AM---Hi, I have a question about this bug."><font size="2" color="#424282">Sergey Bylokhov ---11/15/2017 01:57:38 AM---Hi, I have a question about this bug.</font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Sergey Bylokhov <Sergey.Bylokhov@oracle.com></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">Jitendra Singh <jitendra.enania@in.ibm.com></font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">"awt-dev@openjdk.java.net" <awt-dev@openjdk.java.net></font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">11/15/2017 01:57 AM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">Re: <AWT Dev> Crash in "getNumButtons" (libawt_xawt.so) after applying Linux OS patch " libXi6-1.7.4-12.2.x86_64</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><tt><font size="2">Hi,<br>I have a question about this bug.<br>  - Why the value 3 is returned? Why it is not zero?<br><br>I think this is a bug which was discussed here:<br></font></tt><tt><font size="2"><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.x.org_archives_xorg-2Ddevel_2016-2DOctober_051607.html&d=DwIC-g&c=jf_iaSHvJObTbx-siA1ZOg&r=0L21t05E0bkqMNvRjqOT3QTh6xvEnZ4nyHVAbgIc7Fs&m=HwOFsW3gDW3R4uqf3cvbhQNhurE_3dAnM311_M_SV7M&s=vzSp7At08_KJFkEcjlNdO5mZb9xWc0-V3OCh9GxjP3k&e=">https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.x.org_archives_xorg-2Ddevel_2016-2DOctober_051607.html&d=DwIC-g&c=jf_iaSHvJObTbx-siA1ZOg&r=0L21t05E0bkqMNvRjqOT3QTh6xvEnZ4nyHVAbgIc7Fs&m=HwOFsW3gDW3R4uqf3cvbhQNhurE_3dAnM311_M_SV7M&s=vzSp7At08_KJFkEcjlNdO5mZb9xWc0-V3OCh9GxjP3k&e=</a></font></tt><tt><font size="2"><br>Those xix updates the spec of this method:<br>"+RETURN VALUE<br>+------------<br>+<br>+   XListInputDevices returns a pointer to an array of XDeviceInfo<br>+   structs and sets ndevices_return to the number of elements in<br>+   that array. To free the XDeviceInfo array created by<br>+   XListInputDevices, use XFreeDeviceList.<br>+<br>+   On error, XListInputDevices returns NULL and ndevices_return is<br>+   left unmodified."<br><br>Can you please confirm that by initialization of "ndevices" to zero <br>before calling the XListInputDevices.<br><br>On 10/11/2017 05:26, Jitendra Singh wrote:<br>> Hi,<br>> <br>> *DETAILS ABOUT THE PROBLEM*<br>> Crash in "getNumButtons" (libawt_xawt.so) after applying Linux OS patch <br>> " libXi6-1.7.4-12.2.x86_64.<br>> <br>> Inactive hide details for Java Call Stack:-Java Call Stack:-<br>> AWT-EventQueue-0 (java.awt.EventDispatchThread@0xFFEEA8D8)<br>> sun/awt/X11/XToolkit.getNumberOfButtonsImpl ()I<br>> sun/awt/X11/XToolkit.getNumberOfButtons ()I(1483)<br>> sun/awt/X11/XToolkit.initializeDesktopProperties ()V(1466)<br>> java/awt/Toolkit.getDesktopProperty <br>> (Ljava/lang/String;)Ljava/lang/Object;(1801)<br>> sun/swing/SwingUtilities2$AATextInfo.getAATextInfo <br>> (Z)Lsun/swing/SwingUtilities2$AATextInfo;(163)<br>> javax/swing/plaf/metal/MetalLookAndFeel.initComponentDefaults <br>> (Ljavax/swing/UIDefaults;)V<br>> javax/swing/plaf/basic/BasicLookAndFeel.getDefaults <br>> ()Ljavax/swing/UIDefaults;(159)<br>> javax/swing/plaf/metal/MetalLookAndFeel.getDefaults <br>> ()Ljavax/swing/UIDefaults;(1588)<br>> javax/swing/UIManager.setLookAndFeel (Ljavax/swing/LookAndFeel;)V(550)<br>> javax/swing/UIManager.setLookAndFeel (Ljava/lang/String;)V(590)<br>> javax/swing/UIManager.initializeDefaultLAF (Ljava/util/Properties;)V(1360)<br>> javax/swing/UIManager.initialize ()V(1470)<br>> javax/swing/UIManager.maybeInitialize ()V(1437)<br>> javax/swing/UIManager.getUI <br>> (Ljavax/swing/JComponent;)Ljavax/swing/plaf/ComponentUI;(1017)<br>> javax/swing/JPanel.updateUI ()V(137)<br>> javax/swing/JPanel.<init> (Ljava/awt/LayoutManager;Z)V(97)<br>> javax/swing/JPanel.<init> (Ljava/awt/LayoutManager;)V(106)<br>> com/ibm/acsp/monitor/MonitorPanel.<init> ()V<br>> com/ibm/acsp/monitor/Monitor.<init> ()V<br>> com/ibm/acsp/monitor/Monitor$4.run ()V<br>> java/awt/event/InvocationEvent.dispatch ()V(322)<br>> java/awt/EventQueue.dispatchEventImpl <br>> (Ljava/awt/AWTEvent;Ljava/lang/Object;)V(767)<br>> java/awt/EventQueue.access$500 <br>> (Ljava/awt/EventQueue;Ljava/awt/AWTEvent;Ljava/lang/Object;)V(108)<br>> java/awt/EventQueue$3.run ()Ljava/lang/Void;(720)<br>> java/awt/EventQueue$3.run ()Ljava/lang/Object;(714)<br>> java/security/AccessController.doPrivileged <br>> (Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;(529)<br>> java/security/ProtectionDomain$1.doIntersectionPrivilege <br>> (Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;(86)<br>> java/awt/EventQueue.dispatchEvent (Ljava/awt/AWTEvent;)V(737)<br>> java/awt/EventDispatchThread.pumpOneEventForFilters (I)V(212)<br>> java/awt/EventDispatchThread.pumpEventsForFilter <br>> (ILjava/awt/Conditional;Ljava/awt/EventFilter;)V(127)<br>> java/awt/EventDispatchThread.pumpEventsForHierarchy <br>> (ILjava/awt/Conditional;Ljava/awt/Component;)V(116)<br>> java/awt/EventDispatchThread.pumpEvents (ILjava/awt/Conditional;)V(112)<br>> java/awt/EventDispatchThread.pumpEvents (Ljava/awt/Conditional;)V(104)<br>> java/awt/EventDispatchThread.run ()V(93)<br>> <br>> Native Call Stack:-<br>> <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/compressedrefs/libj9prt28.so<br>> <signal handler called><br>> getNumButtons () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/libawt_xawt.so<br>> Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/libawt_xawt.so<br>> JVMprJavaSendNative () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/compressedrefs/libj9vm28.so<br>> ?? ()<br>> resolveSpecialMethodRefInto () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/compressedrefs/libj9vm28.so<br>> VM_BytecodeInterpreter::run(J9VMThread*) () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/compressedrefs/libj9vm28.so<br>> bytecodeLoop () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/compressedrefs/libj9vm28.so<br>> <br>> Inactive hide details for Native StackNative Stack<br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/compressedrefs/libj9prt28.so<br>> <signal handler called><br>> getNumButtons () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/libawt_xawt.so<br>> Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/libawt_xawt.so<br>> JVMprJavaSendNative () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/compressedrefs/libj9vm28.so<br>> ?? ()<br>> resolveSpecialMethodRefInto () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/compressedrefs/libj9vm28.so<br>> VM_BytecodeInterpreter::run(J9VMThread*) () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/compressedrefs/libj9vm28.so<br>> bytecodeLoop () from <br>> ./opt/ibm/acsp-server/jvm64/jre/lib/amd64/compressedrefs/libj9vm28.so<br>> <br>> *RECREATION STEPS*<br>> Run the attached MouseInfo.java testcase on a linux box having Linux OS <br>> patch " libXi6-1.7.4-12.2.x86_64 or higher.<br>> <br>> *PROBLEM ANALYSIS*<br>> The reported issue started happening after applying the Linux OS patch " <br>> libXi6-1.7.4-12.2.x86_64.<br>> With our investigation this seems to be bug at the OS layer in which OS <br>> API ListInputDevices returns "null" even though the number of input <br>> devices are not zero.<br>> Although the crash is observed due to the failure of OS API, ideally JDK <br>> should not have been crashed. We need to take care of this "NULL" <br>> scenario at the JDK level.<br>> <br>> *Suggested Fix:-*<br>> Introduced a Null check in "getNumButtons" function (XToolkit.c).<br>> /(See attached file: webrev.zip)/<br>> <br>> Able to build the above fix against JDK 10 and triggered jtreg tests. I <br>> will share the test results soon.<br>> <br>> *Testcase:-*<br>> /(See attached file: MouseInfoTest.java)/<br>> <br>> With Thanks and Regards,<br>> Jitendra Singh.<br>> <br><br><br>-- <br>Best regards, Sergey.<br><br></font></tt><br><br><BR>
</body></html>