RFR(XS): 8098517: Unprotected PrintMalloc in os::realloc

Vitaly Davidovich vitalyd at gmail.com
Wed Jun 17 15:41:10 UTC 2015


Personally, I'd vote for consistency here so either change free() or add
guard in realloc().

sent from my phone
On Jun 17, 2015 8:26 AM, "David Holmes" <david.holmes at oracle.com> wrote:

> On 15/06/2015 10:01 PM, Vitaly Davidovich wrote:
>
>> Understood, although having os::free do tty NULL checks for
>> MallocCatchPtr is confusing then.
>>
>
> Yes - sorry, I missed that inconsistency.
>
>   Also, not sure a SEGV on printing is
>> the best way to trap that - why not crash intentionally then or print to
>> stderr? But perhaps that's a separate issue.
>>
>
> The likelihood of getting memory corruption before tty has been
> initialized is negligible.
>
> David
>
>  sent from my phone
>>
>> On Jun 15, 2015 7:47 AM, "David Holmes" <david.holmes at oracle.com
>> <mailto:david.holmes at oracle.com>> wrote:
>>
>>     On 15/06/2015 8:44 PM, Vitaly Davidovich wrote:
>>
>>         Hi Kim,
>>
>>         Would it make sense to guard the other couple of tty uses in
>>         this method
>>         as well? Similar to os::free there.
>>
>>
>>     The "unguarded" ones are all "guarded" by conditions of the form:
>>
>>     if ((intptr_t)ptr == (intptr_t)MallocCatchPtr) {
>>
>>     and would only trigger upon memory corruption, and then only have an
>>     issue with a null tty if the corruption is very early in the
>>     initialization sequence - which seems a very low likelihood and one
>>     for which a SEGV would not be that bad a thing. Whereas the
>>     PrintMalloc uses are unconditional and probably do happen before tty
>>     has been initialized.
>>
>>     So adding the NULL check would be harmless but also not particularly
>>     useful, in my opinion.
>>
>>     Cheers,
>>     David
>>
>>         sent from my phone
>>
>>         On Jun 15, 2015 1:47 AM, "Kim Barrett" <kim.barrett at oracle.com
>>         <mailto:kim.barrett at oracle.com>
>>         <mailto:kim.barrett at oracle.com <mailto:kim.barrett at oracle.com>>>
>>         wrote:
>>
>>              On Jun 14, 2015, at 10:41 PM, David Holmes
>>         <david.holmes at oracle.com <mailto:david.holmes at oracle.com>
>>              <mailto:david.holmes at oracle.com
>>         <mailto:david.holmes at oracle.com>>> wrote:
>>               >
>>               > Looks good and trivial - feel free to push.
>>
>>              Thanks.
>>
>>


More information about the hotspot-runtime-dev mailing list