Skip to content

Commit f04d254

Browse files
committed
Add property to allow disabling user check for J9 which does not seem to be implemented.
1 parent 5b7c966 commit f04d254

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,6 +1627,13 @@ protected Connection doConnect(File socket) {
16271627
*/
16281628
class ForOpenJ9 extends AbstractBase {
16291629

1630+
/**
1631+
* Property to indicate that the attachment does not validate that the attach file is owned by
1632+
* the current user. J9 requires this by its documentation but it does not appear to always be
1633+
* implemented.
1634+
*/
1635+
public static final String IGNORE_USER = "net.bytebuddy.attach.j9.ignoreuser";
1636+
16301637
/**
16311638
* The temporary folder for attachment files for OpenJ9 VMs.
16321639
*/
@@ -1688,10 +1695,11 @@ public static VirtualMachine attach(String processId, int timeout, Dispatcher di
16881695
if (vmFolder == null) {
16891696
throw new IllegalStateException("No descriptor files found in " + directory);
16901697
}
1698+
boolean ignoreUser = Boolean.getBoolean(IGNORE_USER);
16911699
long userId = dispatcher.userId();
16921700
virtualMachines = new ArrayList<Properties>();
16931701
for (File aVmFolder : vmFolder) {
1694-
if (aVmFolder.isDirectory() && dispatcher.getOwnerIdOf(aVmFolder) == userId) {
1702+
if (aVmFolder.isDirectory() && (ignoreUser || dispatcher.getOwnerIdOf(aVmFolder) == userId)) {
16951703
File attachInfo = new File(aVmFolder, "attachInfo");
16961704
if (attachInfo.isFile()) {
16971705
Properties virtualMachine = new Properties();

0 commit comments

Comments
 (0)