8184808: (process) isAlive should use pid for validity, not /proc/pid
Reviewed-by: stuefe, xiaofeya
--- a/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c Wed Jul 19 19:31:48 2017 +0100
+++ b/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c Wed Jul 19 16:24:38 2017 -0400
@@ -662,6 +662,11 @@
return -1;
}
+ // Validate the pid before returning the info in case /proc/pid is racy
+ if (kill(pid, 0) < 0) {
+ return -1;
+ }
+
*totalTime = psinfo.pr_time.tv_sec * 1000000000L + psinfo.pr_time.tv_nsec;
*startTime = psinfo.pr_start.tv_sec * (jlong)1000 +