Skip to content

8267908: linux: thread_native_entry can scribble on stack frame #4407

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

Closed
wants to merge 1 commit into from

Conversation

dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Jun 8, 2021

Please review this trivial fix to ensure we do not try to alloca zero bytes.

Thanks,
David


Progress

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

Issue

  • JDK-8267908: linux: thread_native_entry can scribble on stack frame

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4407/head:pull/4407
$ git checkout pull/4407

Update a local copy of the PR:
$ git checkout pull/4407
$ git pull https://git.openjdk.java.net/jdk pull/4407/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4407

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4407.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 8, 2021

👋 Welcome back dholmes! 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 Jun 8, 2021

@dholmes-ora Syntax: /reviewer (credit|remove) [@user | openjdk-user]+. For example:

  • /reviewer credit @openjdk-bot
  • /reviewer credit duke
  • /reviewer credit @user1 @user2

@openjdk
Copy link

openjdk bot commented Jun 8, 2021

@dholmes-ora 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 Jun 8, 2021
@dholmes-ora dholmes-ora marked this pull request as ready for review June 8, 2021 02:10
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 8, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 8, 2021

Webrevs

@dholmes-ora
Copy link
Member Author

To test this I flipped the ifndef GLIBC to ifdef GLIBC.

Copy link
Member

@YaSuenag YaSuenag 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!

@openjdk
Copy link

openjdk bot commented Jun 8, 2021

@dholmes-ora 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:

8267908: linux: thread_native_entry can scribble on stack frame

Reviewed-by: ysuenaga

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

  • ae986bc: 8266749: AArch64: Backtracing broken on PAC enabled systems
  • 36c4e5f: 8267187: Remove deprecated constructor for Log

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 Jun 8, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 8, 2021

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

On 8/06/2021 1:11 pm, Yasumasa Suenaga wrote:

On Tue, 8 Jun 2021 02:02:55 GMT, David Holmes <dholmes at openjdk.org> wrote:

Please review this trivial fix to ensure we do not try to alloca zero bytes.

Thanks,
David

Looks good!

Thanks Yasumasa!

David

@dholmes-ora
Copy link
Member Author

/integrate

@openjdk openjdk bot closed this Jun 8, 2021
@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 Jun 8, 2021
@openjdk
Copy link

openjdk bot commented Jun 8, 2021

@dholmes-ora Since your change was applied there have been 3 commits pushed to the master branch:

  • f40c89e: 8267209: Child threads should defer logging to after child-parent handshake
  • ae986bc: 8266749: AArch64: Backtracing broken on PAC enabled systems
  • 36c4e5f: 8267187: Remove deprecated constructor for Log

Your commit was automatically rebased without conflicts.

Pushed as commit 341f676.

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

@dholmes-ora dholmes-ora deleted the 8267908 branch June 8, 2021 04:56
@navyxliu
Copy link
Member

navyxliu commented Jun 8, 2021

When random is 1, that store is still safe because c++ std says sizeof char is 1.

@mlbridge
Copy link

mlbridge bot commented Jun 8, 2021

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

On 8/06/2021 3:59 pm, Xin Liu wrote:

On Tue, 8 Jun 2021 02:02:55 GMT, David Holmes <dholmes at openjdk.org> wrote:

Please review this trivial fix to ensure we do not try to alloca zero bytes.

Thanks,
David

When random is 1, that store is still safe because c++ std says sizeof char is 1.

The issue was random being zero.

Cheers,
David

1 similar comment
@mlbridge
Copy link

mlbridge bot commented Jun 8, 2021

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

On 8/06/2021 3:59 pm, Xin Liu wrote:

On Tue, 8 Jun 2021 02:02:55 GMT, David Holmes <dholmes at openjdk.org> wrote:

Please review this trivial fix to ensure we do not try to alloca zero bytes.

Thanks,
David

When random is 1, that store is still safe because c++ std says sizeof char is 1.

The issue was random being zero.

Cheers,
David

@navyxliu
Copy link
Member

navyxliu commented Jun 8, 2021

I know. you patch LGTM. that is a side note.

I was worried about this statement was not portable if random is 1.
*(char *)stackmem = 1;

C++ std 6.5.3.4 says:

When sizeof is applied  to  an  operand  that  has  type char, unsigned  char, or signed  char,  (or  a qualified  version  thereof)  the  result  is  1.

Therefore, it's portable.

@mlbridge
Copy link

mlbridge bot commented Jun 8, 2021

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

On 8/06/2021 4:32 pm, Xin Liu wrote:

On Tue, 8 Jun 2021 02:02:55 GMT, David Holmes <dholmes at openjdk.org> wrote:

Please review this trivial fix to ensure we do not try to alloca zero bytes.

Thanks,
David

I know. you patch LGTM. that is a side note.

I was worried about this statement was not portable if random is 1.
`*(char *)stackmem = 1;`

C++ std 6.5.3.4 says:

When sizeof is applied to an operand that has type char, unsigned char, or signed char, (or a qualified version thereof) the result is 1.

Therefore, it's portable.

Yes it is portable - that was never in question. :)

David

1 similar comment
@mlbridge
Copy link

mlbridge bot commented Jun 8, 2021

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

On 8/06/2021 4:32 pm, Xin Liu wrote:

On Tue, 8 Jun 2021 02:02:55 GMT, David Holmes <dholmes at openjdk.org> wrote:

Please review this trivial fix to ensure we do not try to alloca zero bytes.

Thanks,
David

I know. you patch LGTM. that is a side note.

I was worried about this statement was not portable if random is 1.
`*(char *)stackmem = 1;`

C++ std 6.5.3.4 says:

When sizeof is applied to an operand that has type char, unsigned char, or signed char, (or a qualified version thereof) the result is 1.

Therefore, it's portable.

Yes it is portable - that was never in question. :)

David

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
Development

Successfully merging this pull request may close these issues.

3 participants