Skip to content

Remove _magic_ constant J9_FFI_DOWNCALL_HEAP_ARGUMENT_ID #19005

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
keithc-ca opened this issue Feb 23, 2024 · 2 comments · Fixed by #19649
Closed

Remove _magic_ constant J9_FFI_DOWNCALL_HEAP_ARGUMENT_ID #19005

keithc-ca opened this issue Feb 23, 2024 · 2 comments · Fixed by #19649
Assignees
Labels
comp:vm jdk22 jdk23 project:panama Used to track Project Panama related work

Comments

@keithc-ca
Copy link
Contributor

J9_FFI_DOWNCALL_HEAP_ARGUMENT_ID was originally 0x1, but changed to 0xFFFFFFFFFFFFFFFF in #19002. No matter what value is chosen, it's possible it conflicts with application intent. As I suggested, I think we should use an out-of-band channel to distinguish parameters that should point within the heap from other parameters.

@keithc-ca
Copy link
Contributor Author

FYI @ChengJin01.

@ChengJin01
Copy link

ChengJin01 commented Jun 4, 2024

Instead of relying on J9_FFI_DOWNCALL_HEAP_ARGUMENT_ID which might cause conflict with the malicious address imposed by users, I think the problem can be resolved by checking the existence of heapBase in which case heapBase is set to null in terms of a native array (a non-null heapBase object denotes a heap array). I will create a patch with the solution to see whether it works good as expected.

ChengJin01 pushed a commit to ChengJin01/openj9 that referenced this issue Jun 7, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
The changes aim to avoid the conflicts of the native address
imposed by users by check the existence of the heap base to
determine whether a heap array rather than a native array
is passed down to native.

Fixes: eclipse-openj9#19005

Signed-off-by: ChengJin01 <jincheng@ca.ibm.com>
@ChengJin01 ChengJin01 self-assigned this Jun 7, 2024
@ChengJin01 ChengJin01 added jdk22 jdk23 comp:vm project:panama Used to track Project Panama related work labels Jun 7, 2024
ChengJin01 pushed a commit to ChengJin01/openj9 that referenced this issue Jun 7, 2024
The changes aim to avoid the conflicts of the native address
imposed by users by check the existence of the heap base to
determine whether a heap array rather than a native array
is passed down to native.

Fixes: eclipse-openj9#19005

Signed-off-by: ChengJin01 <jincheng@ca.ibm.com>
ChengJin01 pushed a commit to ChengJin01/openj9 that referenced this issue Jun 7, 2024
The changes aim to avoid the conflicts of the native address
imposed by users by check the existence of the heap base to
determine whether a heap array rather than a native array
is passed down to native.

Fixes: eclipse-openj9#19005

Signed-off-by: ChengJin01 <jincheng@ca.ibm.com>
ChengJin01 pushed a commit to ChengJin01/openj9 that referenced this issue Jun 7, 2024
The changes aim to avoid the conflicts of the native address
imposed by users by check the existence of the heap base to
determine whether a heap array rather than a native array
is passed down to native.

Fixes: eclipse-openj9#19005

Signed-off-by: ChengJin01 <jincheng@ca.ibm.com>
ChengJin01 pushed a commit to ChengJin01/openj9 that referenced this issue Jun 7, 2024
The changes aim to avoid the conflicts of the native address
imposed by users by check the existence of the heap base to
determine whether a heap array rather than a native array
is passed down to native.

Fixes: eclipse-openj9#19005

Signed-off-by: ChengJin01 <jincheng@ca.ibm.com>
ChengJin01 pushed a commit to ChengJin01/openj9 that referenced this issue Jun 11, 2024
The changes aim to avoid the conflicts of the native address
imposed by users by check the existence of the heap base to
determine whether a heap array rather than a native array
is passed down to native.

Fixes: eclipse-openj9#19005

Signed-off-by: ChengJin01 <jincheng@ca.ibm.com>
ChengJin01 pushed a commit to ChengJin01/openj9 that referenced this issue Jun 11, 2024
The changes aim to avoid the conflicts of the native address
imposed by users by check the existence of the heap base to
determine whether a heap array rather than a native array
is passed down to native.

Fixes: eclipse-openj9#19005

Signed-off-by: ChengJin01 <jincheng@ca.ibm.com>
ChengJin01 pushed a commit to ChengJin01/openj9 that referenced this issue Jun 11, 2024
The changes aim to avoid the conflicts of the native address
imposed by users by check the existence of the heap base to
determine whether a heap array rather than a native array
is passed down to native.

Fixes: eclipse-openj9#19005

Signed-off-by: ChengJin01 <jincheng@ca.ibm.com>
pshipton pushed a commit to pshipton/openj9 that referenced this issue Jul 24, 2024
The changes aim to avoid the conflicts of the native address
imposed by users by check the existence of the heap base to
determine whether a heap array rather than a native array
is passed down to native.

Fixes: eclipse-openj9#19005

Signed-off-by: ChengJin01 <jincheng@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:vm jdk22 jdk23 project:panama Used to track Project Panama related work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants