-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bootstrap should implement a denylist of Java versions (ranges) #3164
Conversation
❌ Gradle Check failure d9fde1891763dce034584eb2a7293d5c0ea0791c |
Signed-off-by: Andriy Redko <[email protected]>
❌ Gradle Check failure f81189adb6d88ed71e16d1ef2257d34558fea14b |
server/src/main/java/org/opensearch/bootstrap/BootstrapChecks.java
Outdated
Show resolved
Hide resolved
.findAny() | ||
.map( | ||
p -> BootstrapCheckResult.failure( | ||
String.format(Locale.ROOT, "The current JVM version %s is not recommended for use: %s", getVersion(), p.getReason()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we say where it comes from (JAVA_HOME location)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually publish this information at startup already (at the beginning of startup sequence), at this moment we just saying that it is not recommended
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[2022-05-11T10:16:02,879][INFO ][o.o.n.Node ] [xxx] version[3.0.0-SNAPSHOT], pid[87008], build[tar/7903ceb845b9f4ed395cce28104c689831ae6379/2022-05-10T18:15:09.508767Z], OS[Linux/5.15.0-27-generic/amd64], JVM[Eclipse Adoptium/OpenJDK 64-Bit Server VM/17.0.3/17.0.3+7]
[2022-05-11T10:16:02,881][INFO ][o.o.n.Node ] [xxx] JVM home [/OpenSearch/OpenSearch/distribution/archives/linux-tar/build/install/opensearch-3.0.0-SNAPSHOT/jdk], using bundled JDK [true]
[2022-05-11T10:16:02,882][INFO ][o.o.n.Node ] [xxx] JVM arguments [-Xshare:auto, -Dopensearch.networkaddress.cache.ttl=60, -Dopensearch.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, -Xms1g, -Xmx1g, -XX:+UseG1GC, -XX:G1ReservePercent=25, -XX:InitiatingHeapOccupancyPercent=30, -Djava.io.tmpdir=/tmp/opensearch-18176176448873412724, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -XX:MaxDirectMemorySize=536870912, -Dopensearch.path.home=/OpenSearch/OpenSearch/distribution/archives/linux-tar/build/install/opensearch-3.0.0-SNAPSHOT, -Dopensearch.path.conf=/OpenSearch/OpenSearch/distribution/archives/linux-tar/build/install/opensearch-3.0.0-SNAPSHOT/config, -Dopensearch.distribution.type=tar, -Dopensearch.bundled_jdk=true]
server/src/main/java/org/opensearch/bootstrap/jvm/DenyJvmVersionsParser.java
Show resolved
Hide resolved
Signed-off-by: Andriy Redko <[email protected]>
checks.add(new AllPermissionCheck()); | ||
checks.add(new DiscoveryConfiguredCheck()); | ||
return Collections.unmodifiableList(checks); | ||
} | ||
|
||
static class JavaVersionCheck implements BootstrapCheck { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also implement alwaysEnforce
so that it cannot by bypassed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure of it: by and large, it is not critical issue which will incur data loss or something, I don't see any checks (besides OutOfMemory) which mandate alwaysEnforce
.
@reta sorry, this slipped through my notifications. Merged now 😄 |
* Bootstrap should implement a denylist of Java versions (ranges) Signed-off-by: Andriy Redko <[email protected]> * Addressing code review comments Signed-off-by: Andriy Redko <[email protected]> (cherry picked from commit 677915d)
… (#3292) Signed-off-by: Andriy Redko <[email protected]> (cherry picked from commit 677915d)
Signed-off-by: Andriy Redko [email protected]
Description
Implements runtime version checks on startup in order to prevent running with JDK versions known to be flawed (see please [1]). The example of failed bootstrap check:
[1] #2791
Issues Resolved
Closes #3005
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.