[jdk22] Integrated: 8324858: [vectorapi] Bounds checking issues when accessing memory segments

2024-02-07 Thread Paul Sandoz
On Tue, 6 Feb 2024 16:50:10 GMT, Paul Sandoz  wrote:

> This pull request contains a backport of commit 
> [1ae85138](https://github.com/openjdk/jdk/commit/1ae851387f881263ccc6aeace5afdd0f49d41d33)
>  from the [openjdk/jdk](https://git.openjdk.org/jdk) repository.
> 
> The commit being backported was authored by Paul Sandoz on 2 Feb 2024 and was 
> reviewed by Maurizio Cimadamore and Jatin Bhateja.

This pull request has now been integrated.

Changeset: 9cc260d3
Author:Paul Sandoz 
URL:   
https://git.openjdk.org/jdk22/commit/9cc260d3a10a4d31a2ee22be1715884e175f9679
Stats: 248 lines in 39 files changed: 132 ins; 8 del; 108 mod

8324858: [vectorapi] Bounds checking issues when accessing memory segments

Reviewed-by: shade
Backport-of: 1ae851387f881263ccc6aeace5afdd0f49d41d33

-

PR: https://git.openjdk.org/jdk22/pull/109


Integrated: 8324858: [vectorapi] Bounds checking issues when accessing memory segments

2024-02-02 Thread Paul Sandoz
On Mon, 29 Jan 2024 19:45:41 GMT, Paul Sandoz  wrote:

> The implementation of method `VectorSpecies::fromMemorySegment`, in 
> `AbstractSpecies::fromMemorySegment`, neglects to perform bounds checks on 
> the offset argument when the method is compiled by C2 (bounds checks are 
> performed when interpreted and by C1).
> 
> This is an oversight and explicit bounds checks are required, as is already 
> case for the other load and store memory access methods (including storing to 
> memory memory segments).
> 
> The workaround is to call the static method `{T}Vector::fromMemorySegment`.
> 
> The fix is for the implementation(s) of `VectorSpecies::fromMemorySegment` to 
> do the same and call `{T}Vector::fromMemorySegment`, following the same 
> pattern for implementations of `VectorSpecies::fromArray`.
> 
> The tests have been conservatively updated to call the species access method 
> where possible in the knowledge that it calls the vector access method (the 
> tests were intended to test out of bounds access when compiled by C2).
> 
> Thinking ahead its tempting to remove the species access methods, simplifying 
> functionality that is duplicated.

This pull request has now been integrated.

Changeset: 1ae85138
Author:Paul Sandoz 
URL:   
https://git.openjdk.org/jdk/commit/1ae851387f881263ccc6aeace5afdd0f49d41d33
Stats: 248 lines in 39 files changed: 132 ins; 8 del; 108 mod

8324858: [vectorapi] Bounds checking issues when accessing memory segments

Reviewed-by: mcimadamore, jbhateja

-

PR: https://git.openjdk.org/jdk/pull/17621