[jdk18] RFR: 8272058: 25 Null pointer dereference defect groups in 4 files [v4]

Daniel D.Daugherty dcubed at openjdk.java.net
Tue Jan 18 22:49:41 UTC 2022


On Tue, 18 Jan 2022 20:57:51 GMT, Patric Hedlin <phedlin at openjdk.org> wrote:

>> @bulasevich - I've made another pass through the code and checked the
>> calls to `MacroAssembler::target_addr_for_insn()` and I don't see any of
>> those calls in areas related to safepoint polling. From the other POV, I
>> took a look at the aarch64 safepoint polling code and I don't see a way
>> into `MacroAssembler::target_addr_for_insn()` .
>> 
>> It is entirely possible that I'm missing something here and would appreciate
>> it if you could sanity check my conclusions here.
>
> I believe this code is dead, in both `MacroAssembler::pd_patch_instruction()` and `MacroAssembler::target_addr_for_insn()`, since the poll read is PIC, we are not patching and should not need to acquire any target to update.
> 
> The associated `fix_relocation_after_move()` will not invoke any of the above on the poll read since the `maybe_cpool_ref()` condition is used:
> 
> void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
>   if (NativeInstruction::maybe_cpool_ref(addr())) {
>     address old_addr = old_addr_for(addr(), src, dest);
>     MacroAssembler::pd_patch_instruction(addr(), MacroAssembler::target_addr_for_insn(old_addr));
>   }
> }
> 
> Should be sufficient to simply remove these cases, possibly you could move an assert into the "unreachable" branch (for "precision").
> 
> } else {
>   assert(!NativeInstruction::is_ldrw_to_zr(<addr>), "Unexpected poll read");
>   ShouldNotReachHere();
> }
> 
> (The code above in `fix_relocation_after_move()` might also be dead...)
> 
> Chip in @theRealAph ?

@phedlin - Thanks for chiming in on this review thread.

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

PR: https://git.openjdk.java.net/jdk18/pull/51


More information about the hotspot-runtime-dev mailing list