RFR 8158589: Possible integer overflow issues for DRBG

Sean Mullan sean.mullan at oracle.com
Fri Jun 17 11:45:35 UTC 2016


On 06/16/2016 10:50 PM, Wang Weijun wrote:
>
>> On Jun 17, 2016, at 10:31 AM, Xuelei Fan <xuelei.fan at oracle.com> wrote:
>>
>> What did you mean "can a long field be a safe volatile?"
>
> A long value cannot be updated atomically, and I am afraid that another thread might only see half bits updated and the other half not.

Have you considered using java.util.concurrent.atomic.AtomicLong?

--Sean

>
> --Max
>
>>
>> Xuelei
>>
>> On 6/17/2016 10:00 AM, Wang Weijun wrote:
>>> Ping again.
>>>
>>>> On Jun 7, 2016, at 11:52 AM, Wang Weijun <weijun.wang at oracle.com> wrote:
>>>>
>>>> Hi All
>>>>
>>>> Please take a review at
>>>>
>>>>   http://cr.openjdk.java.net/~weijun/8158589/webrev.00/
>>>>
>>>> For the reseedCounter case, the default reseedInterval is Integer.MAX_VALUE and there is no integer bigger than it, therefore a new check reseedCounter < 0 is added. I had thought about making it long but can a long field be a safe volatile? I am not sure.
>>>>
>>>> I added a label noreg-cleanup, or maybe noreg-hard is better?
>>>>
>>>> Thanks
>>>> Max
>>>>
>>>
>>
>


More information about the security-dev mailing list