jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8295264: Fix PaX check on RISC-V

Open luhenry opened this issue 2 years ago • 3 comments

On Linux RISC-V, PROT_WRITE doesn't imply PROT_READ [1]

The fix is to pass PROT_READ|PROT_WRITE. That matches all other calls to mmap in hotspot.

[1] https://lkml.org/lkml/2022/9/8/1066


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10690/head:pull/10690
$ git checkout pull/10690

Update a local copy of the PR:
$ git checkout pull/10690
$ git pull https://git.openjdk.org/jdk pull/10690/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10690

View PR using the GUI difftool:
$ git pr show -t 10690

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10690.diff

luhenry avatar Oct 13 '22 07:10 luhenry

:wave: Welcome back luhenry! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Oct 13 '22 07:10 bridgekeeper[bot]

@luhenry The following label will be automatically applied to this pull request:

  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar Oct 13 '22 07:10 openjdk[bot]

Webrevs

mlbridge[bot] avatar Oct 13 '22 07:10 mlbridge[bot]

I see the LKML link mentions this: "Just remove the check altogether and let PROT_WRITE imply PROT_READ as is the case on other architectures.". Is this change still necessary then? Thanks.

RealFYang avatar Oct 17 '22 08:10 RealFYang

I see the LKML link mentions this: "Just remove the check altogether and let PROT_WRITE imply PROT_READ as is the case on other architectures.". Is this change still necessary then? Thanks.

That would be necessary for any older version of Linux. Also, it allows it to match all other calls to ::mmap in hotspot.

luhenry avatar Oct 17 '22 08:10 luhenry

I see the LKML link mentions this: "Just remove the check altogether and let PROT_WRITE imply PROT_READ as is the case on other architectures.". Is this change still necessary then? Thanks.

That would be necessary for any older version of Linux. Also, it allows it to match all other calls to ::mmap in hotspot.

That makes sence to me. Changes looks good to me.

RealFYang avatar Oct 17 '22 08:10 RealFYang

@luhenry This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8295264: Fix PaX check on RISC-V

Reviewed-by: yadongwang, fyang

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 40 new commits pushed to the master branch:

  • cf07eaeb9291da725181832b8bb1dc54957ba886: 8295020: javac emits incorrect code for for-each on an intersection type.
  • b3bb3e6ed89f3abcaae584fcbe75688141e886cb: 8295325: tools/jlink/plugins/SaveJlinkArgfilesPluginTest.java fails on Linux ppc64le
  • 9005af3b90fbd3607aeb83efe1c4a6ffa5d104f0: 8295110: RISC-V: Mark out relocations as incompressible
  • 74a51ccc86525eb4b1eb2e5cb11e605ca9e9fc5d: 8292698: Improve performance of DataInputStream
  • d3781ac8a38943d8a20304e770b01d5418ee33d0: 8295009: RISC-V: Interpreter intrinsify Thread.currentThread()
  • e7d0ab227ff86bb65abf7fbeb135ce657454200b: 8295379: ProblemList java/lang/Float/Binary16Conversion.java in Xcomp mode on x64
  • 404e8de1559adade31df98a83919841f080b5b89: 8294865: x86: Improve the code generation of MulVB and MulVL
  • 2087424736f15a5a80a0492993a6cd74da87188a: 8295370: Update java.io.ObjectStreamField to use Class.descriptorString
  • 8487c56f7ea224169d9d42efda9efb824266289f: 8295294: Misc cleanups in runtime/InvocationTests
  • 0043d58c5d52c3b299a4b6dfcec34a7db5041aea: 8293531: C2: some vectorapi tests fail assert "Not monotonic" with flag -XX:TypeProfileLevel=222
  • ... and 30 more: https://git.openjdk.org/jdk/compare/6ae7e4d4aad5712cf2fe6ab9f98dc424fa4170cb...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@RealFYang) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

openjdk[bot] avatar Oct 17 '22 08:10 openjdk[bot]

/integrate

luhenry avatar Oct 17 '22 09:10 luhenry

@luhenry Your change (at version 355fc63011ce11b654f22c520721a9212d2fe9d0) is now ready to be sponsored by a Committer.

openjdk[bot] avatar Oct 17 '22 09:10 openjdk[bot]

/sponsor

RealFYang avatar Oct 18 '22 09:10 RealFYang

