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

8251438: Issues with our POSIX set_signal_handler() #1680

Closed
wants to merge 3 commits into from
Closed

8251438: Issues with our POSIX set_signal_handler() #1680

wants to merge 3 commits into from

Conversation

gerard-ziemski
Copy link

@gerard-ziemski gerard-ziemski commented Dec 7, 2020

This is a fix for a potential issue involving "The storage occupied by sa_handler and sa_sigaction may overlap, and a conforming application shall not use both simultaneously." https://pubs.opengroup.org/onlinepubs/009695399/functions/sigaction.html, when we in fact do assume different storages.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8251438: Issues with our POSIX set_signal_handler()

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/1680/head:pull/1680
$ git checkout pull/1680

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 7, 2020

👋 Welcome back gziemski! 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.

@openjdk
Copy link

openjdk bot commented Dec 7, 2020

@gerard-ziemski 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 openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Dec 7, 2020
@gerard-ziemski gerard-ziemski marked this pull request as ready for review December 7, 2020 21:51
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 7, 2020
@mlbridge
Copy link

mlbridge bot commented Dec 7, 2020

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Gerard,
Functionally this is fine. Stylistically I would have just done simply:

return (act.sa_flags & SA_SIGINFO) != 0 ? CAST_FROM_FN_PTR(address, act.sa_sigaction) : CAST_FROM_FN_PTR(address, act.sa_handler);

Thanks,
David

@openjdk
Copy link

openjdk bot commented Dec 10, 2020

@gerard-ziemski 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:

8251438: Issues with our POSIX set_signal_handler()

Reviewed-by: dholmes, stuefe

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

  • 8bf46c7: 8258438: build error in test/hotspot/gtest/runtime/test_os.cpp
  • 7977e38: 8254024: Enhance native libs for AWT and Swing to work with GraalVM Native Image
  • c37eabe: 8252148: vmError::controlled_crash should be #ifdef ASSERT and move tests to gtest
  • 2273f95: 8234930: Use MAP_JIT when allocating pages for code cache on macOS
  • da2415f: 8257457: Update --release 16 symbol information for JDK 16 build 28
  • 36e2097: 8255917: runtime/cds/SharedBaseAddress.java failed "assert(reserved_rgn != 0LL) failed: No reserved region"
  • d53ee62: 8255899: Allow uninstallation of jpackage exe bundles
  • 65756ab: 8257802: LogCompilation throws couldn't find bytecode on JDK 8 log
  • a372be4: 8258244: Shenandoah: Not expecting forwarded object in roots during mark after JDK-8240868
  • 568dc29: 8185734: [Windows] Structured Exception Catcher missing around gtest execution
  • ... and 120 more: https://git.openjdk.java.net/jdk/compare/bbc44f57c4714a49e72a09f0b9d05765d6b41e9b...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 openjdk bot added the ready Pull request is ready to be integrated label Dec 10, 2020
@gerard-ziemski
Copy link
Author

Hi Gerard,
Functionally this is fine. Stylistically I would have just done simply:

return (act.sa_flags & SA_SIGINFO) != 0 ? CAST_FROM_FN_PTR(address, act.sa_sigaction) : CAST_FROM_FN_PTR(address, act.sa_handler);

Thanks,
David

Thank you David for the review, but I need to pull it out of JDK16 and redo for JDK17. I think I need to withdraw and close it.

@gerard-ziemski
Copy link
Author

I was told that all I need to do is to wait till official JDK16->JDK17 switch over, and can use this PR for JDK17.

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Gerard,

I was confused about the patch. Its fine from a simplification standpoint - putting all those ? expressions into one place - but where were we relying on different storage?

Cheers, Thomas

src/hotspot/os/posix/signals_posix.cpp Outdated Show resolved Hide resolved
@mlbridge
Copy link

mlbridge bot commented Dec 11, 2020

Mailing list message from David Holmes on hotspot-runtime-dev:

Hi Thomas,

On 11/12/2020 5:22 pm, Thomas Stuefe wrote:

On Mon, 7 Dec 2020 21:45:57 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

This is a fix for a potential issue involving "The storage occupied by sa_handler and sa_sigaction may overlap, and a conforming application shall not use both simultaneously." https://pubs.opengroup.org/onlinepubs/009695399/functions/sigaction.html, when we in fact do assume different storages.

Hi Gerard,

I was confused about the patch. Its fine from a simplification standpoint - putting all those ? expressions into one place - but where were we relying on different storage?

We were reading both fields from the same structure without checking the
flag value:

void* oldhand = oldAct.sa_sigaction
? CAST_FROM_FN_PTR(void*, oldAct.sa_sigaction)
: CAST_FROM_FN_PTR(void*, oldAct.sa_handler);

Cheers,
David

@tstuefe
Copy link
Member

tstuefe commented Dec 11, 2020

Mailing list message from David Holmes on hotspot-runtime-dev:

Hi Thomas,

On 11/12/2020 5:22 pm, Thomas Stuefe wrote:

On Mon, 7 Dec 2020 21:45:57 GMT, Gerard Ziemski wrote:

This is a fix for a potential issue involving "The storage occupied by sa_handler and sa_sigaction may overlap, and a conforming application shall not use both simultaneously." https://pubs.opengroup.org/onlinepubs/009695399/functions/sigaction.html, when we in fact do assume different storages.

Hi Gerard,
I was confused about the patch. Its fine from a simplification standpoint - putting all those ? expressions into one place - but where were we relying on different storage?

We were reading both fields from the same structure without checking the
flag value:

void* oldhand = oldAct.sa_sigaction
? CAST_FROM_FN_PTR(void*, oldAct.sa_sigaction)
: CAST_FROM_FN_PTR(void*, oldAct.sa_handler);

Cheers,
David

Ah, I missed that. Thanks!

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now!

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Thanks,
David

@gerard-ziemski
Copy link
Author

/integrate

@openjdk openjdk bot closed this Dec 16, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Dec 16, 2020
@openjdk
Copy link

openjdk bot commented Dec 16, 2020

@gerard-ziemski Since your change was applied there have been 138 commits pushed to the master branch:

  • 6eca296: 8258420: Move URL configuration from Docs.gmk to conf dir
  • 3c66485: 8257906: JFR: RecordingStream leaks memory
  • 0c8cc2c: 8258058: improve description of OutOfMemoryError relevant flags
  • cdb5342: 8258252: Move PtrQueue enqueue to PtrQueueSet subclasses
  • 17ace83: 8258074: Move some flags related to compiler to compiler_globals.hpp
  • 47ba652: 8258455: problem list tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java
  • 1e77896: 8236225: Remove expired flags in JDK 17
  • 4d6f318: 8257726: Make -XX:+StressLdcRewrite option a diagnostic option
  • 8bf46c7: 8258438: build error in test/hotspot/gtest/runtime/test_os.cpp
  • 7977e38: 8254024: Enhance native libs for AWT and Swing to work with GraalVM Native Image
  • ... and 128 more: https://git.openjdk.java.net/jdk/compare/bbc44f57c4714a49e72a09f0b9d05765d6b41e9b...master

Your commit was automatically rebased without conflicts.

Pushed as commit 70183f4.

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

@gerard-ziemski
Copy link
Author

Thank you David and Thomas for the reviews!

@gerard-ziemski gerard-ziemski deleted the JDK-8251438 branch February 17, 2021 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
3 participants