[foreign-memaccess+abi] RFR: 8294309: Downcall and Upcall unboxing code should reject heap segments [v2]

Jorn Vernee jvernee at openjdk.org
Tue Oct 4 12:47:07 UTC 2022


> Recently I noticed that we don't check for heap segments anymore when unboxing memory segments to be passed to native code as addresses. This allows someone to pass a heap segment, which will be unboxed simply by calling `MemorySegment::address` which for heap segments returns the byte offset into the array. This is of course not a valid pointer.
> 
> This patch changes the unboxing logic to reject heap segments with an `IllegalArgumentException`.

Jorn Vernee has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains two new commits since the last revision:

 - use isNative
 - reject heap segments passed as addresses

-------------

Changes:
  - all: https://git.openjdk.org/panama-foreign/pull/737/files
  - new: https://git.openjdk.org/panama-foreign/pull/737/files/06118ea2..acc6c805

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=panama-foreign&pr=737&range=01
 - incr: https://webrevs.openjdk.org/?repo=panama-foreign&pr=737&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/panama-foreign/pull/737.diff
  Fetch: git fetch https://git.openjdk.org/panama-foreign pull/737/head:pull/737

PR: https://git.openjdk.org/panama-foreign/pull/737


More information about the panama-dev mailing list