From: Chen Feng <puck.chen@hisilicon.com>
To: "Theodore Ts'o" <tytso@mit.edu>,
Greg KH <gregkh@linuxfoundation.org>, <zhaoyukun@huawei.com>,
<arnd@arndb.de>, <linux-kernel@vger.kernel.org>,
<suzhuangluan@hisilicon.com>, <dan.zhao@hisilicon.com>
Subject: Re: [PATCH RFC] random: fix syzkaller fuzzer test int overflow
Date: Sat, 28 Oct 2017 11:22:00 +0800 [thread overview]
Message-ID: <59F3F7D8.1080807@hisilicon.com> (raw)
In-Reply-To: <20171026150445.s3rxcy4btlisdu5q@thunk.org>
Hi ted,
On 2017/10/26 23:04, Theodore Ts'o wrote:
> On Thu, Oct 26, 2017 at 04:25:15PM +0800, Chen Feng wrote:
>>
>>
>> On 2017/10/25 16:49, Theodore Ts'o wrote:
>>> Other people who have sent me fuzzer test reproducers are able to
>>> reproduce syzkaller logs into a simple C program. Can you explain to
>>> me what the heck:
>>>
>>>> r3 = syz_open_dev$urandom(&(0x7f000000a000)="2f6465762f7572616e646f6d00", 0x0, 0x0)
>>>
>>> means?
>>
>> Take a look at this:
>>
>> https://github.com/google/syzkaller/blob/master/sys/linux/random.txt
>
> Sorry, this *still* looks like gobbledygook.
>
> What ioctls are you executing, and with what arguments?
>
> *Please*, give me a C program I can compile.
I checked the ioctl. What's the purpose of RNDADDTOENTCNT ioctl to userspace?
We need to checked the user-input at credit_entropy_bits_safe.
+ if (INT_MAX - nbits < r->entropy_total)
+ return -EINVAL;
+
The test-code below:
void *random_ioctl_test(void *args)
{
int fd = -1;
int ret = -1;
int test_arg = 0x7fffffff;
fd = open("dev/urandom", 0x0, 0x0);
if (fd < 0) {
printf("open dev/urandom failed!\n");
return NULL;
}
ret = ioctl(fd, 0x40045201, &test_arg);
printf("random_ioctl ret=%d\n", ret);
close(fd);
return NULL;
}
int main(int argc, char *argv[])
{
int ret, i;
pthread_t thread[100];
for (i = 0; i < 100; i++) {
ret = pthread_create(&thread[i], NULL, random_ioctl_test, &i);
if (ret) {
printf("create thread %d fail with ret=%d\n", i, ret);
return -1;
}
}
for (i = 0; i < 100; i++) {
pthread_join(thread[i], NULL);
}
return 0;
}
>
> -Ted
>
> .
>
next prev parent reply other threads:[~2017-10-28 3:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-24 7:44 Chen Feng
2017-10-24 9:09 ` Greg KH
2017-10-24 9:24 ` Chen Feng
2017-10-24 9:57 ` Greg KH
2017-10-24 10:25 ` Theodore Ts'o
2017-10-25 6:30 ` Chen Feng
2017-10-25 6:56 ` Greg KH
2017-10-25 7:08 ` Chen Feng
2017-10-25 8:49 ` Theodore Ts'o
2017-10-26 8:25 ` Chen Feng
2017-10-26 15:04 ` Theodore Ts'o
2017-10-28 3:22 ` Chen Feng [this message]
2017-10-29 18:25 ` Theodore Ts'o
2017-10-30 7:39 ` Greg KH
2017-10-30 9:11 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=59F3F7D8.1080807@hisilicon.com \
--to=puck.chen@hisilicon.com \
--cc=arnd@arndb.de \
--cc=dan.zhao@hisilicon.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=suzhuangluan@hisilicon.com \
--cc=tytso@mit.edu \
--cc=zhaoyukun@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome