-
Notifications
You must be signed in to change notification settings - Fork 6.3k
8365588: defineClass that accepts a ByteBuffer does not work as expected #27569
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back sherman! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@xuemingshen-oracle The following label 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 list. If you would like to change these labels, use the /label pull request command. |
test/jdk/java/lang/ClassLoader/defineClass/DefineClassDirectByteBuffer.java
Outdated
Show resolved
Hide resolved
test/jdk/java/lang/ClassLoader/defineClass/DefineClassDirectByteBuffer.java
Outdated
Show resolved
Hide resolved
Webrevs
|
// make copy from input byte buffer | ||
try (var arena = Arena.ofConfined()) { | ||
ByteBuffer bb = arena.allocate(len).asByteBuffer(); | ||
bb.put(0, b, b.position(), len); |
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.
Do we need to acquire/release session on the base buffer too?
cb29482
to
c7cb474
Compare
@xuemingshen-oracle Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
Background
Problem
Solution
This approach ensures the integrity of class bytes processes for untrusted or custom class loaders while minimizing performance impact for trusted or built-in loaders.
Benchmark
A JMH benchmark has been added to measure the potential cost of the defensive copy. The results indicate that the performance impact is minimal and largely insignificant.
Before:
After:
Startup
./brr -b Startup-SwingSet,Startup3-Framer,Startup3-JettyStartup3-Noop -i 5 -j /Users/xuemingshen/jdk26
./brr compare xueming.shen.Base xueming.shen.JDK-8365588
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27569/head:pull/27569
$ git checkout pull/27569
Update a local copy of the PR:
$ git checkout pull/27569
$ git pull https://git.openjdk.org/jdk.git pull/27569/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27569
View PR using the GUI difftool:
$ git pr show -t 27569
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27569.diff
Using Webrev
Link to Webrev Comment