-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
JDK-8320005 : Allow loading of shared objects with .a extension on AIX #16604
Conversation
👋 Welcome back suchismith1993! A progress list of the required criteria for merging this PR into |
@suchismith1993 The following labels will be automatically applied to this pull request:
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. |
def0e2f
to
58f14cc
Compare
dd0bf17
to
530c45c
Compare
@suchismith1993 This pull request has not yet been marked as ready for integration. |
530c45c
to
d8ea63e
Compare
Webrevs
|
Hi, is this patch meant for review already? If yes, could you please describe the problem you fix, and how you fix it? If no, I suggest working on it in draft state till its ready for review. |
I have updated the description. Let me know if anything is missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some nits you might want to consider.
src/hotspot/os/aix/os_aix.cpp
Outdated
//Replaces provided path with alternate path for the given file,if it doesnt exist. | ||
//For AIX,this replaces .so with .a. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Replaces provided path with alternate path for the given file,if it doesnt exist. | |
//For AIX,this replaces .so with .a. | |
// Replaces the specified path with an alternative path for the given file if the original path doesn't exist. | |
// For AIX, this replaces extension from ".so" to ".a". |
src/hotspot/os/aix/os_aix.cpp
Outdated
|
||
//Replaces provided path with alternate path for the given file,if it doesnt exist. | ||
//For AIX,this replaces .so with .a. | ||
void os::Aix::mapAlternateName(char* buffer, const char *extension) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void os::Aix::mapAlternateName(char* buffer, const char *extension) { | |
void os::Aix::map_alternate_name(char* buffer, const char *extension) { |
src/hotspot/os/aix/os_aix.hpp
Outdated
// Provide alternate path name,if file does not exist. | ||
static void mapAlternateName(char* buffer, const char *extension); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Provide alternate path name,if file does not exist. | |
static void mapAlternateName(char* buffer, const char *extension); | |
// Provides alternate path name, if file does not exist. | |
static void map_alternate_name(char* buffer, const char *extension); |
Also are you planning to close this one : #16490 ? JBS issue is already closed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of comments.
First, if you always want to look for libfoo.a
if you can't find libfoo.so
then maybe that should be handled as the os::dll_load
level? Otherwisae it is not clear why this is something you only do for agents. ?/
Second, the amount of AIX-specific code in the shared jvmtiAgent.cpp
now seems unreasonable. As I think @tstuefe mentioned in another PR perhaps it is time to find better abstractions here to hide all these AIX specific quirks?
src/hotspot/os/aix/os_aix.cpp
Outdated
end = end - 1; | ||
} | ||
buffer[end] = '\0'; | ||
strcat(buffer, extension); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point you need to check the length of extension won't overflow buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of this approach. We accumulate more and more "#ifdef AIX" in shared code because of many recent AIX additions. No other platform has such a large ifdef footprint in shared code.
I argue that all of this should be handled inside os_aix.cpp and not leak out into the external space:
If .a is a valid shared object format on AIX, this should be handled in os::dll_load()
, and be done for all shared objects. If not, why do we try to load a static archive via dlload in this case but not in other cases?
If this is needed in shared code, the string replacement function should be a generic utility function for all platforms, and it should be tested with a small gtest. A gtest would have likely uncovered the buffer overflow too.
src/hotspot/os/aix/os_aix.cpp
Outdated
unsigned long end = strlen(buffer); | ||
while (end > 0 && buffer[end] != '.') { | ||
end = end - 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use strrchr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls handle the case where the string contains no dot.
src/hotspot/os/aix/os_aix.cpp
Outdated
} | ||
buffer[end] = '\0'; | ||
strcat(buffer, extension); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a buffer overrun waiting to happen if replacement is larger than original extension.
The JBS issue with respect to that has been closed. Need to check if that PR is required. Currently putting it on hold. |
This response on the issue suggest otherwise:
|
In AIX, we have shared objects with .a extension and also static archives with .a extension.I think in other platforms the format for shared objects is fixed? . In that case does this become specific to AIX? |
@suchismith1993 |
src/hotspot/os/aix/os_aix.cpp
Outdated
// Shared object in .so format dont have braces, hence they get removed for archives with members. | ||
if (result == nullptr && pointer_to_dot != nullptr && strcmp(pointer_to_dot, old_extension) == 0) { | ||
snprintf(pointer_to_dot, sizeof(old_extension), "%s", new_extension); | ||
result = dll_load_library(file_path, ebuf, ebuflen); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should have adapted the indentation, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which indentation ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh! to reduce the spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheRealMDoerr adapted
/integrate |
@suchismith1993 |
/sponsor |
Going to push as commit e85355a.
Your commit was automatically rebased without conflicts. |
@TheRealMDoerr @suchismith1993 Pushed as commit e85355a. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
/backport jdk21u |
@suchismith1993 the backport was successfully created on the branch backport-suchismith1993-e85355ad in my personal fork of openjdk/jdk21u. To create a pull request with this backport targeting openjdk/jdk21u:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
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/jdk21u:
|
jdk21u is only open for critical backports and requires special approval. Please backport it to jdk21u-dev. |
@TheRealMDoerr FYI, |
/backport jdk22u |
@suchismith1993 the backport was successfully created on the branch backport-suchismith1993-e85355ad in my personal fork of openjdk/jdk22u. To create a pull request with this backport targeting openjdk/jdk22u:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
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/jdk22u:
|
/backport jdk21u-dev |
/backport jdk11u-dev |
/backport jdk17u-dev |
/backport jdk8u-dev |
@suchismith1993 the backport was successfully created on the branch backport-suchismith1993-e85355ad in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
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/jdk21u-dev:
|
@suchismith1993 Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk11u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk11u-dev with the title Below you can find a suggestion for the pull request body:
|
@suchismith1993 Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk17u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u-dev with the title Below you can find a suggestion for the pull request body:
|
@suchismith1993 Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk8u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk8u-dev with the title Below you can find a suggestion for the pull request body:
|
J2SE agent does not start and throws error when it tries to find the shared library ibm_16_am.
After searching for ibm_16_am.so ,the jvm agent throws and error as dll_load fails.It fails to identify the shared library ibm_16_am.a shared archive file on AIX.
Hence we are providing a function which will additionally search for .a file on AIX ,when the search for .so file fails.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16604/head:pull/16604
$ git checkout pull/16604
Update a local copy of the PR:
$ git checkout pull/16604
$ git pull https://git.openjdk.org/jdk.git pull/16604/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16604
View PR using the GUI difftool:
$ git pr show -t 16604
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16604.diff
Webrev
Link to Webrev Comment