RFR: JDK-8294902: Undefined Behavior in C2 regalloc with null references [v6]

Kim Barrett kbarrett at openjdk.org
Sun Dec 4 15:11:03 UTC 2022


On Fri, 2 Dec 2022 10:19:33 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> This patch fixes the remaining null pointer dereference bugs that I know of.
>> 
>> For the main bug, C2 was using a null reference to indicate an uninitialized `Node_List`. I replaced the null reference with a static sentinel.
>> 
>> I also turned on `-fsanitize=null` and found and fixed a bunch of other null pointer dereferences. With this,I have run a full bootstrap and tier1 tests with `-fsanitize=null` enabled.
>> 
>> I have checked that the code generated by GCC is not worse in any significant way, so I don't expect to see any performance regressions.
>> 
>> I'd like to enable `-fsanitize=null` in debug builds to prevent regressions in this area. What do you think?
>
> Andrew Haley has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Feedback from reviewers

> Just noticed this PR, and have only skimmed through it. I have an idea for an alternative way to write `offset_of` that I _think_ might be better. I'm going to try it out and report back. That doesn't have to hold you up if you want to proceed.

That idea for an alternative `offset_of` implementation didn't pan out.  And I wasn't able to make disabling the
`-Winvalid-offsetof` warning within that macro work.  But now I'm wondering why it is being changed?  If I take
your changes except backout the `offset_of` change, and build with `-fsanitize=null` (for now by co-opting the
`--enable-asan` config option, since there's more to it than just adding that option to `--with-extra-cxxflags`),
that works (with gcc11.3).  So what is the `offset_of` change about?

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

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


More information about the hotspot-dev mailing list