Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8197387

jcmd started by "root" must be allowed to access all VM processes

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u171, 10.0.1, 11
    • Fix Version/s: 11
    • Component/s: core-svc
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b17

      Backports

        Description

        The case is when the user B (root) tries to access with jcmd tool the Java process started by user A.

        If user B is the root then launching jcmd without any arguments lists ALL Java processes running regardless what user started them. But trying to access the processes started by another user with jcmd (jcmd <pid or main class name> <jcmd commad>) results in the the Java process dumps threads in the standard output and jcmd prints AttachNotSupportedException.

        Below are the steps to reproduce.

        1. Login to Oracle Linux 7.4 machine as user (e.g. test) and launch some Java process , e.g. "/jdk/bin/java -cp /test/test.jar SimpleProcess"

        2. While the Java process is running connect to the same machine as another user and invoke jcmd to see the list of available commands for this VM (e.g. "sudo /jdk/bin/jcmd SimpleProcess help"; withouts "sudo" jcmd does not see the process started by another user)

        Expected result:
          Jcmd prints the list of the available commands for the specified Java process
        Actual results:
          Java process: starts outputting the full thread dump ( see attachment)
          Jcmd: prints process id and then throws an exception: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /proc/27245/root/tmp/.java_pid27245: target process 27245 doesn't respond within 10500ms or HotSpot VM not loaded
        at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:100)
        at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58)
        at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
        at jdk.jcmd/sun.tools.jcmd.JCmd.executeCommandForPid(JCmd.java:114)
        at jdk.jcmd/sun.tools.jcmd.JCmd.main(JCmd.java:98)
        [opc@serviceability-1 ~]$



          Attachments

          1. Process_1.txt
            33 kB
          2. Process_1.txt
            33 kB
          3. Process_2.txt
            0.7 kB
          4. Process_2.txt
            0.7 kB

            Issue Links

              Activity

                People

                • Assignee:
                  dtitov Daniil Titov
                  Reporter:
                  dtitov Daniil Titov
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: