tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: panic: UBSan: Undefined Behavior in /syzkaller/managers/netbsd-kubsan/kernel/sys/kern/kern_rndq.c:LINE, negation of -ADD



On 27.09.2019 10:19, Rhialto wrote:
> On Thu 26 Sep 2019 at 01:15:23 +0200, Kamil Rytarowski wrote:
>> Is this patch correct?
>>
>> http://netbsd.org/~kamil/patch-00168-kern_rndq.c-avoid-overflow.txt
>>
>> This code will map the corner case into defined semantics, treating
>> delta INT32_MIN as INT32_MIN+1.
> 
> I don't know if it is important, but it makes the "normalized" delta
> value INT32_MAX more likely than it probably should be, since it can
> result from "raw" delta values INT32_MIN, INT32_MIN+1, and INT32_MAX.
> 
> Similarly, 0 is underrepresented as output, since it only can result
> from 0.
> 
> Other positive results x can come from x and -x as inputs.
> 
> -Olaf.
> 

If you think that it shall be represented a 0, I can go for it.

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index