[syzbot] BUG: unable to handle kernel NULL pointer dereference in shmem_evict_inode

13 views
Skip to first unread message

syzbot

unread,
Nov 16, 2022, 9:54:44 AM11/16/22
to ak...@linux-foundation.org, hu...@google.com, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 1621b6eaebf7 Merge branch 'for-next/fixes' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=14016169880000
kernel config: https://syzkaller.appspot.com/x/.config?x=606e57fd25c5c6cc
dashboard link: https://syzkaller.appspot.com/bug?extid=b90b43fd4c6589e96a39
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1112f7a9880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17c33e69880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/82aa7741098d/disk-1621b6ea.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f6be08c4e4c2/vmlinux-1621b6ea.xz
kernel image: https://storage.googleapis.com/syzbot-assets/296b6946258a/Image-1621b6ea.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+b90b43...@syzkaller.appspotmail.com

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=000000010bfaa000
[0000000000000010] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:

CPU: 1 PID: 3059 Comm: udevd Not tainted 6.1.0-rc4-syzkaller-31872-g1621b6eaebf7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : simple_xattrs_free include/linux/xattr.h:111 [inline]
pc : shmem_evict_inode+0x2d0/0x3d8 mm/shmem.c:1164
lr : simple_xattrs_free include/linux/xattr.h:110 [inline]
lr : shmem_evict_inode+0x2f0/0x3d8 mm/shmem.c:1164
sp : ffff800012c0ba40
x29: ffff800012c0ba90
x28: ffff80000d890000
x27: ffff0000ccf252a0

