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

fix illegal-access behaviour #22

Merged
merged 1 commit into from
Sep 15, 2017
Merged

Conversation

tajila
Copy link
Contributor

@tajila tajila commented Sep 14, 2017

fix illegal-access behaviour

This is the first set of changes to address illegal-access behaviour.

The illegal-access (--illegal-access=[permit|debug|warn]) option opens
all packages in the runtime image to unnamed modules if those package
existed in JDK8.

The previous implementation also provided add-reads access to all
modules which is incorrect. The 'if that package existed in JDK8' part
will be addressed in a future PR.

The default behaviour in JDK9 is '--illegal-access=permit'. In order to
turn this off one must supply '--illegal-access=deny', which will be the
default for Java10+ java releases.

Signed-off-by: tajila atobia@ca.ibm.com

Reviewer: @pshipton

@DanHeidinga
Copy link
Member

@tajila Have you filled out an ECA as mentioned in https://github.com/eclipse/openj9/blob/master/CONTRIBUTING.md? Was the ECA filed with this tobi_ajila@ca.ibm.com email address (and exactly that capitalization, etc)? My understanding is the ip-validation is very pedantic with regards to the sign-off email being an exact match.

@DanHeidinga
Copy link
Member

Not to nitpick but the commit comment references an IBM-internal bug number. Can you remove the Task [134868] reference and provide the information directly in the commit comment or in an issue linked to this PR? Thanks

@@ -267,6 +267,10 @@ isPackageExportedToModuleHelper(J9VMThread *currentThread, J9Module *fromModule,
*/
isExported = (*targetPtr == toModule);
}
} else if (J9_ARE_NO_BITS_SET(vm->runtimeFlags, J9_RUNTIME_DENY_ILLEGAL_ACCESS)) {
/* in Java9 --illegal-access=permit is turned on by default. This opens
* each package to all-unnamed modules unless illegal-access=deny is specified */
Copy link
Member

Choose a reason for hiding this comment

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

This looks right with the minor nitpick of moving the end of comment delimiter to its own line.

@@ -64,7 +64,6 @@ checkVisibility(J9VMThread *currentThread, J9Class* sourceClass, J9Class* destCl
&& (J2SE_VERSION(vm) >= J2SE_19)
&& J9_ARE_ALL_BITS_SET(vm->runtimeFlags, J9_RUNTIME_JAVA_BASE_MODULE_CREATED)
&& !J9ROMCLASS_IS_PRIMITIVE_TYPE(destClass->romClass)
&& J9_ARE_ALL_BITS_SET(vm->runtimeFlags, J9_RUNTIME_DENY_ILLEGAL_ACCESS)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I follow why this doesn't need to be checked as part of the visibility check. Can you elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is still being checked as part of the visibility check but just at a later stage. We check it further down when isPackageExportedToModuleWithName(...) is called.

The --illegal-access=[permit|debug|warn] opens all packages to all unnamed modules. So it is similar to add-exports but allows deeper reflection. The 'deeper reflection' part is handled by the JCL but we still have to make those packages visible in the vm.

@tajila tajila force-pushed the illegal branch 2 times, most recently from 48a35c2 to 40124bd Compare September 15, 2017 13:33
@tajila
Copy link
Contributor Author

tajila commented Sep 15, 2017

My mistake with the commit message, I forgot to change it when I migrated the PR.

Copy link
Member

@DanHeidinga DanHeidinga left a comment

Choose a reason for hiding this comment

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

Changes look good. Can you update the commit message to include some reference to the option being used - --illegal-access=[permit|debug|warn] so we'll know which option in the future?

@DanHeidinga DanHeidinga self-assigned this Sep 15, 2017
@DanHeidinga
Copy link
Member

@tajila Please post a comment when the commit message is updated (or indicate if you don't plan to) and then we can get this merged

@tajila tajila force-pushed the illegal branch 2 times, most recently from c822497 to 4a0326f Compare September 15, 2017 14:16
This is the first set of changes to address illegal-access behaviour.

The illegal-access (--illegal-access=[permit|debug|warn]) option opens
all packages in the runtime image to unnamed modules if those package
existed in JDK8. 

The previous implementation also provided add-reads access to all
modules which is incorrect. The 'if that package existed in JDK8' part
will be addressed in a future PR.

The default behaviour in JDK9 is '--illegal-access=permit'. In order to
turn this off one must supply '--illegal-access=deny', which will be the
default for Java10+ java releases.


Signed-off-by: tajila <atobia@ca.ibm.com>
@tajila
Copy link
Contributor Author

tajila commented Sep 15, 2017

@DanHeidinga I fixed the commit message. I also added more info regarding what I will do next.

@DanHeidinga
Copy link
Member

Looks good @tajila! Thanks for your help to get this landed.

@DanHeidinga DanHeidinga merged commit ead54ef into eclipse-openj9:master Sep 15, 2017
tajila pushed a commit to tajila/openj9 that referenced this pull request Jul 11, 2019
* added register class path entries

Signed-off-by: Vinoshan Tharmalenkam <Vinoshan.Tharmalenkam@ibm.com>
hzongaro pushed a commit to hzongaro/openj9 that referenced this pull request Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants