attach in linux hangs due to permission denied accessing /proc/pid/root
authorSebastian Lövdahl <sebastian.lovdahl@hibox.tv>
Sat, 29 Jun 2024 07:05:11 +0000 (09:05 +0200)
committerMatthias Klose <doko@ubuntu.com>
Sat, 29 Jun 2024 07:05:11 +0000 (09:05 +0200)
commit4b49eebc2bf549ddc5fb47679e88a8c325a95f98
treed1b52be837b8f02d4eebe468546b21ec4248308a
parent7b209cddf00c4fe1ca0aac51c4b5ff0705f67f85
attach in linux hangs due to permission denied accessing /proc/pid/root

Bug: https://bugs.openjdk.org/browse/JDK-8307977
Bug: https://bugs.openjdk.org/browse/JDK-8226919
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1034601
Last-Update: 2023-04-18

 The attach API uses /proc/pid/root in order to support containers.
 Dereferencing this symlink is governed by ptrace access mode PTRACE_MODE_READ_FSCREDS
 which may not succeed when running as the user running the JRE.
 This breaks running jcmd and jmap as the same user the JVM is running as.
 Use tmpdir when pid matches ns_pid.
From 36b554e2de46d77898be4d0feae0ee2171b445bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20L=C3=B6vdahl?= <sebastian.lovdahl@hibox.tv>
Date: Tue, 18 Apr 2023 12:50:32 +0300
Subject: [PATCH] 8226919: Fix dynamic attach in Linux for non-container
 environments

Gbp-Pq: Name jdk-8307977-proposed.patch
src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java