x26: 00000000000800e0
x25: 0000000000000001 x24: 0000000000000001
x23: ffff0000ccf254c8 x22: ffff0000c0cb6e00 x21: 0000000000000000
x20: 0000000000000000 x19: ffff0000ccf25310 x18: 0000000000000000
x17: 0000000000000000 x16: ffff80000db1a158 x15: ffff0000c64dcec0
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c64dcec0
x11: ff8080000842e558 x10: 0000000000000000 x9 : ffff80000842e558
x8 : ffff0000c64dcec0 x7 : ffff8000085252dc x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : 0000000000000006 x1 : ffff80000cdfe6d9 x0 : ffff8001f1dbd000
Call trace:
simple_xattrs_free include/linux/xattr.h:110 [inline]
shmem_evict_inode+0x2d0/0x3d8 mm/shmem.c:1164
evict+0xec/0x334 fs/inode.c:664
iput_final fs/inode.c:1747 [inline]
iput+0x2c4/0x324 fs/inode.c:1773
dentry_unlink_inode+0x204/0x21c fs/dcache.c:401
__dentry_kill+0x15c/0x37c fs/dcache.c:607
dentry_kill+0x8c/0x194
dput+0x194/0x2e0 fs/dcache.c:913
do_renameat2+0x49c/0x758 fs/namei.c:4931
__do_sys_renameat fs/namei.c:4969 [inline]
__se_sys_renameat fs/namei.c:4966 [inline]
__arm64_sys_renameat+0x64/0x7c fs/namei.c:4966
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:584
Code: 97f9cd15 f84d0f74 eb1b029f 540001a0 (f9400a80)
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
0: 97f9cd15 bl 0xffffffffffe73454
4: f84d0f74 ldr x20, [x27, #208]!
8: eb1b029f cmp x20, x27
c: 540001a0 b.eq 0x40 // b.none
* 10: f9400a80 ldr x0, [x20, #16] <-- trapping instruction


---
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 syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Hillf Danton

unread,
Nov 16, 2022, 8:56:41 PM11/16/22
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On 16 Nov 2022 06:54:43 -0800
> syzbot found the following issue on:
>
> HEAD commit: 1621b6eaebf7 Merge branch 'for-next/fixes' into for-kernelci
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
> console output: https://syzkaller.appspot.com/x/log.txt?x=14016169880000
> kernel config: https://syzkaller.appspot.com/x/.config?x=606e57fd25c5c6cc
> dashboard link: https://syzkaller.appspot.com/bug?extid=b90b43fd4c6589e96a39
See if lock is needed while walking the xattr list.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 1621b6eaebf7

--- x/include/linux/xattr.h
+++ a/include/linux/xattr.h
@@ -106,8 +106,13 @@ static inline void simple_xattrs_init(st
static inline void simple_xattrs_free(struct simple_xattrs *xattrs)
{
struct simple_xattr *xattr, *node;
+ LIST_HEAD(head);

- list_for_each_entry_safe(xattr, node, &xattrs->head, list) {
+ spin_lock(&xattrs->lock);
+ list_splice_init(&xattrs->head, &head);
+ spin_unlock(&xattrs->lock);
+
+ list_for_each_entry_safe(xattr, node, &head, list) {
kfree(xattr->name);
kvfree(xattr);
}
--

syzbot

unread,
Nov 16, 2022, 9:11:17 PM11/16/22
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: corrupted list in __sk_destruct

list_del corruption. next->prev should be ffff0000d3a73b80, but was 0000000000000000. (next=ffff0000d43c9680)
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:64!
Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 3500 Comm: syz-executor.1 Not tainted 6.1.0-rc4-syzkaller-00039-g1621b6eaebf7-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __list_del_entry_valid+0xcc/0xd0 lib/list_debug.c:62
lr : __list_del_entry_valid+0xcc/0xd0 lib/list_debug.c:62
sp : ffff800012d8bb50
x29: ffff800012d8bb50 x28: 00000000002e0003 x27: 0000000000000000
x26: ffff0000cdf283a8 x25: 0000000000000000 x24: 0000000000000001
x23: 0000000000000000 x22: ffff0000cc951cf0 x21: ffff0000d3a73b80
x20: 0000000000000000 x19: ffff0000cc951c90 x18: 00000000000000c0
x17: 20747562202c3038 x16: ffff80000db2a158 x15: ffff0000c7b39a40
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c7b39a40
x11: ff808000081c06c8 x10: 0000000000000000 x9 : 09ff774b4a8bd800
x8 : 09ff774b4a8bd800 x7 : ffff80000c01881c x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : ffff0001fefddcc8 x1 : 0000000100000001 x0 : 000000000000006d
Call trace:
__list_del_entry_valid+0xcc/0xd0 lib/list_debug.c:62
__list_del_entry include/linux/list.h:134 [inline]
list_del include/linux/list.h:148 [inline]
ref_tracker_free+0x188/0x340 lib/ref_tracker.c:146
netns_tracker_free include/net/net_namespace.h:335 [inline]
put_net_track include/net/net_namespace.h:349 [inline]
__sk_destruct+0x27c/0x4e4 net/core/sock.c:2151
sk_destruct net/core/sock.c:2167 [inline]
__sk_free+0x238/0x290 net/core/sock.c:2178
sk_free+0x54/0xbc net/core/sock.c:2189
sock_put include/net/sock.h:1987 [inline]
tcp_close+0x78/0xe0 net/ipv4/tcp.c:3034
inet_release+0xc8/0xe4 net/ipv4/af_inet.c:428
__sock_release net/socket.c:650 [inline]
sock_close+0x50/0xf0 net/socket.c:1365
__fput+0x198/0x3e4 fs/file_table.c:320
____fput+0x20/0x30 fs/file_table.c:348
task_work_run+0x100/0x148 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x174/0x1f0 arch/arm64/kernel/signal.c:1127
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x150 arch/arm64/kernel/entry-common.c:638
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:584
Code: d4210000 d001b140 913ac800 94a82811 (d4210000)
---[ end trace 0000000000000000 ]---


Tested on:

commit: 1621b6ea Merge branch 'for-next/fixes' into for-kernelci
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=165acf59880000
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=10a9080d880000

syzbot

unread,
Jul 25, 2023, 10:39:37 PM7/25/23
to syzkall...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages