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 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.
-- 
Olaf 'Rhialto' Seibert -- rhialto at falu dot nl
___  Anyone who is capable of getting themselves made President should on
\X/  no account be allowed to do the job.       --Douglas Adams, "THGTTG"

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index