* Re: BUG: sleeping function called from invalid context in __alloc_pages_nodemask
[not found] <20191130083223.1568-1-hdanton@sina.com>
@ 2019-11-30 11:50 ` Tetsuo Handa
0 siblings, 0 replies; 8+ messages in thread
From: Tetsuo Handa @ 2019-11-30 11:50 UTC (permalink / raw)
To: Hillf Danton, syzbot, Daniel Axtens, Mark Rutland
Cc: akpm, linux-kernel, linux-mm, syzkaller-bugs, Vasily Gorbik,
Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov,
Christophe Leroy
On 2019/11/30 17:32, Hillf Danton wrote:
>
> On Fri, 29 Nov 2019 23:35:08 -0800
>> Hello,
>>
>> syzbot found the following crash on:
>>
>> HEAD commit: 419593da Add linux-next specific files for 20191129
>> git tree: linux-next
>> console output: https://syzkaller.appspot.com/x/log.txt?x=12cc369ce00000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=7c04b0959e75c206
>> dashboard link: https://syzkaller.appspot.com/bug?extid=4925d60532bf4c399608
>> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
>>
>> Unfortunately, I don't have any reproducer for this crash yet.
>>
>> IMPORTANT: if you fix the bug, please add the following tag to the commit:
>> Reported-by: syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com
>>
>> BUG: sleeping function called from invalid context at mm/page_alloc.c:4681
>> in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2710, name:
>> kworker/0:2
>> 4 locks held by kworker/0:2/2710:
>> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: __write_once_size
>> include/linux/compiler.h:247 [inline]
>> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: arch_atomic64_set
>> arch/x86/include/asm/atomic64_64.h:34 [inline]
>> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: atomic64_set
>> include/asm-generic/atomic-instrumented.h:868 [inline]
>> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: atomic_long_set
>> include/asm-generic/atomic-long.h:40 [inline]
>> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: set_work_data
>> kernel/workqueue.c:615 [inline]
>> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at:
>> set_work_pool_and_clear_pending kernel/workqueue.c:642 [inline]
>> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at:
>> process_one_work+0x88b/0x1740 kernel/workqueue.c:2235
>> #1: ffffc9000802fdc0 (pcpu_balance_work){+.+.}, at:
>> process_one_work+0x8c1/0x1740 kernel/workqueue.c:2239
>> #2: ffffffff8983ff20 (pcpu_alloc_mutex){+.+.}, at:
>> pcpu_balance_workfn+0xb7/0x1310 mm/percpu.c:1845
>> #3: ffffffff89851b18 (vmap_area_lock){+.+.}, at: spin_lock
>> include/linux/spinlock.h:338 [inline]
>> #3: ffffffff89851b18 (vmap_area_lock){+.+.}, at:
>> pcpu_get_vm_areas+0x3b27/0x3f00 mm/vmalloc.c:3431
>> Preemption disabled at:
>> [<ffffffff81a89ce7>] spin_lock include/linux/spinlock.h:338 [inline]
>> [<ffffffff81a89ce7>] pcpu_get_vm_areas+0x3b27/0x3f00 mm/vmalloc.c:3431
>> CPU: 0 PID: 2710 Comm: kworker/0:2 Not tainted
>> 5.4.0-next-20191129-syzkaller #0
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
>> Google 01/01/2011
>> Workqueue: events pcpu_balance_workfn
>> Call Trace:
>> __dump_stack lib/dump_stack.c:77 [inline]
>> dump_stack+0x197/0x210 lib/dump_stack.c:118
>> ___might_sleep.cold+0x1fb/0x23e kernel/sched/core.c:6800
>> __might_sleep+0x95/0x190 kernel/sched/core.c:6753
>> prepare_alloc_pages mm/page_alloc.c:4681 [inline]
>> __alloc_pages_nodemask+0x523/0x910 mm/page_alloc.c:4730
>> alloc_pages_current+0x107/0x210 mm/mempolicy.c:2211
>> alloc_pages include/linux/gfp.h:532 [inline]
>> __get_free_pages+0xc/0x40 mm/page_alloc.c:4786
>> kasan_populate_vmalloc_pte mm/kasan/common.c:762 [inline]
>> kasan_populate_vmalloc_pte+0x2f/0x1c0 mm/kasan/common.c:753
>> apply_to_pte_range mm/memory.c:2041 [inline]
>> apply_to_pmd_range mm/memory.c:2068 [inline]
>> apply_to_pud_range mm/memory.c:2088 [inline]
>> apply_to_p4d_range mm/memory.c:2108 [inline]
>> apply_to_page_range+0x445/0x700 mm/memory.c:2133
>> kasan_populate_vmalloc+0x68/0x90 mm/kasan/common.c:791
>> pcpu_get_vm_areas+0x3c77/0x3f00 mm/vmalloc.c:3439
>> pcpu_create_chunk+0x24e/0x7f0 mm/percpu-vm.c:340
>> pcpu_balance_workfn+0xf1b/0x1310 mm/percpu.c:1934
>> process_one_work+0x9af/0x1740 kernel/workqueue.c:2264
>> worker_thread+0x98/0xe40 kernel/workqueue.c:2410
>> kthread+0x361/0x430 kernel/kthread.c:255
>> ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
>
> Replace the blocking gfp mask with a non-blocking one to survive
> checks like might_sleep.
>
> --- a/mm/kasan/common.c
> +++ b/mm/kasan/common.c
> @@ -759,7 +759,7 @@ static int kasan_populate_vmalloc_pte(pt
> if (likely(!pte_none(*ptep)))
> return 0;
>
> - page = __get_free_page(GFP_KERNEL);
> + page = __get_free_page(GFP_NOWAIT);
> if (!page)
> return -ENOMEM;
>
Nope. This change would survive might_sleep() check, but the caller is
expecting that this is __GFP_NOFAIL allocation. Even if the caller can
tolerate allocation failures, __GFP_NOWARN should be added in order to
avoid flooding of allocation failure messages.
/* insert all vm's */
spin_lock(&vmap_area_lock);
for (area = 0; area < nr_vms; area++) {
insert_vmap_area(vas[area], &vmap_area_root, &vmap_area_list);
setup_vmalloc_vm_locked(vms[area], vas[area], VM_ALLOC,
pcpu_get_vm_areas);
/* assume success here */
kasan_populate_vmalloc(sizes[area], vms[area]);
}
spin_unlock(&vmap_area_lock);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: BUG: sleeping function called from invalid context in __alloc_pages_nodemask
2019-11-30 7:35 syzbot
` (2 preceding siblings ...)
2019-12-01 15:11 ` syzbot
@ 2019-12-02 4:07 ` syzbot
3 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2019-12-02 4:07 UTC (permalink / raw)
To: a, akpm, alex.aring, allison, andrew, andy, ap420073, aryabinin,
ast, b.a.t.m.a.n, bridge, christophe.leroy, cleech, daniel,
davem, dja, dsa, dvyukov, edumazet, f.fainelli, fw, glider, gor,
gregkh, gustavo, gvaradar, haiyangz, hdanton, idosch, info,
j.vosburgh, j, jakub.kicinski, jhs, jiri, johan.hedberg,
johannes.berg, jwi, kasan-dev, kstewart, kvalo, kys, lariel,
linmiaohe, linux-bluetooth, linux-hams, linux-hyperv,
linux-kernel, linux-mm, linux-ppp
syzbot has bisected this bug to:
commit ab92d68fc22f9afab480153bd82a20f6e2533769
Author: Taehee Yoo <ap420073@gmail.com>
Date: Mon Oct 21 18:47:51 2019 +0000
net: core: add generic lockdep keys
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=15769712e00000
start commit: 419593da Add linux-next specific files for 20191129
git tree: linux-next
final crash: https://syzkaller.appspot.com/x/report.txt?x=17769712e00000
console output: https://syzkaller.appspot.com/x/log.txt?x=13769712e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=7c04b0959e75c206
dashboard link: https://syzkaller.appspot.com/bug?extid=4925d60532bf4c399608
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16148e9ce00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12a1f786e00000
Reported-by: syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com
Fixes: ab92d68fc22f ("net: core: add generic lockdep keys")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: BUG: sleeping function called from invalid context in __alloc_pages_nodemask
2019-11-30 7:35 syzbot
2019-11-30 7:57 ` Dmitry Vyukov
2019-12-01 11:22 ` syzbot
@ 2019-12-01 15:11 ` syzbot
2019-12-02 4:07 ` syzbot
3 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2019-12-01 15:11 UTC (permalink / raw)
To: akpm, aryabinin, christophe.leroy, dja, dvyukov, glider, gor,
hdanton, kasan-dev, linux-kernel, linux-mm, mark.rutland,
penguin-kernel, syzkaller-bugs, urezki
syzbot has found a reproducer for the following crash on:
HEAD commit: 419593da Add linux-next specific files for 20191129
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=177a9712e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=7c04b0959e75c206
dashboard link: https://syzkaller.appspot.com/bug?extid=4925d60532bf4c399608
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16148e9ce00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12a1f786e00000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com
BUG: sleeping function called from invalid context at mm/page_alloc.c:4681
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 9065, name:
kworker/1:3
4 locks held by kworker/1:3/9065:
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: __write_once_size
include/linux/compiler.h:247 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: arch_atomic64_set
arch/x86/include/asm/atomic64_64.h:34 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: atomic64_set
include/asm-generic/atomic-instrumented.h:868 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: atomic_long_set
include/asm-generic/atomic-long.h:40 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: set_work_data
kernel/workqueue.c:615 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at:
set_work_pool_and_clear_pending kernel/workqueue.c:642 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at:
process_one_work+0x88b/0x1740 kernel/workqueue.c:2235
#1: ffffc90002177dc0 (pcpu_balance_work){+.+.}, at:
process_one_work+0x8c1/0x1740 kernel/workqueue.c:2239
#2: ffffffff8983ff20 (pcpu_alloc_mutex){+.+.}, at:
pcpu_balance_workfn+0xb7/0x1310 mm/percpu.c:1845
#3: ffffffff89851b18 (vmap_area_lock){+.+.}, at: spin_lock
include/linux/spinlock.h:338 [inline]
#3: ffffffff89851b18 (vmap_area_lock){+.+.}, at:
pcpu_get_vm_areas+0x3b27/0x3f00 mm/vmalloc.c:3431
Preemption disabled at:
[<ffffffff81a89ce7>] spin_lock include/linux/spinlock.h:338 [inline]
[<ffffffff81a89ce7>] pcpu_get_vm_areas+0x3b27/0x3f00 mm/vmalloc.c:3431
CPU: 1 PID: 9065 Comm: kworker/1:3 Not tainted
5.4.0-next-20191129-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: events pcpu_balance_workfn
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x197/0x210 lib/dump_stack.c:118
___might_sleep.cold+0x1fb/0x23e kernel/sched/core.c:6800
__might_sleep+0x95/0x190 kernel/sched/core.c:6753
prepare_alloc_pages mm/page_alloc.c:4681 [inline]
__alloc_pages_nodemask+0x523/0x910 mm/page_alloc.c:4730
alloc_pages_current+0x107/0x210 mm/mempolicy.c:2211
alloc_pages include/linux/gfp.h:532 [inline]
__get_free_pages+0xc/0x40 mm/page_alloc.c:4786
kasan_populate_vmalloc_pte mm/kasan/common.c:762 [inline]
kasan_populate_vmalloc_pte+0x2f/0x1c0 mm/kasan/common.c:753
apply_to_pte_range mm/memory.c:2041 [inline]
apply_to_pmd_range mm/memory.c:2068 [inline]
apply_to_pud_range mm/memory.c:2088 [inline]
apply_to_p4d_range mm/memory.c:2108 [inline]
apply_to_page_range+0x445/0x700 mm/memory.c:2133
kasan_populate_vmalloc+0x68/0x90 mm/kasan/common.c:791
pcpu_get_vm_areas+0x3c77/0x3f00 mm/vmalloc.c:3439
pcpu_create_chunk+0x24e/0x7f0 mm/percpu-vm.c:340
pcpu_balance_workfn+0xf1b/0x1310 mm/percpu.c:1934
process_one_work+0x9af/0x1740 kernel/workqueue.c:2264
worker_thread+0x98/0xe40 kernel/workqueue.c:2410
kthread+0x361/0x430 kernel/kthread.c:255
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: BUG: sleeping function called from invalid context in __alloc_pages_nodemask
2019-11-30 7:35 syzbot
2019-11-30 7:57 ` Dmitry Vyukov
@ 2019-12-01 11:22 ` syzbot
2019-12-01 15:11 ` syzbot
2019-12-02 4:07 ` syzbot
3 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2019-12-01 11:22 UTC (permalink / raw)
To: akpm, aryabinin, christophe.leroy, dja, dvyukov, glider, gor,
hdanton, kasan-dev, linux-kernel, linux-mm, mark.rutland,
penguin-kernel, syzkaller-bugs, urezki
syzbot has found a reproducer for the following crash on:
HEAD commit: 419593da Add linux-next specific files for 20191129
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=168e202ee00000
kernel config: https://syzkaller.appspot.com/x/.config?x=7c04b0959e75c206
dashboard link: https://syzkaller.appspot.com/bug?extid=4925d60532bf4c399608
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=162234a2e00000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com
BUG: sleeping function called from invalid context at mm/page_alloc.c:4681
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 9071, name:
kworker/0:3
4 locks held by kworker/0:3/9071:
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: __write_once_size
include/linux/compiler.h:247 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: arch_atomic64_set
arch/x86/include/asm/atomic64_64.h:34 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: atomic64_set
include/asm-generic/atomic-instrumented.h:868 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: atomic_long_set
include/asm-generic/atomic-long.h:40 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: set_work_data
kernel/workqueue.c:615 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at:
set_work_pool_and_clear_pending kernel/workqueue.c:642 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at:
process_one_work+0x88b/0x1740 kernel/workqueue.c:2235
#1: ffffc900021a7dc0 (pcpu_balance_work){+.+.}, at:
process_one_work+0x8c1/0x1740 kernel/workqueue.c:2239
#2: ffffffff8983ff20 (pcpu_alloc_mutex){+.+.}, at:
pcpu_balance_workfn+0xb7/0x1310 mm/percpu.c:1845
#3: ffffffff89851b18 (vmap_area_lock){+.+.}, at: spin_lock
include/linux/spinlock.h:338 [inline]
#3: ffffffff89851b18 (vmap_area_lock){+.+.}, at:
pcpu_get_vm_areas+0x3b27/0x3f00 mm/vmalloc.c:3431
Preemption disabled at:
[<ffffffff81a89ce7>] spin_lock include/linux/spinlock.h:338 [inline]
[<ffffffff81a89ce7>] pcpu_get_vm_areas+0x3b27/0x3f00 mm/vmalloc.c:3431
CPU: 0 PID: 9071 Comm: kworker/0:3 Not tainted
5.4.0-next-20191129-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: events pcpu_balance_workfn
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x197/0x210 lib/dump_stack.c:118
___might_sleep.cold+0x1fb/0x23e kernel/sched/core.c:6800
__might_sleep+0x95/0x190 kernel/sched/core.c:6753
prepare_alloc_pages mm/page_alloc.c:4681 [inline]
__alloc_pages_nodemask+0x523/0x910 mm/page_alloc.c:4730
alloc_pages_current+0x107/0x210 mm/mempolicy.c:2211
alloc_pages include/linux/gfp.h:532 [inline]
__get_free_pages+0xc/0x40 mm/page_alloc.c:4786
kasan_populate_vmalloc_pte mm/kasan/common.c:762 [inline]
kasan_populate_vmalloc_pte+0x2f/0x1c0 mm/kasan/common.c:753
apply_to_pte_range mm/memory.c:2041 [inline]
apply_to_pmd_range mm/memory.c:2068 [inline]
apply_to_pud_range mm/memory.c:2088 [inline]
apply_to_p4d_range mm/memory.c:2108 [inline]
apply_to_page_range+0x445/0x700 mm/memory.c:2133
kasan_populate_vmalloc+0x68/0x90 mm/kasan/common.c:791
pcpu_get_vm_areas+0x3c77/0x3f00 mm/vmalloc.c:3439
pcpu_create_chunk+0x24e/0x7f0 mm/percpu-vm.c:340
pcpu_balance_workfn+0xf1b/0x1310 mm/percpu.c:1934
process_one_work+0x9af/0x1740 kernel/workqueue.c:2264
worker_thread+0x98/0xe40 kernel/workqueue.c:2410
kthread+0x361/0x430 kernel/kthread.c:255
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: BUG: sleeping function called from invalid context in __alloc_pages_nodemask
2019-11-30 12:48 ` Tetsuo Handa
@ 2019-11-30 13:44 ` Uladzislau Rezki
0 siblings, 0 replies; 8+ messages in thread
From: Uladzislau Rezki @ 2019-11-30 13:44 UTC (permalink / raw)
To: Tetsuo Handa
Cc: Dmitry Vyukov, syzbot, Daniel Axtens, kasan-dev, Andrew Morton,
LKML, Linux-MM, syzkaller-bugs
On Sat, Nov 30, 2019 at 09:48:34PM +0900, Tetsuo Handa wrote:
> On 2019/11/30 16:57, Dmitry Vyukov wrote:
> > On Sat, Nov 30, 2019 at 8:35 AM syzbot
> > <syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com> wrote:
> >>
> >> Hello,
> >>
> >> syzbot found the following crash on:
> >>
> >> HEAD commit: 419593da Add linux-next specific files for 20191129
> >> git tree: linux-next
> >> console output: https://syzkaller.appspot.com/x/log.txt?x=12cc369ce00000
> >> kernel config: https://syzkaller.appspot.com/x/.config?x=7c04b0959e75c206
> >> dashboard link: https://syzkaller.appspot.com/bug?extid=4925d60532bf4c399608
> >> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
> >>
> >> Unfortunately, I don't have any reproducer for this crash yet.
> >>
> >> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> >> Reported-by: syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com
> >
> > +Daniel, kasan-dev
> > This is presumably from the new CONFIG_KASAN_VMALLOC
>
> Well, this is because
>
> commit d005e4cdb2307f63b5ce5cb359964c5a72d95790
> Author: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Date: Tue Nov 19 11:45:23 2019 +1100
>
> mm/vmalloc: rework vmap_area_lock
>
> @@ -3363,29 +3369,38 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
> va = vas[area];
> va->va_start = start;
> va->va_end = start + size;
> -
> - insert_vmap_area(va, &vmap_area_root, &vmap_area_list);
> }
>
> - spin_unlock(&vmap_area_lock);
> + spin_unlock(&free_vmap_area_lock);
>
> /* insert all vm's */
> - for (area = 0; area < nr_vms; area++)
> - setup_vmalloc_vm(vms[area], vas[area], VM_ALLOC,
> + spin_lock(&vmap_area_lock);
> + for (area = 0; area < nr_vms; area++) {
> + insert_vmap_area(vas[area], &vmap_area_root, &vmap_area_list);
> +
> + setup_vmalloc_vm_locked(vms[area], vas[area], VM_ALLOC,
> pcpu_get_vm_areas);
> + }
> + spin_unlock(&vmap_area_lock);
>
> kfree(vas);
> return vms;
>
> made the iteration atomic context while
>
> commit 1800fa0a084c60a600be0cc43fc657ba5609fdda
> Author: Daniel Axtens <dja@axtens.net>
> Date: Tue Nov 19 11:45:23 2019 +1100
>
> kasan: support backing vmalloc space with real shadow memory
>
> @@ -3380,6 +3414,9 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
>
> setup_vmalloc_vm_locked(vms[area], vas[area], VM_ALLOC,
> pcpu_get_vm_areas);
> +
> + /* assume success here */
> + kasan_populate_vmalloc(sizes[area], vms[area]);
> }
> spin_unlock(&vmap_area_lock);
>
> tried to do sleeping allocation inside the iteration.
There was a patch that fixes an attempt of "sleeping allocation" under
the spinlock from Daniel:
https://lkml.org/lkml/2019/11/20/22
--
Vlad Rezki
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: BUG: sleeping function called from invalid context in __alloc_pages_nodemask
2019-11-30 7:57 ` Dmitry Vyukov
@ 2019-11-30 12:48 ` Tetsuo Handa
2019-11-30 13:44 ` Uladzislau Rezki
0 siblings, 1 reply; 8+ messages in thread
From: Tetsuo Handa @ 2019-11-30 12:48 UTC (permalink / raw)
To: Dmitry Vyukov, syzbot, Daniel Axtens, kasan-dev
Cc: Andrew Morton, LKML, Linux-MM, syzkaller-bugs
On 2019/11/30 16:57, Dmitry Vyukov wrote:
> On Sat, Nov 30, 2019 at 8:35 AM syzbot
> <syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com> wrote:
>>
>> Hello,
>>
>> syzbot found the following crash on:
>>
>> HEAD commit: 419593da Add linux-next specific files for 20191129
>> git tree: linux-next
>> console output: https://syzkaller.appspot.com/x/log.txt?x=12cc369ce00000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=7c04b0959e75c206
>> dashboard link: https://syzkaller.appspot.com/bug?extid=4925d60532bf4c399608
>> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
>>
>> Unfortunately, I don't have any reproducer for this crash yet.
>>
>> IMPORTANT: if you fix the bug, please add the following tag to the commit:
>> Reported-by: syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com
>
> +Daniel, kasan-dev
> This is presumably from the new CONFIG_KASAN_VMALLOC
Well, this is because
commit d005e4cdb2307f63b5ce5cb359964c5a72d95790
Author: Uladzislau Rezki (Sony) <urezki@gmail.com>
Date: Tue Nov 19 11:45:23 2019 +1100
mm/vmalloc: rework vmap_area_lock
@@ -3363,29 +3369,38 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
va = vas[area];
va->va_start = start;
va->va_end = start + size;
-
- insert_vmap_area(va, &vmap_area_root, &vmap_area_list);
}
- spin_unlock(&vmap_area_lock);
+ spin_unlock(&free_vmap_area_lock);
/* insert all vm's */
- for (area = 0; area < nr_vms; area++)
- setup_vmalloc_vm(vms[area], vas[area], VM_ALLOC,
+ spin_lock(&vmap_area_lock);
+ for (area = 0; area < nr_vms; area++) {
+ insert_vmap_area(vas[area], &vmap_area_root, &vmap_area_list);
+
+ setup_vmalloc_vm_locked(vms[area], vas[area], VM_ALLOC,
pcpu_get_vm_areas);
+ }
+ spin_unlock(&vmap_area_lock);
kfree(vas);
return vms;
made the iteration atomic context while
commit 1800fa0a084c60a600be0cc43fc657ba5609fdda
Author: Daniel Axtens <dja@axtens.net>
Date: Tue Nov 19 11:45:23 2019 +1100
kasan: support backing vmalloc space with real shadow memory
@@ -3380,6 +3414,9 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
setup_vmalloc_vm_locked(vms[area], vas[area], VM_ALLOC,
pcpu_get_vm_areas);
+
+ /* assume success here */
+ kasan_populate_vmalloc(sizes[area], vms[area]);
}
spin_unlock(&vmap_area_lock);
tried to do sleeping allocation inside the iteration.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: BUG: sleeping function called from invalid context in __alloc_pages_nodemask
2019-11-30 7:35 syzbot
@ 2019-11-30 7:57 ` Dmitry Vyukov
2019-11-30 12:48 ` Tetsuo Handa
2019-12-01 11:22 ` syzbot
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Dmitry Vyukov @ 2019-11-30 7:57 UTC (permalink / raw)
To: syzbot, Daniel Axtens, kasan-dev
Cc: Andrew Morton, LKML, Linux-MM, syzkaller-bugs
On Sat, Nov 30, 2019 at 8:35 AM syzbot
<syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: 419593da Add linux-next specific files for 20191129
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=12cc369ce00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=7c04b0959e75c206
> dashboard link: https://syzkaller.appspot.com/bug?extid=4925d60532bf4c399608
> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
>
> Unfortunately, I don't have any reproducer for this crash yet.
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com
+Daniel, kasan-dev
This is presumably from the new CONFIG_KASAN_VMALLOC
> BUG: sleeping function called from invalid context at mm/page_alloc.c:4681
> in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2710, name:
> kworker/0:2
> 4 locks held by kworker/0:2/2710:
> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: __write_once_size
> include/linux/compiler.h:247 [inline]
> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: arch_atomic64_set
> arch/x86/include/asm/atomic64_64.h:34 [inline]
> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: atomic64_set
> include/asm-generic/atomic-instrumented.h:868 [inline]
> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: atomic_long_set
> include/asm-generic/atomic-long.h:40 [inline]
> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: set_work_data
> kernel/workqueue.c:615 [inline]
> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at:
> set_work_pool_and_clear_pending kernel/workqueue.c:642 [inline]
> #0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at:
> process_one_work+0x88b/0x1740 kernel/workqueue.c:2235
> #1: ffffc9000802fdc0 (pcpu_balance_work){+.+.}, at:
> process_one_work+0x8c1/0x1740 kernel/workqueue.c:2239
> #2: ffffffff8983ff20 (pcpu_alloc_mutex){+.+.}, at:
> pcpu_balance_workfn+0xb7/0x1310 mm/percpu.c:1845
> #3: ffffffff89851b18 (vmap_area_lock){+.+.}, at: spin_lock
> include/linux/spinlock.h:338 [inline]
> #3: ffffffff89851b18 (vmap_area_lock){+.+.}, at:
> pcpu_get_vm_areas+0x3b27/0x3f00 mm/vmalloc.c:3431
> Preemption disabled at:
> [<ffffffff81a89ce7>] spin_lock include/linux/spinlock.h:338 [inline]
> [<ffffffff81a89ce7>] pcpu_get_vm_areas+0x3b27/0x3f00 mm/vmalloc.c:3431
> CPU: 0 PID: 2710 Comm: kworker/0:2 Not tainted
> 5.4.0-next-20191129-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Workqueue: events pcpu_balance_workfn
> Call Trace:
> __dump_stack lib/dump_stack.c:77 [inline]
> dump_stack+0x197/0x210 lib/dump_stack.c:118
> ___might_sleep.cold+0x1fb/0x23e kernel/sched/core.c:6800
> __might_sleep+0x95/0x190 kernel/sched/core.c:6753
> prepare_alloc_pages mm/page_alloc.c:4681 [inline]
> __alloc_pages_nodemask+0x523/0x910 mm/page_alloc.c:4730
> alloc_pages_current+0x107/0x210 mm/mempolicy.c:2211
> alloc_pages include/linux/gfp.h:532 [inline]
> __get_free_pages+0xc/0x40 mm/page_alloc.c:4786
> kasan_populate_vmalloc_pte mm/kasan/common.c:762 [inline]
> kasan_populate_vmalloc_pte+0x2f/0x1c0 mm/kasan/common.c:753
> apply_to_pte_range mm/memory.c:2041 [inline]
> apply_to_pmd_range mm/memory.c:2068 [inline]
> apply_to_pud_range mm/memory.c:2088 [inline]
> apply_to_p4d_range mm/memory.c:2108 [inline]
> apply_to_page_range+0x445/0x700 mm/memory.c:2133
> kasan_populate_vmalloc+0x68/0x90 mm/kasan/common.c:791
> pcpu_get_vm_areas+0x3c77/0x3f00 mm/vmalloc.c:3439
> pcpu_create_chunk+0x24e/0x7f0 mm/percpu-vm.c:340
> pcpu_balance_workfn+0xf1b/0x1310 mm/percpu.c:1934
> process_one_work+0x9af/0x1740 kernel/workqueue.c:2264
> worker_thread+0x98/0xe40 kernel/workqueue.c:2410
> kthread+0x361/0x430 kernel/kthread.c:255
> ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
>
>
> ---
> This bug is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkaller@googlegroups.com.
>
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/000000000000c280ba05988b6242%40google.com.
^ permalink raw reply [flat|nested] 8+ messages in thread
* BUG: sleeping function called from invalid context in __alloc_pages_nodemask
@ 2019-11-30 7:35 syzbot
2019-11-30 7:57 ` Dmitry Vyukov
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: syzbot @ 2019-11-30 7:35 UTC (permalink / raw)
To: akpm, linux-kernel, linux-mm, syzkaller-bugs
Hello,
syzbot found the following crash on:
HEAD commit: 419593da Add linux-next specific files for 20191129
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=12cc369ce00000
kernel config: https://syzkaller.appspot.com/x/.config?x=7c04b0959e75c206
dashboard link: https://syzkaller.appspot.com/bug?extid=4925d60532bf4c399608
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
Unfortunately, I don't have any reproducer for this crash yet.
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+4925d60532bf4c399608@syzkaller.appspotmail.com
BUG: sleeping function called from invalid context at mm/page_alloc.c:4681
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2710, name:
kworker/0:2
4 locks held by kworker/0:2/2710:
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: __write_once_size
include/linux/compiler.h:247 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: arch_atomic64_set
arch/x86/include/asm/atomic64_64.h:34 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: atomic64_set
include/asm-generic/atomic-instrumented.h:868 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: atomic_long_set
include/asm-generic/atomic-long.h:40 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at: set_work_data
kernel/workqueue.c:615 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at:
set_work_pool_and_clear_pending kernel/workqueue.c:642 [inline]
#0: ffff8880aa026d28 ((wq_completion)events){+.+.}, at:
process_one_work+0x88b/0x1740 kernel/workqueue.c:2235
#1: ffffc9000802fdc0 (pcpu_balance_work){+.+.}, at:
process_one_work+0x8c1/0x1740 kernel/workqueue.c:2239
#2: ffffffff8983ff20 (pcpu_alloc_mutex){+.+.}, at:
pcpu_balance_workfn+0xb7/0x1310 mm/percpu.c:1845
#3: ffffffff89851b18 (vmap_area_lock){+.+.}, at: spin_lock
include/linux/spinlock.h:338 [inline]
#3: ffffffff89851b18 (vmap_area_lock){+.+.}, at:
pcpu_get_vm_areas+0x3b27/0x3f00 mm/vmalloc.c:3431
Preemption disabled at:
[<ffffffff81a89ce7>] spin_lock include/linux/spinlock.h:338 [inline]
[<ffffffff81a89ce7>] pcpu_get_vm_areas+0x3b27/0x3f00 mm/vmalloc.c:3431
CPU: 0 PID: 2710 Comm: kworker/0:2 Not tainted
5.4.0-next-20191129-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: events pcpu_balance_workfn
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x197/0x210 lib/dump_stack.c:118
___might_sleep.cold+0x1fb/0x23e kernel/sched/core.c:6800
__might_sleep+0x95/0x190 kernel/sched/core.c:6753
prepare_alloc_pages mm/page_alloc.c:4681 [inline]
__alloc_pages_nodemask+0x523/0x910 mm/page_alloc.c:4730
alloc_pages_current+0x107/0x210 mm/mempolicy.c:2211
alloc_pages include/linux/gfp.h:532 [inline]
__get_free_pages+0xc/0x40 mm/page_alloc.c:4786
kasan_populate_vmalloc_pte mm/kasan/common.c:762 [inline]
kasan_populate_vmalloc_pte+0x2f/0x1c0 mm/kasan/common.c:753
apply_to_pte_range mm/memory.c:2041 [inline]
apply_to_pmd_range mm/memory.c:2068 [inline]
apply_to_pud_range mm/memory.c:2088 [inline]
apply_to_p4d_range mm/memory.c:2108 [inline]
apply_to_page_range+0x445/0x700 mm/memory.c:2133
kasan_populate_vmalloc+0x68/0x90 mm/kasan/common.c:791
pcpu_get_vm_areas+0x3c77/0x3f00 mm/vmalloc.c:3439
pcpu_create_chunk+0x24e/0x7f0 mm/percpu-vm.c:340
pcpu_balance_workfn+0xf1b/0x1310 mm/percpu.c:1934
process_one_work+0x9af/0x1740 kernel/workqueue.c:2264
worker_thread+0x98/0xe40 kernel/workqueue.c:2410
kthread+0x361/0x430 kernel/kthread.c:255
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-12-02 4:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20191130083223.1568-1-hdanton@sina.com>
2019-11-30 11:50 ` BUG: sleeping function called from invalid context in __alloc_pages_nodemask Tetsuo Handa
2019-11-30 7:35 syzbot
2019-11-30 7:57 ` Dmitry Vyukov
2019-11-30 12:48 ` Tetsuo Handa
2019-11-30 13:44 ` Uladzislau Rezki
2019-12-01 11:22 ` syzbot
2019-12-01 15:11 ` syzbot
2019-12-02 4:07 ` syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).