8270199: Most SA tests are skipped on macosx-aarch64 because all executables are signed
Reviewed-by: dholmes, kevinw
This commit is contained in:
parent
d2a50a6492
commit
16e0ad0ad0
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -121,10 +121,10 @@ serviceability/dcmd/gc/RunFinalizationTest.java 8227120 linux-all,windows-x64
|
|||||||
serviceability/sa/ClhsdbCDSCore.java 8269982,8267433 macosx-aarch64,macosx-x64
|
serviceability/sa/ClhsdbCDSCore.java 8269982,8267433 macosx-aarch64,macosx-x64
|
||||||
serviceability/sa/ClhsdbFindPC.java#xcomp-core 8269982,8267433 macosx-aarch64,macosx-x64
|
serviceability/sa/ClhsdbFindPC.java#xcomp-core 8269982,8267433 macosx-aarch64,macosx-x64
|
||||||
serviceability/sa/ClhsdbFindPC.java#no-xcomp-core 8269982,8267433 macosx-aarch64,macosx-x64
|
serviceability/sa/ClhsdbFindPC.java#no-xcomp-core 8269982,8267433 macosx-aarch64,macosx-x64
|
||||||
serviceability/sa/ClhsdbPmap.java#core 8267433 macosx-x64
|
serviceability/sa/ClhsdbPmap.java#core 8269982,8267433 macosx-aarch64,macosx-x64
|
||||||
serviceability/sa/ClhsdbPstack.java#core 8269982,8267433 macosx-aarch64,macosx-x64
|
serviceability/sa/ClhsdbPstack.java#core 8269982,8267433 macosx-aarch64,macosx-x64
|
||||||
serviceability/sa/TestJmapCore.java 8267433 macosx-x64
|
serviceability/sa/TestJmapCore.java 8269982,8267433 macosx-aarch64,macosx-x64
|
||||||
serviceability/sa/TestJmapCoreMetaspace.java 8267433 macosx-x64
|
serviceability/sa/TestJmapCoreMetaspace.java 8269982,8267433 macosx-aarch64,macosx-x64
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -53,7 +53,7 @@ public class TestMutuallyExclusivePlatformPredicates {
|
|||||||
IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild",
|
IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild",
|
||||||
"isSlowDebugBuild", "hasSA", "isRoot", "isTieredSupported",
|
"isSlowDebugBuild", "hasSA", "isRoot", "isTieredSupported",
|
||||||
"areCustomLoadersSupportedForCDS", "isDefaultCDSArchiveSupported",
|
"areCustomLoadersSupportedForCDS", "isDefaultCDSArchiveSupported",
|
||||||
"isSignedOSX");
|
"isHardenedOSX");
|
||||||
|
|
||||||
public final List<String> methodNames;
|
public final List<String> methodNames;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,8 +23,10 @@
|
|||||||
|
|
||||||
package jdk.test.lib;
|
package jdk.test.lib;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -242,13 +244,13 @@ public class Platform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the test JDK is signed, otherwise false. Only valid on OSX.
|
* Return true if the test JDK is hardened, otherwise false. Only valid on OSX.
|
||||||
*/
|
*/
|
||||||
public static boolean isSignedOSX() throws IOException {
|
public static boolean isHardenedOSX() throws IOException {
|
||||||
// We only care about signed binaries for 10.14 and later (actually 10.14.5, but
|
// We only care about hardened binaries for 10.14 and later (actually 10.14.5, but
|
||||||
// for simplicity we'll also include earlier 10.14 versions).
|
// for simplicity we'll also include earlier 10.14 versions).
|
||||||
if (getOsVersionMajor() == 10 && getOsVersionMinor() < 14) {
|
if (getOsVersionMajor() == 10 && getOsVersionMinor() < 14) {
|
||||||
return false; // assume not signed
|
return false; // assume not hardened
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the path to the java binary.
|
// Find the path to the java binary.
|
||||||
@ -260,38 +262,45 @@ public class Platform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run codesign on the java binary.
|
// Run codesign on the java binary.
|
||||||
ProcessBuilder pb = new ProcessBuilder("codesign", "-d", "-v", javaFileName);
|
ProcessBuilder pb = new ProcessBuilder("codesign", "--display", "--verbose", javaFileName);
|
||||||
pb.redirectError(ProcessBuilder.Redirect.DISCARD);
|
pb.redirectErrorStream(true); // redirect stderr to stdout
|
||||||
pb.redirectOutput(ProcessBuilder.Redirect.DISCARD);
|
|
||||||
Process codesignProcess = pb.start();
|
Process codesignProcess = pb.start();
|
||||||
|
BufferedReader is = new BufferedReader(new InputStreamReader(codesignProcess.getInputStream()));
|
||||||
|
String line;
|
||||||
|
boolean isHardened = false;
|
||||||
|
boolean hardenedStatusConfirmed = false; // set true when we confirm whether or not hardened
|
||||||
|
while ((line = is.readLine()) != null) {
|
||||||
|
System.out.println("STDOUT: " + line);
|
||||||
|
if (line.indexOf("flags=0x10000(runtime)") != -1 ) {
|
||||||
|
hardenedStatusConfirmed = true;
|
||||||
|
isHardened = true;
|
||||||
|
System.out.println("Target JDK is hardened. Some tests may be skipped.");
|
||||||
|
} else if (line.indexOf("flags=0x20002(adhoc,linker-signed)") != -1 ) {
|
||||||
|
hardenedStatusConfirmed = true;
|
||||||
|
isHardened = false;
|
||||||
|
System.out.println("Target JDK is adhoc signed, but not hardened.");
|
||||||
|
} else if (line.indexOf("code object is not signed at all") != -1) {
|
||||||
|
hardenedStatusConfirmed = true;
|
||||||
|
isHardened = false;
|
||||||
|
System.out.println("Target JDK is not signed, therefore not hardened.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hardenedStatusConfirmed) {
|
||||||
|
System.out.println("Could not confirm if TargetJDK is hardened. Assuming not hardened.");
|
||||||
|
isHardened = false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (codesignProcess.waitFor(10, TimeUnit.SECONDS) == false) {
|
if (codesignProcess.waitFor(10, TimeUnit.SECONDS) == false) {
|
||||||
System.err.println("Timed out waiting for the codesign process to complete. Assuming not signed.");
|
System.err.println("Timed out waiting for the codesign process to complete. Assuming not hardened.");
|
||||||
codesignProcess.destroyForcibly();
|
codesignProcess.destroyForcibly();
|
||||||
return false; // assume not signed
|
return false; // assume not hardened
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check codesign result to see if java binary is signed. Here are the
|
return isHardened;
|
||||||
// exit code meanings:
|
|
||||||
// 0: signed
|
|
||||||
// 1: not signed
|
|
||||||
// 2: invalid arguments
|
|
||||||
// 3: only has meaning with the -R argument.
|
|
||||||
// So we should always get 0 or 1 as an exit value.
|
|
||||||
if (codesignProcess.exitValue() == 0) {
|
|
||||||
System.out.println("Target JDK is signed. Some tests may be skipped.");
|
|
||||||
return true; // signed
|
|
||||||
} else if (codesignProcess.exitValue() == 1) {
|
|
||||||
System.out.println("Target JDK is not signed.");
|
|
||||||
return false; // not signed
|
|
||||||
} else {
|
|
||||||
System.err.println("Executing codesign failed. Assuming unsigned: " +
|
|
||||||
codesignProcess.exitValue());
|
|
||||||
return false; // not signed
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isArch(String archnameRE) {
|
private static boolean isArch(String archnameRE) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -63,8 +63,8 @@ public class SATestUtils {
|
|||||||
throw new SkippedException("SA Attach not expected to work. Ptrace attach not supported.");
|
throw new SkippedException("SA Attach not expected to work. Ptrace attach not supported.");
|
||||||
}
|
}
|
||||||
} else if (Platform.isOSX()) {
|
} else if (Platform.isOSX()) {
|
||||||
if (Platform.isSignedOSX()) {
|
if (Platform.isHardenedOSX()) {
|
||||||
throw new SkippedException("SA Attach not expected to work. JDK is signed.");
|
throw new SkippedException("SA Attach not expected to work. JDK is hardened.");
|
||||||
}
|
}
|
||||||
if (!Platform.isRoot() && !canAddPrivileges()) {
|
if (!Platform.isRoot() && !canAddPrivileges()) {
|
||||||
throw new SkippedException("SA Attach not expected to work. Insufficient privileges (not root and can't use sudo).");
|
throw new SkippedException("SA Attach not expected to work. Insufficient privileges (not root and can't use sudo).");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -138,12 +138,12 @@ public class CoreUtils {
|
|||||||
if (!coresDir.canWrite()) {
|
if (!coresDir.canWrite()) {
|
||||||
throw new SkippedException("Directory \"" + coresDir + "\" is not writable");
|
throw new SkippedException("Directory \"" + coresDir + "\" is not writable");
|
||||||
}
|
}
|
||||||
if (Platform.isSignedOSX()) {
|
if (Platform.isHardenedOSX()) {
|
||||||
if (Platform.getOsVersionMajor() > 10 ||
|
if (Platform.getOsVersionMajor() > 10 ||
|
||||||
(Platform.getOsVersionMajor() == 10 && Platform.getOsVersionMinor() >= 15))
|
(Platform.getOsVersionMajor() == 10 && Platform.getOsVersionMinor() >= 15))
|
||||||
{
|
{
|
||||||
// We can't generate cores files with signed binaries on OSX 10.15 and later.
|
// We can't generate cores files with hardened binaries on OSX 10.15 and later.
|
||||||
throw new SkippedException("Cannot produce core file with signed binary on OSX 10.15 and later");
|
throw new SkippedException("Cannot produce core file with hardened binary on OSX 10.15 and later");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Platform.isLinux()) {
|
} else if (Platform.isLinux()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user