mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
Update comments in findTargetProcessTmpDirectory()
This commit is contained in:
parent
8f11d43ba2
commit
b6dbde9f9f
@ -258,20 +258,22 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine {
|
||||
final var tmpOnProcPidRoot = PROC.resolve(Long.toString(pid)).resolve(ROOT_TMP);
|
||||
|
||||
/* We need to handle at least 4 different cases:
|
||||
* 1. Caller and target processes share PID namespace and root filesystem (host to host or container to
|
||||
* container with both /tmp mounted between containers).
|
||||
* 2. Caller and target processes share PID namespace and root filesystem but the target process has elevated
|
||||
* privileges (host to host).
|
||||
* 3. Caller and target processes share PID namespace but NOT root filesystem (container to container).
|
||||
* 4. Caller and target processes share neither PID namespace nor root filesystem (host to container)
|
||||
* 1. Caller and target processes share PID namespace and root
|
||||
* filesystem (host to host or container to container with both /tmp
|
||||
* mounted between containers).
|
||||
* 2. Caller and target processes share PID namespace and root
|
||||
* filesystem but the target process has elevated privileges
|
||||
* (host to host).
|
||||
* 3. Caller and target processes share PID namespace but NOT root
|
||||
* filesystem (container to container).
|
||||
* 4. Caller and target processes share neither PID namespace nor root
|
||||
* filesystem (host to container)
|
||||
*
|
||||
* if target is elevated, we cant use /proc/<pid>/... so we have to fallback to /tmp, but that may not be shared
|
||||
* with the target/attachee process, so we should check whether /tmp on both is same. This method would throw
|
||||
* AttachNotSupportedException if they are different because we cannot make a connection with target VM.
|
||||
*
|
||||
* In addition, we can also check the target pid's signal masks to see if it catches SIGQUIT and only do so if in
|
||||
* fact it does ... this reduces the risk of killing an innocent process in the current ns as opposed to
|
||||
* attaching to the actual target JVM ... c.f: checkCatchesAndSendQuitTo() below.
|
||||
* if target is elevated, we cant use /proc/<pid>/... so we have to
|
||||
* fallback to /tmp, but that may not be shared with the target/attachee
|
||||
* process, so we should check whether /tmp on both is same. This method
|
||||
* would throw AttachOperationFailedException if they are different
|
||||
* because we cannot make a connection with target VM.
|
||||
*/
|
||||
|
||||
try {
|
||||
@ -303,7 +305,8 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine {
|
||||
// exception should not happen.
|
||||
throw new AssertionError("Unexpected exception", e);
|
||||
} catch (MonitorException e) {
|
||||
// Other exceptions (happened at MonitoredHost) would be wrapped with AttachOperationFailedException
|
||||
// Other exceptions (happened at MonitoredHost) would be wrapped
|
||||
// with AttachOperationFailedException.
|
||||
throw new AttachOperationFailedException("Unable to find target proces", e);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user