Skip to content
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

Remove -Xverify:none from Java invocations #11381

Closed
guw opened this issue May 13, 2020 · 4 comments
Closed

Remove -Xverify:none from Java invocations #11381

guw opened this issue May 13, 2020 · 4 comments
Assignees
Labels
area-java-toolchains javabase, java_toolchain flags, JDK selection, java_toolchain rules, java_tools repository P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules type: process

Comments

@guw
Copy link
Contributor

guw commented May 13, 2020

Description of the problem / feature request:

Bazel currently add -Xverify:none to Java commands it executes.

Feature requests: what underlying problem are you trying to solve with this feature?

This is a dangerous option because it disables the byte code verifier. Having the option in place without justification/documentation reduces trust of our developers/users.

The option has been deprecated in Java 13 and will be removed in a future release.

Please remove the option.

Alternatively please provide a flag to disable it and add documentation why it's needed and what the risks are of removing/disabling -Xverify:none with regards to Bazel.

@guw
Copy link
Contributor Author

guw commented May 13, 2020

I found it in the following locations:


There might be more.

@jin jin added team-Rules-Java Issues for Java rules untriaged labels May 14, 2020
@jin
Copy link
Member

jin commented May 14, 2020

cc @cushon / @lberki, do you have the context on why this flag is hardcoded?

@cushon
Copy link
Contributor

cushon commented May 17, 2020

The motivation was to improve startup performance of host tools that we trust. The hard-coded flags for JavaBuilder and turbine were made obsolete by java_toolchain.jvm_opts, which allows them to be configured in the toolchain instead.

I don't know a replacement for SpawnAction, but hard-disabling verification for all Java tools using SpawnAction seems kind of iffy.

I don't have any concerns with trying to remove these.

@lberki lberki added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Oct 5, 2020
@lberki
Copy link
Contributor

lberki commented Oct 5, 2020

Echoing @cushon's opinion, at the very least, this should not be hardcoded into Bazel itself but in the individual Java toolchains.

@comius comius self-assigned this Nov 21, 2020
@comius comius added the area-java-toolchains javabase, java_toolchain flags, JDK selection, java_toolchain rules, java_tools repository label Nov 21, 2020
bazel-io pushed a commit that referenced this issue Dec 7, 2020
corresponding to `javabuilder_jvm_opts` and `turbine_jvm_opts`, to allow
tool-specific inputs. Currently the only way to specify additional inputs is
with the shared `tools` attribute, which means the Class Data Sharing archives
for JavaBuilder and Turbine are both passed when invoking either tool.

Also refactor the handling of the tool-specific inputs into
'JavaToolchainTool', which encapsulates the deploy jars, jvm flags, and data
inputs for each tool.

Also, stop hard-coding `-X:verifyNone` in a couple of places. It's explicitly
configured in our `java_toolchain`, and hard-coding it in Bazel was never
a good idea (see e.g. #11381).

PiperOrigin-RevId: 346151606
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    The motivation was to improve startup performance of host tools that we trust.
    The hard-coded flags for JavaBuilder and turbine were made obsolete by
    `java_toolchain.jvm_opts`, which allows them to be configured in the toolchain
    instead.

    The option has been deprecated in Java 13 and will be removed in a future
    release.

    Fixes bazelbuild/bazel#11381

    PiperOrigin-RevId: 346160835
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-java-toolchains javabase, java_toolchain flags, JDK selection, java_toolchain rules, java_tools repository P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules type: process
Projects
None yet
Development

No branches or pull requests

5 participants