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

Boris Ulasevich bulasevich at openjdk.java.net
Wed Jan 19 10:43:32 UTC 2022


On Tue, 18 Jan 2022 22:45:59 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> 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.

I wondered if target_addr_for_insn ever gets the ldrw_to_zr instruction. 
Anyway, I am Ok to move it to target_addr_for_insn_allow_null_ret (target_addr_for_insn_or_null?).
Thank you.

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

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


More information about the hotspot-compiler-dev mailing list