lkml.org 
[lkml]   [2017]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH RFC] random: fix syzkaller fuzzer test int overflow
From
Date


On 2017/10/25 14:56, Greg KH wrote:
> On Wed, Oct 25, 2017 at 02:30:56PM +0800, Chen Feng wrote:
>> Hi Ted,
>>
>> On 2017/10/24 18:25, Theodore Ts'o wrote:
>>> On Tue, Oct 24, 2017 at 11:09:27AM +0200, Greg KH wrote:
>>>> On Tue, Oct 24, 2017 at 03:44:17PM +0800, Chen Feng wrote:
>>>>> [pid:11940,cpu6,syz-executor][flp_ioctl]cmd[0x1]
>>>>> Restart is not permit
>>>>> =================================================================
>>>>> UBSAN: Undefined behaviour in
>>>>> kernel/linux-4.4/drivers/char/random.c:676:19
>>>>> signed integer overflow:
>>>>> 2147483645 + 268435455 cannot be represented in type 'int'
>>>>> CPU: 4 PID: 11941 Comm: syz-executor Not tainted 4.4.76+ #2
>>>>
>>>> Does this also happen on 4.14-rc6?
>>>
>>> No. It was fixed in 4.8, by commit 86a574de4590: "random: strengthen
>>> input validation for RNDADDTOENTCNT".
>>
>>
>> I see my kernel has already merged this patch. So I don't think this patch
>> can resolve the issue above.
>
> Do you have a reproducer for this issue that we can use to test?
>

It's hard to reproduce, we found this on stress test with syzkaller test.

r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
syz_open_dev$random(&(0x7f0000005000-0xc)="2f6465762f72616e646f6d00", 0x0, 0x10100)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
UBSAN: Undefined behaviour in kernel/linux-4.4/drivers/char/random.c:676:19
[<ffffffa661ab85bc>] random_ioctl+0x338/0x384


git log --oneline drivers/char/random.c

3991576 random: properly align get_random_int_hash
5f87c47 Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
f48dd2d random: add interrupt callback to VMBus IRQ handler
529025b random: print a warning for the first ten uninitialized random users
f41fc0b random: initialize the non-blocking pool via add_hwgenerator_randomness()
fdd8543 Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
93f84c8 random: strengthen input validation for RNDADDTOENTCNT
06bfe14 FROMLIST: drivers: char: random: add get_random_long()
c271950 random: Remove kernel blocking API
205a525 random: Add callback API for random pool readiness
16b369a random: Blocking API for accessing nonblocking_pool
1d9de44 random: Wake up all getrandom(2) callers when pool is ready
19acc77 random: Fix fast_mix() function


> thanks,
>
> greg k-h
>
> .
>

\
 
 \ /
  Last update: 2017-10-25 09:10    [W:0.952 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site