Skip to content

Conversation

@MBaesken
Copy link
Member

@MBaesken MBaesken commented Nov 14, 2025

In the review of JDK-8333522 it has been discussed that we might run into issues because of failing sysinfo.
However we miss checking the return values at some places, this might need adjustment.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28317

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 14, 2025

👋 Welcome back mbaesken! 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 Nov 14, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title JDK-8333871: check sysinfo return values 8333871: check sysinfo return values Nov 14, 2025
@openjdk openjdk bot added hotspot-runtime hotspot-runtime-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Nov 14, 2025
@openjdk
Copy link

openjdk bot commented Nov 14, 2025

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

  • core-libs
  • hotspot-runtime

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 openjdk bot added the rfr Pull request is ready for review label Nov 14, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 14, 2025

Webrevs

if (ret == 0) {
sprops.cpu_isalist = strdup(list);
} else {
sprops.cpu_isalist = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind checking the code that puts this in a system property can tolerate NULL? I don't suppose sysinfo will fail here (unless you found a case?) but it would be good to confirm that it won't blow up somewhere else.

Copy link
Member Author

Choose a reason for hiding this comment

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

We do PUTPROP here

PUTPROP(propArray, _sun_cpu_isalist_NDX, sprops->cpu_isalist);

with 3rd parameter == NULL in this case.
PUTPROP checks for this so I do not see issues with this
#define PUTPROP(array, prop_index, val) \

@AlanBateman
Copy link
Contributor

/reviewers 2

@openjdk
Copy link

openjdk bot commented Nov 16, 2025

@AlanBateman
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

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

Thanks for checking that cpu_isalist == NULL is okay, the update to java_props_md.c looks okay to me.

@dholmes-ora
Copy link
Member

I think this is completely unnecessary - sysinfo on Linux can't really fail, the only error possible is EFAULT if you pass a bad pointer for the struct - so don't do that.

Replacing numbers with words in the logging could break external parsing scripts.

@MBaesken
Copy link
Member Author

I think this is completely unnecessary - sysinfo on Linux can't really fail, the only error possible is EFAULT if you pass a bad pointer for the struct - so don't do that.

Replacing numbers with words in the logging could break external parsing scripts.

Hi David , not sure how likely those failures are. Back then in the review of JDK-8333522 we discussed the checking might be needed and that's why the JBS issue was created.
Checking other projects for potential sysinfo failures it seems that the 'bad pointer' issue you referred to is indeed the most likely one.
But if it is really 'completely unnecessary' we should probably kick out the checks we do at a number of places in the codebase ?
https://github.com/search?q=repo%3Aopenjdk%2Fjdk+%22sysinfo%28%22&type=code

@MBaesken
Copy link
Member Author

If you search github, you find also a number of places where EPERM is checked after sysinfo, not sure if this is really happening these days on our platforms ?

@AlanBateman
Copy link
Contributor

If you search github, you find also a number of places where EPERM is checked after sysinfo, not sure if this is really happening these days on our platforms ?

seccomp comes up periodically where random syscalls fail with EPERM as they aren't permitted by the filter. I don't know if this is what you found in your search but the possibility of seccomp or interposer libraries creates the possibility of syscall failing, or failing with errors that aren't documented for the syscall.

@dholmes-ora
Copy link
Member

the possibility of seccomp or interposer libraries creates the possibility of syscall failing, or failing with errors that aren't documented for the syscall.

That certainly complicates things and could potentially invalidate any code where we check for the expected/specified set of errors. I grudgingly withdraw my objection.

Comment on lines 2454 to 2455
} else {
st->print_cr("OS uptime could not be retrieved.");
Copy link
Member

Choose a reason for hiding this comment

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

I think an assert would be preferable here. This code can't be parsed so I think it better not to inject it.

Comment on lines 2592 to 2594
} else {
st->print(", swap could not be determined");
}
Copy link
Member

Choose a reason for hiding this comment

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

Again probably better to assert and say nothing, or use 0 as a placeholder.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi David, I added asserts where you suggested.

@openjdk
Copy link

openjdk bot commented Nov 19, 2025

@MBaesken this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8333871
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Nov 19, 2025
@MBaesken MBaesken changed the title 8333871: check sysinfo return values 8333871: Check sysinfo return values Nov 19, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org hotspot-runtime hotspot-runtime-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

4 participants