Going to push as commit 4434cbb719db37880b48474ba342f300ed4828a8. Since your change was applied there have been 62 commits pushed to the master branch:

  • a8c18ebc152842281b22534507b4a09612ea3498: 8295257: Remove implicit noreg temp register arguments in aarch64 MacroAssembler
  • 6553065cab9ecb14390da8ec34e49aba940b213f: 8295273: Remove unused argument in [load/store]_sized_value on aarch64 and riscv
  • b06f1b149c8f8a49d4e42c4b782a4b3a22aa79f6: 8294594: Fix cast-function-type warnings in signal handling code
  • 71aa8210910dbafe30eccc772eaa7747f46be0cd: 8295176: some langtools test pollutes source tree
  • bca7ab3c1109e6cff9b50ecdd3045cb0ae8f6953: 8295412: support latest VS2022 MSC_VER in abstract_vm_version.cpp
  • c33ca0c5edd60454c58916cb588e5b2cfcc7b36a: 6229853: BasicTextAreaUI:create incompletely documents the possible returned View types
  • 358ac07255cc640cbcb9b0df5302d97891a34087: 8294254: [macOS] javax/swing/plaf/aqua/CustomComboBoxFocusTest.java failure
  • 490fcd0c2547cb4e564363f0cd121c777c3acc02: 8293833: Error mixing types with -XX:+UseCMoveUnconditionally -XX:+UseVectorCmov
  • 529cc48f355523fd162470b416a5081869adcf0e: 8295396: RISC-V: Cleanup useless CompressibleRegions
  • 692cdab2be7dfc6e12b127f8e2c97bc41536cb84: 8295016: Make the arraycopy_epilogue signature consistent with its usage
  • ... and 52 more: https://git.openjdk.org/jdk/compare/6ae7e4d4aad5712cf2fe6ab9f98dc424fa4170cb...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Oct 18 '22 09:10 openjdk[bot]

@RealFYang @luhenry Pushed as commit 4434cbb719db37880b48474ba342f300ed4828a8.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Oct 18 '22 09:10 openjdk[bot]

Hi @RealFYang @luhenry, do you think it is necessary to back-port this commit to jdk19u branch? Thanks!

XieJiSS avatar Nov 22 '22 04:11 XieJiSS

Hi @RealFYang @luhenry, do you think it is necessary to back-port this commit to jdk19u branch? Thanks!

@XieJiSS : Are you using jdk19u and affected by this issue? AFAIK, this is also handled on the kernel's side.

RealFYang avatar Nov 23 '22 03:11 RealFYang

AFAIK, this is also handled on the kernel's side.

Yes, but my current kernel version is still affected. Will try to compile the newest kernel to see whether that works.

XieJiSS avatar Nov 23 '22 03:11 XieJiSS

It should be extremely safe to backport, and it explicits the default behavior to paper over a kernel bug. Let me request backport in JBS.

luhenry avatar Nov 23 '22 20:11 luhenry

/backport jdk19u-dev

luhenry avatar Nov 23 '22 20:11 luhenry

@luhenry The target repository jdk19u-dev is not a valid target for backports. List of valid target repositories: openjdk/jdk, openjdk/jdk11u, openjdk/jdk11u-dev, openjdk/jdk12u, openjdk/jdk13u, openjdk/jdk13u-dev, openjdk/jdk14u, openjdk/jdk15u, openjdk/jdk15u-dev, openjdk/jdk16u, openjdk/jdk17u, openjdk/jdk17u-dev, openjdk/jdk18u, openjdk/jdk19, openjdk/jdk19u, openjdk/jdk7u, openjdk/jdk8u, openjdk/jdk8u-dev, openjdk/shenandoah-jdk8u, openjdk/shenandoah-jdk8u-dev. Supplying the organization/group prefix is optional.

openjdk[bot] avatar Nov 23 '22 20:11 openjdk[bot]

/backport openjdk/jdk19u

luhenry avatar Nov 23 '22 20:11 luhenry

@luhenry the backport was successfully created on the branch luhenry-backport-4434cbb7 in my personal fork of openjdk/jdk19u. To create a pull request with this backport targeting openjdk/jdk19u:master, just click the following link:

:arrow_right: Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 4434cbb7 from the openjdk/jdk repository.

The commit being backported was authored by Ludovic Henry on 18 Oct 2022 and was reviewed by Yadong Wang and Fei Yang.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk19u:

$ git fetch https://github.com/openjdk-bots/jdk19u luhenry-backport-4434cbb7:luhenry-backport-4434cbb7
$ git checkout luhenry-backport-4434cbb7
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk19u luhenry-backport-4434cbb7

openjdk[bot] avatar Nov 23 '22 20:11 openjdk[bot]