jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8342682: Errors related to unused code on Windows after 8339120 in dt_shmem jdwp security and jpackage

Open TheShermanTanker opened this issue 1 year ago • 9 comments

After 8339120, gcc began catching many different instances of unused code in the Windows specific codebase. Some of these seem to be bugs. I've taken the effort to mark out all the relevant globals and locals that trigger the unused warnings and addressed all of them by commenting out the code as appropriate. I am confident that in many cases this simplistic approach of commenting out code does not fix the underlying issue, and the warning actually found a bug that should be fixed. In these instances, I will be aiming to fix these bugs with help from reviewers, so I recommend anyone reviewing who knows more about the code than I do to see whether there is indeed a bug that needs fixing in a different way than what I did


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

  • JDK-8342682: Errors related to unused code on Windows after 8339120 in dt_shmem jdwp security and jpackage (Bug - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21616

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

Using diff file

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

Webrev

Link to Webrev Comment

TheShermanTanker avatar Oct 21 '24 14:10 TheShermanTanker

:wave: Welcome back jwaters! 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 21 '24 14:10 bridgekeeper[bot]

@TheShermanTanker 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:

8342682: Errors related to unused code on Windows after 8339120 in dt_shmem jdwp security and jpackage

Reviewed-by: cjplummer, asemenyuk, almatvee

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 3443 new commits pushed to the master branch:

  • f153e415d740f4ede272929171e9bb3e73ddbe1c: 8361253: CommandLineOptionTest library should report observed values on failure
  • fba74f796eeeb42accc60ecab444c3d933b73e70: 8361306: jdk.compiler-gendata needs to depend on java.base-launchers
  • 56ebb8c1b936e5a4c14486153c9f60df705095ad: 8359110: Log accumulated GC and process CPU time upon VM exit
  • ... and 3440 more: https://git.openjdk.org/jdk/compare/5ca6698ba418e82ff93471fbb495759850f26f63...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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

openjdk[bot] avatar Oct 21 '24 14:10 openjdk[bot]

@TheShermanTanker The following labels will be automatically applied to this pull request:

  • build
  • client
  • core-libs
  • i18n
  • net
  • security
  • serviceability

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

openjdk[bot] avatar Oct 21 '24 14:10 openjdk[bot]

and whatever team is responsible for HotSpot debugging.

I don't see anything hotspot related here.

I think you would be better off splitting this up into distinct issues and PRs for different areas. I expect the client team in particular would prefer that.

dholmes-ora avatar Oct 22 '24 01:10 dholmes-ora

and whatever team is responsible for HotSpot debugging.

I don't see anything hotspot related here.

I think you would be better off splitting this up into distinct issues and PRs for different areas. I expect the client team in particular would prefer that.

Aren't the dt_shmem and jdwp changes related to HotSpot? But I guess I'll split it up in that case, I thought it might have been quicker to group it all together in one shot. This particular Pull Request I'll probably reserve for jdwp and the like, core-libs and client (And everything else) I'll move to their own PRs

TheShermanTanker avatar Oct 22 '24 01:10 TheShermanTanker

Aren't the dt_shmem and jdwp changes related to HotSpot?

Nope. That's core-svc - the non-hotspot side of serviceability. :)

dholmes-ora avatar Oct 22 '24 09:10 dholmes-ora

Aren't the dt_shmem and jdwp changes related to HotSpot?

Nope. That's core-svc - the non-hotspot side of serviceability. :)

Oh, well I guess you learn something new everyday :)

TheShermanTanker avatar Oct 22 '24 11:10 TheShermanTanker

The security.cpp looks fine to me. Thanks.

wangweij avatar Oct 23 '24 16:10 wangweij

Thanks Weijun for the ok on security (Though it still makes me uneasy because it smells like a bug, but I guess it's alright). I haven't pushed yet to remove the changes to the other files in this Pull Request because the way I did it I'd have to force push and that would destroy all the review comments, I'll do that once the comments have been fully addressed

TheShermanTanker avatar Oct 24 '24 03:10 TheShermanTanker

the way I did it I'd have to force push

That should not be the case. You can just anti-delta changes.

dholmes-ora avatar Oct 24 '24 07:10 dholmes-ora

@TheShermanTanker Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information.

openjdk[bot] avatar Oct 24 '24 14:10 openjdk[bot]

the way I did it I'd have to force push

That should not be the case. You can just anti-delta changes.

I did it in a really inefficient way, by checking out all files except for the files that I wanted to stay. I could not figure out how to undo it. In any case, I'm sorry for the sin I just committed...

TheShermanTanker avatar Oct 24 '24 14:10 TheShermanTanker

All the original labels are still there. A better approach had probably been to close the PR and open a new. You either need to do that now, or delete all the irrelevant labels. (I can't be bothered to figure out; at least build is wrong.)

/label -build

magicus avatar Oct 24 '24 22:10 magicus

@magicus The build label was successfully removed.

openjdk[bot] avatar Oct 24 '24 23:10 openjdk[bot]

/label -client /label -net

TheShermanTanker avatar Oct 25 '24 04:10 TheShermanTanker

@TheShermanTanker The client label was successfully removed.

openjdk[bot] avatar Oct 25 '24 04:10 openjdk[bot]

@TheShermanTanker The net label was successfully removed.

openjdk[bot] avatar Oct 25 '24 04:10 openjdk[bot]

I don't know what label jpackage falls under /label -core-libs /label -i18n

TheShermanTanker avatar Oct 25 '24 07:10 TheShermanTanker

@TheShermanTanker The core-libs label was successfully removed.

openjdk[bot] avatar Oct 25 '24 07:10 openjdk[bot]

@TheShermanTanker The i18n label was successfully removed.

openjdk[bot] avatar Oct 25 '24 07:10 openjdk[bot]

Turns out jpackage is part of core libs /label core-libs

TheShermanTanker avatar Oct 26 '24 04:10 TheShermanTanker

@TheShermanTanker The core-libs label was successfully added.

openjdk[bot] avatar Oct 26 '24 04:10 openjdk[bot]

I do wonder if mutex support can be implemented for Windows with Acquire/ReleaseSRWLockExclusive. I know it's not strictly needed, but it would be nice to have. Shame threads.h is not available with some Visual Studio versions we support, or at all with gcc. mtx_lock/unlock would be a nice solution to this problem

TheShermanTanker avatar Oct 26 '24 04:10 TheShermanTanker

Bumping

TheShermanTanker avatar Oct 30 '24 05:10 TheShermanTanker

I do wonder if mutex support can be implemented for Windows with Acquire/ReleaseSRWLockExclusive. I know it's not strictly needed, but it would be nice to have. Shame threads.h is not available with some Visual Studio versions we support, or at all with gcc. mtx_lock/unlock would be a nice solution to this problem

I'll also start looking into this in the meantime, unless you explicitly want me not to do so

TheShermanTanker avatar Oct 31 '24 07:10 TheShermanTanker

Also, core-libs, any comment on jpackage?

TheShermanTanker avatar Oct 31 '24 07:10 TheShermanTanker

I do wonder if mutex support can be implemented for Windows with Acquire/ReleaseSRWLockExclusive. I know it's not strictly needed, but it would be nice to have. Shame threads.h is not available with some Visual Studio versions we support, or at all with gcc. mtx_lock/unlock would be a nice solution to this problem

I'll also start looking into this in the meantime, unless you explicitly want me not to do so

Feel free to if you'd like to. Personally I don't consider it to be that important.

plummercj avatar Oct 31 '24 19:10 plummercj

I do wonder if mutex support can be implemented for Windows with Acquire/ReleaseSRWLockExclusive.

A CriticalSection is a mutex. A RWLock is not a "mutex".

dholmes-ora avatar Nov 01 '24 04:11 dholmes-ora

I guess Weijun's comment means security is good to go, even though it's not an approval. jpackage, any comments?

TheShermanTanker avatar Nov 01 '24 05:11 TheShermanTanker