All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: syzbot <syzbot+c23c5421600e9b454849@syzkaller.appspotmail.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	andrii@kernel.org, Alexei Starovoitov <ast@kernel.org>,
	bpf <bpf@vger.kernel.org>, Daniel Borkmann <daniel@iogearbox.net>,
	David Miller <davem@davemloft.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Martin KaFai Lau <kafai@fb.com>,
	kpsingh@kernel.org, Jakub Kicinski <kuba@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>, Song Liu <songliubraving@fb.com>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	Yonghong Song <yhs@fb.com>
Subject: Re: [syzbot] BUG: unable to handle kernel access to user memory in sock_ioctl
Date: Mon, 15 Mar 2021 14:41:42 +0000	[thread overview]
Message-ID: <bf2e19a3-3e3a-0eb1-ae37-4cc3b1a7af42@codethink.co.uk> (raw)
In-Reply-To: <CACT4Y+a1pQ96UWEB3pAnbxPZ+6jW2tqSzkTMqJ+XSbZsKLHgAw@mail.gmail.com>

On 15/03/2021 11:52, Dmitry Vyukov wrote:
> On Mon, Mar 15, 2021 at 12:30 PM Ben Dooks <ben.dooks@codethink.co.uk> wrote:
>>
>> On 14/03/2021 11:03, Dmitry Vyukov wrote:
>>> On Sun, Mar 14, 2021 at 11:01 AM Dmitry Vyukov <dvyukov@google.com> wrote:
>>>>> On Wed, Mar 10, 2021 at 7:28 PM syzbot
>>>>> <syzbot+c23c5421600e9b454849@syzkaller.appspotmail.com> wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> syzbot found the following issue on:
>>>>>>
>>>>>> HEAD commit:    0d7588ab riscv: process: Fix no prototype for arch_dup_tas..
>>>>>> git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes
>>>>>> console output: https://syzkaller.appspot.com/x/log.txt?x=122c343ad00000
>>>>>> kernel config:  https://syzkaller.appspot.com/x/.config?x=e3c595255fb2d136
>>>>>> dashboard link: https://syzkaller.appspot.com/bug?extid=c23c5421600e9b454849
>>>>>> userspace arch: riscv64
>>>>>>
>>>>>> Unfortunately, I don't have any reproducer for this issue yet.
>>>>>>
>>>>>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>>>>>> Reported-by: syzbot+c23c5421600e9b454849@syzkaller.appspotmail.com
>>>>>
>>>>> +riscv maintainers
>>>>>
>>>>> Another case of put_user crashing.
>>>>
>>>> There are 58 crashes in sock_ioctl already. Somehow there is a very
>>>> significant skew towards crashing with this "user memory without
>>>> uaccess routines" in schedule_tail and sock_ioctl of all places in the
>>>> kernel that use put_user... This looks very strange... Any ideas
>>>> what's special about these 2 locations?
>>>
>>> I could imagine if such a crash happens after a previous stack
>>> overflow and now task data structures are corrupted. But f_getown does
>>> not look like a function that consumes way more than other kernel
>>> syscalls...
>>
>> The last crash I looked at suggested somehow put_user got re-entered
>> with the user protection turned back on. Either there is a path through
>> one of the kernel handlers where this happens or there's something
>> weird going on with qemu.
> 
> Is there any kind of tracking/reporting that would help to localize
> it? I could re-reproduce with that code.

I'm not sure. I will have a go at debugging on qemu today just to make
sure I can reproduce here before I have to go into the office and fix
my Icicle board for real hardware tests.

I think my first plan post reproduction is to stuff some trace points
into the fault handlers to see if we can get a idea of faults being
processed, etc.

Maybe also add a check in the fault handler to see if the fault was
in a fixable region and post an error if that happens / maybe retry
the instruction with the relevant SR_SUM flag set.

Hopefully tomorrow I can get a run on real hardware to confirm.
Would have been better if the Unmatched board I ordered last year
would turn up.




-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

WARNING: multiple messages have this Message-ID (diff)
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: syzbot <syzbot+c23c5421600e9b454849@syzkaller.appspotmail.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	andrii@kernel.org, Alexei Starovoitov <ast@kernel.org>,
	bpf <bpf@vger.kernel.org>, Daniel Borkmann <daniel@iogearbox.net>,
	David Miller <davem@davemloft.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Martin KaFai Lau <kafai@fb.com>,
	kpsingh@kernel.org, Jakub Kicinski <kuba@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>, Song Liu <songliubraving@fb.com>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	Yonghong Song <yhs@fb.com>
