[jdk8u-dev] RFR: 8166140: C1: Possible integer overflow in LIRGenerator::generate_address on several platforms

Andrew Haley aph at openjdk.java.net
Wed Jun 1 12:32:41 UTC 2022


On Fri, 22 Apr 2022 12:00:12 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> I would like to backport this patch to 8u for parity with Oracle 8u331.
> 
> Bug: https://bugs.openjdk.java.net/browse/JDK-8166140
> Patch: [http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/f6c1ea29110e](https://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/f6c1ea29110e)
> 
> The patch does not apply cleanly:
> 1. ppc does not have compiler port in 8u.
> 2. Changes for `LIRGenerator::emit_array_address()` in `c1_LIRGenerator_x86.cpp` is obsoleted by [JDK-8272014](https://github.com/openjdk/jdk8u-dev/commit/3e26fd987a70473778e9ae06aa8dd5054483fa59)
> 
> Original code review thread: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2022-January/014517.html

That looks right. I've just gone through the Assembler entry points to make sure that all of them really do take a 64-bit integer type. There has been some churn in this area.

This looks OK:


Assembler::operand_valid_for_add_sub_immediate((long imm)
Address::offset_ok_for_immed((int64_t offset, uint shift)


And AFAICS there's no truncation to int anywhere in the path. But please check too.

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

PR: https://git.openjdk.java.net/jdk8u-dev/pull/46


More information about the jdk8u-dev mailing list