2023-10-18 19:30:07

by syzbot

[permalink] [raw]
Subject: [syzbot] [mm?] [fs?] general protection fault in folio_flags

Hello,

syzbot found the following issue on:

HEAD commit: 2dac75696c6d Add linux-next specific files for 20231018
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=13858275680000
kernel config: https://syzkaller.appspot.com/x/.config?x=6f8545e1ef7a2b66
dashboard link: https://syzkaller.appspot.com/bug?extid=1e2648076cadf48ad9a1
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17543ee5680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=101f5fe5680000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2375f16ed327/disk-2dac7569.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c80aee6e2e6c/vmlinux-2dac7569.xz
kernel image: https://storage.googleapis.com/syzbot-assets/664dc23b738d/bzImage-2dac7569.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 1 PID: 5710 Comm: syz-executor155 Not tainted 6.6.0-rc6-next-20231018-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
RIP: 0010:PageTail include/linux/page-flags.h:286 [inline]
RIP: 0010:folio_flags.constprop.0+0x21/0x150 include/linux/page-flags.h:313
Code: 84 00 00 00 00 00 0f 1f 00 41 54 55 53 48 89 fb e8 14 2f a4 ff 48 8d 7b 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 00 01 00 00 48 8b 6b 08 31 ff 83 e5 01 48 89 ee
RSP: 0018:ffffc90004367968 EFLAGS: 00010247
RAX: dffffc0000000000 RBX: fffffffffffffffe RCX: ffffffff81b7e126
RDX: 0000000000000000 RSI: ffffffff81e49d1c RDI: 0000000000000006
RBP: 0000000020200000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 1ffffffff1976fb9 R12: ffff88801675b900
R13: ffff888025f9f680 R14: fffffffffffffffe R15: 1ffff9200086cf3d
FS: 00007f2f2a17c6c0(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2f2a17cd58 CR3: 000000001bfa0000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
folio_test_head include/linux/page-flags.h:790 [inline]
folio_test_large include/linux/page-flags.h:811 [inline]
folio_order include/linux/mm.h:1079 [inline]
collapse_pte_mapped_thp+0x42d/0x13b0 mm/khugepaged.c:1512
madvise_collapse+0x875/0xaf0 mm/khugepaged.c:2761
madvise_vma_behavior+0x1fe/0x1d00 mm/madvise.c:1086
madvise_walk_vmas+0x1cf/0x2c0 mm/madvise.c:1260
do_madvise+0x333/0x660 mm/madvise.c:1440
__do_sys_madvise mm/madvise.c:1453 [inline]
__se_sys_madvise mm/madvise.c:1451 [inline]
__x64_sys_madvise+0xaa/0x110 mm/madvise.c:1451
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f2f2a1dc7a9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 1a 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2f2a17c238 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
RAX: ffffffffffffffda RBX: 00007f2f2a266318 RCX: 00007f2f2a1dc7a9
RDX: 0000000000000019 RSI: 000000000060005f RDI: 0000000020000000
RBP: 00007f2f2a266310 R08: 00007ffe616d77f7 R09: 00007f2f2a17c6c0
R10: 0000000000000000 R11: 0000000000000246 R12: b635773f07ebbeef
R13: 000000000000006e R14: 00007ffe616d7710 R15: 00007ffe616d77f8
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:PageTail include/linux/page-flags.h:286 [inline]
RIP: 0010:folio_flags.constprop.0+0x21/0x150 include/linux/page-flags.h:313
Code: 84 00 00 00 00 00 0f 1f 00 41 54 55 53 48 89 fb e8 14 2f a4 ff 48 8d 7b 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 00 01 00 00 48 8b 6b 08 31 ff 83 e5 01 48 89 ee
RSP: 0018:ffffc90004367968 EFLAGS: 00010247
RAX: dffffc0000000000 RBX: fffffffffffffffe RCX: ffffffff81b7e126
RDX: 0000000000000000 RSI: ffffffff81e49d1c RDI: 0000000000000006
RBP: 0000000020200000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 1ffffffff1976fb9 R12: ffff88801675b900
R13: ffff888025f9f680 R14: fffffffffffffffe R15: 1ffff9200086cf3d
FS: 00007f2f2a17c6c0(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2f2a17cd58 CR3: 000000001bfa0000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 84 00 test %al,(%rax)
2: 00 00 add %al,(%rax)
4: 00 00 add %al,(%rax)
6: 0f 1f 00 nopl (%rax)
9: 41 54 push %r12
b: 55 push %rbp
c: 53 push %rbx
d: 48 89 fb mov %rdi,%rbx
10: e8 14 2f a4 ff call 0xffa42f29
15: 48 8d 7b 08 lea 0x8(%rbx),%rdi
19: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
20: fc ff df
23: 48 89 fa mov %rdi,%rdx
26: 48 c1 ea 03 shr $0x3,%rdx
* 2a: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2e: 0f 85 00 01 00 00 jne 0x134
34: 48 8b 6b 08 mov 0x8(%rbx),%rbp
38: 31 ff xor %edi,%edi
3a: 83 e5 01 and $0x1,%ebp
3d: 48 89 ee mov %rbp,%rsi


---
This report 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 [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup


2023-10-18 20:49:16

by Andrew Morton

[permalink] [raw]
Subject: Re: [syzbot] [mm?] [fs?] general protection fault in folio_flags

On Wed, 18 Oct 2023 12:29:47 -0700 syzbot <[email protected]> wrote:

> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 2dac75696c6d Add linux-next specific files for 20231018
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=13858275680000
> kernel config: https://syzkaller.appspot.com/x/.config?x=6f8545e1ef7a2b66
> dashboard link: https://syzkaller.appspot.com/bug?extid=1e2648076cadf48ad9a1
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17543ee5680000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=101f5fe5680000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/2375f16ed327/disk-2dac7569.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/c80aee6e2e6c/vmlinux-2dac7569.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/664dc23b738d/bzImage-2dac7569.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: [email protected]

Thanks.

> general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASA
> KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
> CPU: 1 PID: 5710 Comm: syz-executor155 Not tainted 6.6.0-rc6-next-20231018-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
> RIP: 0010:PageTail include/linux/page-flags.h:286 [inline]
> RIP: 0010:folio_flags.constprop.0+0x21/0x150 include/linux/page-flags.h:313
> Code: 84 00 00 00 00 00 0f 1f 00 41 54 55 53 48 89 fb e8 14 2f a4 ff 48 8d 7b 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 00 01 00 00 48 8b 6b 08 31 ff 83 e5 01 48 89 ee
> RSP: 0018:ffffc90004367968 EFLAGS: 00010247
> RAX: dffffc0000000000 RBX: fffffffffffffffe RCX: ffffffff81b7e126
> RDX: 0000000000000000 RSI: ffffffff81e49d1c RDI: 0000000000000006
> RBP: 0000000020200000 R08: 0000000000000005 R09: 0000000000000000
> R10: 0000000000000000 R11: 1ffffffff1976fb9 R12: ffff88801675b900
> R13: ffff888025f9f680 R14: fffffffffffffffe R15: 1ffff9200086cf3d
> FS: 00007f2f2a17c6c0(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f2f2a17cd58 CR3: 000000001bfa0000 CR4: 00000000003506f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> <TASK>
> folio_test_head include/linux/page-flags.h:790 [inline]
> folio_test_large include/linux/page-flags.h:811 [inline]
> folio_order include/linux/mm.h:1079 [inline]
> collapse_pte_mapped_thp+0x42d/0x13b0 mm/khugepaged.c:1512

Vishal, could you please take a look?

> madvise_collapse+0x875/0xaf0 mm/khugepaged.c:2761
> madvise_vma_behavior+0x1fe/0x1d00 mm/madvise.c:1086
> madvise_walk_vmas+0x1cf/0x2c0 mm/madvise.c:1260
> do_madvise+0x333/0x660 mm/madvise.c:1440
> __do_sys_madvise mm/madvise.c:1453 [inline]
> __se_sys_madvise mm/madvise.c:1451 [inline]
> __x64_sys_madvise+0xaa/0x110 mm/madvise.c:1451
> do_syscall_x64 arch/x86/entry/common.c:51 [inline]
> do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
> entry_SYSCALL_64_after_hwframe+0x63/0x6b
> RIP: 0033:0x7f2f2a1dc7a9
> Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 1a 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007f2f2a17c238 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
> RAX: ffffffffffffffda RBX: 00007f2f2a266318 RCX: 00007f2f2a1dc7a9
> RDX: 0000000000000019 RSI: 000000000060005f RDI: 0000000020000000
> RBP: 00007f2f2a266310 R08: 00007ffe616d77f7 R09: 00007f2f2a17c6c0
> R10: 0000000000000000 R11: 0000000000000246 R12: b635773f07ebbeef
> R13: 000000000000006e R14: 00007ffe616d7710 R15: 00007ffe616d77f8
>
> ...
>

2023-10-18 21:31:37

by Vishal Moola

[permalink] [raw]
Subject: Re: [syzbot] [mm?] [fs?] general protection fault in folio_flags

On Wed, Oct 18, 2023 at 1:49 PM Andrew Morton <[email protected]> wrote:
>
> On Wed, 18 Oct 2023 12:29:47 -0700 syzbot <[email protected]> wrote:
>
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: 2dac75696c6d Add linux-next specific files for 20231018
> > git tree: linux-next
> > console output: https://syzkaller.appspot.com/x/log.txt?x=13858275680000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=6f8545e1ef7a2b66
> > dashboard link: https://syzkaller.appspot.com/bug?extid=1e2648076cadf48ad9a1
> > compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17543ee5680000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=101f5fe5680000
> >
> > Downloadable assets:
> > disk image: https://storage.googleapis.com/syzbot-assets/2375f16ed327/disk-2dac7569.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/c80aee6e2e6c/vmlinux-2dac7569.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/664dc23b738d/bzImage-2dac7569.xz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: [email protected]
>
> Thanks.
>
> > general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASA
> > KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
> > CPU: 1 PID: 5710 Comm: syz-executor155 Not tainted 6.6.0-rc6-next-20231018-syzkaller #0
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
> > RIP: 0010:PageTail include/linux/page-flags.h:286 [inline]
> > RIP: 0010:folio_flags.constprop.0+0x21/0x150 include/linux/page-flags.h:313
> > Code: 84 00 00 00 00 00 0f 1f 00 41 54 55 53 48 89 fb e8 14 2f a4 ff 48 8d 7b 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 00 01 00 00 48 8b 6b 08 31 ff 83 e5 01 48 89 ee
> > RSP: 0018:ffffc90004367968 EFLAGS: 00010247
> > RAX: dffffc0000000000 RBX: fffffffffffffffe RCX: ffffffff81b7e126
> > RDX: 0000000000000000 RSI: ffffffff81e49d1c RDI: 0000000000000006
> > RBP: 0000000020200000 R08: 0000000000000005 R09: 0000000000000000
> > R10: 0000000000000000 R11: 1ffffffff1976fb9 R12: ffff88801675b900
> > R13: ffff888025f9f680 R14: fffffffffffffffe R15: 1ffff9200086cf3d
> > FS: 00007f2f2a17c6c0(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
> > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: 00007f2f2a17cd58 CR3: 000000001bfa0000 CR4: 00000000003506f0
> > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > Call Trace:
> > <TASK>
> > folio_test_head include/linux/page-flags.h:790 [inline]
> > folio_test_large include/linux/page-flags.h:811 [inline]
> > folio_order include/linux/mm.h:1079 [inline]
> > collapse_pte_mapped_thp+0x42d/0x13b0 mm/khugepaged.c:1512
>
> Vishal, could you please take a look?

Yes of course. This looks to be caused by filemap_lock_folio()
returning an ERR_PTR() which wasn't an issue prior as
find_lock_page()/pagecache_get_page() was checking that
before returning a page.

#syz test: https://github.com/VMoola/kernel.git
34d60af8cb66d6f582c1aeade01689e94e8a0092


> > madvise_collapse+0x875/0xaf0 mm/khugepaged.c:2761
> > madvise_vma_behavior+0x1fe/0x1d00 mm/madvise.c:1086
> > madvise_walk_vmas+0x1cf/0x2c0 mm/madvise.c:1260
> > do_madvise+0x333/0x660 mm/madvise.c:1440
> > __do_sys_madvise mm/madvise.c:1453 [inline]
> > __se_sys_madvise mm/madvise.c:1451 [inline]
> > __x64_sys_madvise+0xaa/0x110 mm/madvise.c:1451
> > do_syscall_x64 arch/x86/entry/common.c:51 [inline]
> > do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
> > entry_SYSCALL_64_after_hwframe+0x63/0x6b
> > RIP: 0033:0x7f2f2a1dc7a9
> > Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 1a 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
> > RSP: 002b:00007f2f2a17c238 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
> > RAX: ffffffffffffffda RBX: 00007f2f2a266318 RCX: 00007f2f2a1dc7a9
> > RDX: 0000000000000019 RSI: 000000000060005f RDI: 0000000020000000
> > RBP: 00007f2f2a266310 R08: 00007ffe616d77f7 R09: 00007f2f2a17c6c0
> > R10: 0000000000000000 R11: 0000000000000246 R12: b635773f07ebbeef
> > R13: 000000000000006e R14: 00007ffe616d7710 R15: 00007ffe616d77f8
> >
> > ...
> >

2023-10-18 21:59:09

by Vishal Moola

[permalink] [raw]
Subject: Re: [syzbot] [mm?] [fs?] general protection fault in folio_flags

On Wed, Oct 18, 2023 at 2:30 PM Vishal Moola <[email protected]> wrote:
>
> On Wed, Oct 18, 2023 at 1:49 PM Andrew Morton <[email protected]> wrote:
> >
> > On Wed, 18 Oct 2023 12:29:47 -0700 syzbot <[email protected]> wrote:
> >
> > > Hello,
> > >
> > > syzbot found the following issue on:
> > >
> > > HEAD commit: 2dac75696c6d Add linux-next specific files for 20231018
> > > git tree: linux-next
> > > console output: https://syzkaller.appspot.com/x/log.txt?x=13858275680000
> > > kernel config: https://syzkaller.appspot.com/x/.config?x=6f8545e1ef7a2b66
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=1e2648076cadf48ad9a1
> > > compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17543ee5680000
> > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=101f5fe5680000
> > >
> > > Downloadable assets:
> > > disk image: https://storage.googleapis.com/syzbot-assets/2375f16ed327/disk-2dac7569.raw.xz
> > > vmlinux: https://storage.googleapis.com/syzbot-assets/c80aee6e2e6c/vmlinux-2dac7569.xz
> > > kernel image: https://storage.googleapis.com/syzbot-assets/664dc23b738d/bzImage-2dac7569.xz
> > >
> > > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > > Reported-by: [email protected]
> >
> > Thanks.
> >
> > > general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASA
> > > KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
> > > CPU: 1 PID: 5710 Comm: syz-executor155 Not tainted 6.6.0-rc6-next-20231018-syzkaller #0
> > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
> > > RIP: 0010:PageTail include/linux/page-flags.h:286 [inline]
> > > RIP: 0010:folio_flags.constprop.0+0x21/0x150 include/linux/page-flags.h:313
> > > Code: 84 00 00 00 00 00 0f 1f 00 41 54 55 53 48 89 fb e8 14 2f a4 ff 48 8d 7b 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 00 01 00 00 48 8b 6b 08 31 ff 83 e5 01 48 89 ee
> > > RSP: 0018:ffffc90004367968 EFLAGS: 00010247
> > > RAX: dffffc0000000000 RBX: fffffffffffffffe RCX: ffffffff81b7e126
> > > RDX: 0000000000000000 RSI: ffffffff81e49d1c RDI: 0000000000000006
> > > RBP: 0000000020200000 R08: 0000000000000005 R09: 0000000000000000
> > > R10: 0000000000000000 R11: 1ffffffff1976fb9 R12: ffff88801675b900
> > > R13: ffff888025f9f680 R14: fffffffffffffffe R15: 1ffff9200086cf3d
> > > FS: 00007f2f2a17c6c0(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
> > > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > > CR2: 00007f2f2a17cd58 CR3: 000000001bfa0000 CR4: 00000000003506f0
> > > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > > Call Trace:
> > > <TASK>
> > > folio_test_head include/linux/page-flags.h:790 [inline]
> > > folio_test_large include/linux/page-flags.h:811 [inline]
> > > folio_order include/linux/mm.h:1079 [inline]
> > > collapse_pte_mapped_thp+0x42d/0x13b0 mm/khugepaged.c:1512
> >
> > Vishal, could you please take a look?
>
> Yes of course. This looks to be caused by filemap_lock_folio()
> returning an ERR_PTR() which wasn't an issue prior as
> find_lock_page()/pagecache_get_page() was checking that
> before returning a page.
>
> #syz test: https://github.com/VMoola/kernel.git
> 34d60af8cb66d6f582c1aeade01689e94e8a0092

Ignore this one, I misinterpreted the syzbot syntax

>
> > > madvise_collapse+0x875/0xaf0 mm/khugepaged.c:2761
> > > madvise_vma_behavior+0x1fe/0x1d00 mm/madvise.c:1086
> > > madvise_walk_vmas+0x1cf/0x2c0 mm/madvise.c:1260
> > > do_madvise+0x333/0x660 mm/madvise.c:1440
> > > __do_sys_madvise mm/madvise.c:1453 [inline]
> > > __se_sys_madvise mm/madvise.c:1451 [inline]
> > > __x64_sys_madvise+0xaa/0x110 mm/madvise.c:1451
> > > do_syscall_x64 arch/x86/entry/common.c:51 [inline]
> > > do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
> > > entry_SYSCALL_64_after_hwframe+0x63/0x6b
> > > RIP: 0033:0x7f2f2a1dc7a9
> > > Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 01 1a 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
> > > RSP: 002b:00007f2f2a17c238 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
> > > RAX: ffffffffffffffda RBX: 00007f2f2a266318 RCX: 00007f2f2a1dc7a9
> > > RDX: 0000000000000019 RSI: 000000000060005f RDI: 0000000020000000
> > > RBP: 00007f2f2a266310 R08: 00007ffe616d77f7 R09: 00007f2f2a17c6c0
> > > R10: 0000000000000000 R11: 0000000000000246 R12: b635773f07ebbeef
> > > R13: 000000000000006e R14: 00007ffe616d7710 R15: 00007ffe616d77f8
> > >
> > > ...
> > >

2023-10-18 22:21:54

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [mm?] [fs?] general protection fault in folio_flags

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: [email protected]

Tested on:

commit: 34d60af8 syz-fix
git tree: https://github.com/VMoola/kernel.git
console output: https://syzkaller.appspot.com/x/log.txt?x=146e70f5680000
kernel config: https://syzkaller.appspot.com/x/.config?x=f4894cf58531f
dashboard link: https://syzkaller.appspot.com/bug?extid=1e2648076cadf48ad9a1
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40

Note: no patches were applied.
Note: testing is done by a robot and is best-effort only.