Subject: Re: [syzbot] BUG: unable to handle kernel access to user memory in sock_ioctl
Date: Mon, 15 Mar 2021 14:41:42 +0000	[thread overview]
Message-ID: <bf2e19a3-3e3a-0eb1-ae37-4cc3b1a7af42@codethink.co.uk> (raw)
In-Reply-To: <CACT4Y+a1pQ96UWEB3pAnbxPZ+6jW2tqSzkTMqJ+XSbZsKLHgAw@mail.gmail.com>

On 15/03/2021 11:52, Dmitry Vyukov wrote:
> On Mon, Mar 15, 2021 at 12:30 PM Ben Dooks <ben.dooks@codethink.co.uk> wrote:
>>
>> On 14/03/2021 11:03, Dmitry Vyukov wrote:
>>> On Sun, Mar 14, 2021 at 11:01 AM Dmitry Vyukov <dvyukov@google.com> wrote:
>>>>> On Wed, Mar 10, 2021 at 7:28 PM syzbot
>>>>> <syzbot+c23c5421600e9b454849@syzkaller.appspotmail.com> wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> syzbot found the following issue on:
>>>>>>
>>>>>> HEAD commit:    0d7588ab riscv: process: Fix no prototype for arch_dup_tas..
>>>>>> git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes
>>>>>> console output: https://syzkaller.appspot.com/x/log.txt?x=122c343ad00000
>>>>>> kernel config:  https://syzkaller.appspot.com/x/.config?x=e3c595255fb2d136
>>>>>> dashboard link: https://syzkaller.appspot.com/bug?extid=c23c5421600e9b454849
>>>>>> userspace arch: riscv64
>>>>>>
>>>>>> Unfortunately, I don't have any reproducer for this issue yet.
>>>>>>
>>>>>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>>>>>> Reported-by: syzbot+c23c5421600e9b454849@syzkaller.appspotmail.com
>>>>>
>>>>> +riscv maintainers
>>>>>
>>>>> Another case of put_user crashing.
>>>>
>>>> There are 58 crashes in sock_ioctl already. Somehow there is a very
>>>> significant skew towards crashing with this "user memory without
>>>> uaccess routines" in schedule_tail and sock_ioctl of all places in the
>>>> kernel that use put_user... This looks very strange... Any ideas
>>>> what's special about these 2 locations?
>>>
>>> I could imagine if such a crash happens after a previous stack
>>> overflow and now task data structures are corrupted. But f_getown does
>>> not look like a function that consumes way more than other kernel
>>> syscalls...
>>
>> The last crash I looked at suggested somehow put_user got re-entered
>> with the user protection turned back on. Either there is a path through
>> one of the kernel handlers where this happens or there's something
>> weird going on with qemu.
> 
> Is there any kind of tracking/reporting that would help to localize
> it? I could re-reproduce with that code.

I'm not sure. I will have a go at debugging on qemu today just to make
sure I can reproduce here before I have to go into the office and fix
my Icicle board for real hardware tests.

I think my first plan post reproduction is to stuff some trace points
into the fault handlers to see if we can get a idea of faults being
processed, etc.

Maybe also add a check in the fault handler to see if the fault was
in a fixable region and post an error if that happens / maybe retry
the instruction with the relevant SR_SUM flag set.

Hopefully tomorrow I can get a run on real hardware to confirm.
Would have been better if the Unmatched board I ordered last year
would turn up.




-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2021-03-15 14:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 18:28 [syzbot] BUG: unable to handle kernel access to user memory in sock_ioctl syzbot
2021-03-10 18:53 ` Dmitry Vyukov
2021-03-10 18:53   ` Dmitry Vyukov
2021-03-14 10:01   ` Dmitry Vyukov
2021-03-14 10:01     ` Dmitry Vyukov
2021-03-14 11:03     ` Dmitry Vyukov
2021-03-14 11:03       ` Dmitry Vyukov
2021-03-15 11:30       ` Ben Dooks
2021-03-15 11:30         ` Ben Dooks
2021-03-15 11:52         ` Dmitry Vyukov
2021-03-15 11:52           ` Dmitry Vyukov
2021-03-15 14:41           ` Ben Dooks [this message]
2021-03-15 14:41             ` Ben Dooks
2021-03-18 15:18             ` Dmitry Vyukov
2021-03-18 15:18               ` Dmitry Vyukov
2021-03-18 15:34               ` Ben Dooks
2021-03-18 15:34                 ` Ben Dooks
2021-03-18 15:54                 ` Dmitry Vyukov
2021-03-18 15:54                   ` Dmitry Vyukov

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=bf2e19a3-3e3a-0eb1-ae37-4cc3b1a7af42@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --cc=andrii@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=songliubraving@fb.com \
    --cc=syzbot+c23c5421600e9b454849@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=yhs@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.