* [syzbot] [overlayfs?] memory leak in ovl_parse_param
@ 2023-11-12 4:18 syzbot
2023-11-12 5:16 ` [syzbot] [PATCH] Test " syzbot
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: syzbot @ 2023-11-12 4:18 UTC (permalink / raw)
To: amir73il, linux-fsdevel, linux-kernel, linux-unionfs, miklos,
syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 13d88ac54ddd Merge tag 'vfs-6.7.fsid' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=121cf047680000
kernel config: https://syzkaller.appspot.com/x/.config?x=ecfdf78a410c834
dashboard link: https://syzkaller.appspot.com/bug?extid=26eedf3631650972f17c
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=15c7a6eb680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13f8b787680000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9bb27a01f17c/disk-13d88ac5.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/fb496feed171/vmlinux-13d88ac5.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f4da22719ffa/bzImage-13d88ac5.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+26eedf3631650972f17c@syzkaller.appspotmail.com
executing program
BUG: memory leak
unreferenced object 0xffff8881009b40a8 (size 8):
comm "syz-executor225", pid 5035, jiffies 4294944336 (age 13.730s)
hex dump (first 8 bytes):
2e 00 00 00 00 00 00 00 ........
backtrace:
[<ffffffff8163331d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
[<ffffffff8163331d>] slab_post_alloc_hook mm/slab.h:766 [inline]
[<ffffffff8163331d>] slab_alloc_node mm/slub.c:3478 [inline]
[<ffffffff8163331d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
[<ffffffff8157e57c>] __do_kmalloc_node mm/slab_common.c:1006 [inline]
[<ffffffff8157e57c>] __kmalloc_node_track_caller+0x4c/0x150 mm/slab_common.c:1027
[<ffffffff8156da4c>] kstrdup+0x3c/0x70 mm/util.c:62
[<ffffffff81d0438a>] ovl_parse_param_lowerdir fs/overlayfs/params.c:496 [inline]
[<ffffffff81d0438a>] ovl_parse_param+0x70a/0xc70 fs/overlayfs/params.c:576
[<ffffffff8170542b>] vfs_parse_fs_param+0xfb/0x190 fs/fs_context.c:146
[<ffffffff81705556>] vfs_parse_fs_string+0x96/0xd0 fs/fs_context.c:188
[<ffffffff8170566f>] vfs_parse_monolithic_sep+0xdf/0x130 fs/fs_context.c:230
[<ffffffff816dff08>] do_new_mount fs/namespace.c:3333 [inline]
[<ffffffff816dff08>] path_mount+0xc48/0x10d0 fs/namespace.c:3664
[<ffffffff816e0b41>] do_mount fs/namespace.c:3677 [inline]
[<ffffffff816e0b41>] __do_sys_mount fs/namespace.c:3886 [inline]
[<ffffffff816e0b41>] __se_sys_mount fs/namespace.c:3863 [inline]
[<ffffffff816e0b41>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3863
[<ffffffff84b67d8f>] do_syscall_x64 arch/x86/entry/common.c:51 [inline]
[<ffffffff84b67d8f>] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0x6b
BUG: memory leak
unreferenced object 0xffff88814002d070 (size 8):
comm "syz-executor225", pid 5036, jiffies 4294944900 (age 8.090s)
hex dump (first 8 bytes):
2e 00 00 00 00 00 00 00 ........
backtrace:
[<ffffffff8163331d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
[<ffffffff8163331d>] slab_post_alloc_hook mm/slab.h:766 [inline]
[<ffffffff8163331d>] slab_alloc_node mm/slub.c:3478 [inline]
[<ffffffff8163331d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
[<ffffffff8157e57c>] __do_kmalloc_node mm/slab_common.c:1006 [inline]
[<ffffffff8157e57c>] __kmalloc_node_track_caller+0x4c/0x150 mm/slab_common.c:1027
[<ffffffff8156da4c>] kstrdup+0x3c/0x70 mm/util.c:62
[<ffffffff81d0438a>] ovl_parse_param_lowerdir fs/overlayfs/params.c:496 [inline]
[<ffffffff81d0438a>] ovl_parse_param+0x70a/0xc70 fs/overlayfs/params.c:576
[<ffffffff8170542b>] vfs_parse_fs_param+0xfb/0x190 fs/fs_context.c:146
[<ffffffff81705556>] vfs_parse_fs_string+0x96/0xd0 fs/fs_context.c:188
[<ffffffff8170566f>] vfs_parse_monolithic_sep+0xdf/0x130 fs/fs_context.c:230
[<ffffffff816dff08>] do_new_mount fs/namespace.c:3333 [inline]
[<ffffffff816dff08>] path_mount+0xc48/0x10d0 fs/namespace.c:3664
[<ffffffff816e0b41>] do_mount fs/namespace.c:3677 [inline]
[<ffffffff816e0b41>] __do_sys_mount fs/namespace.c:3886 [inline]
[<ffffffff816e0b41>] __se_sys_mount fs/namespace.c:3863 [inline]
[<ffffffff816e0b41>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3863
[<ffffffff84b67d8f>] do_syscall_x64 arch/x86/entry/common.c:51 [inline]
[<ffffffff84b67d8f>] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0x6b
---
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 syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, 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 report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [PATCH] Test memory leak in ovl_parse_param
2023-11-12 4:18 [syzbot] [overlayfs?] memory leak in ovl_parse_param syzbot
@ 2023-11-12 5:16 ` syzbot
2023-11-12 9:10 ` [syzbot] [overlayfs?] " Amir Goldstein
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-11-12 5:16 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] Test memory leak in ovl_parse_param
Author: eadavis@qq.com
please test memory leak in ovl_parse_param
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 13d88ac54ddd
diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c
index ddab9ea267d1..735ae0db404a 100644
--- a/fs/overlayfs/params.c
+++ b/fs/overlayfs/params.c
@@ -530,6 +530,7 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc)
return 0;
out_put:
+ ctr->nr = nr;
ovl_reset_lowerdirs(ctx);
out_err:
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [syzbot] [overlayfs?] memory leak in ovl_parse_param
2023-11-12 4:18 [syzbot] [overlayfs?] memory leak in ovl_parse_param syzbot
2023-11-12 5:16 ` [syzbot] [PATCH] Test " syzbot
@ 2023-11-12 9:10 ` Amir Goldstein
2023-11-12 9:21 ` syzbot
2023-11-12 14:36 ` Amir Goldstein
2023-11-12 9:25 ` [syzbot] [PATCH] Test " syzbot
2023-11-12 10:35 ` [PATCH] ovl: fix " Edward Adam Davis
3 siblings, 2 replies; 9+ messages in thread
From: Amir Goldstein @ 2023-11-12 9:10 UTC (permalink / raw)
To: syzbot; +Cc: linux-fsdevel, linux-kernel, linux-unionfs, miklos, syzkaller-bugs
On Sun, Nov 12, 2023 at 6:18 AM syzbot
<syzbot+26eedf3631650972f17c@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 13d88ac54ddd Merge tag 'vfs-6.7.fsid' of git://git.kernel...
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=121cf047680000
> kernel config: https://syzkaller.appspot.com/x/.config?x=ecfdf78a410c834
> dashboard link: https://syzkaller.appspot.com/bug?extid=26eedf3631650972f17c
> 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=15c7a6eb680000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13f8b787680000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/9bb27a01f17c/disk-13d88ac5.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/fb496feed171/vmlinux-13d88ac5.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/f4da22719ffa/bzImage-13d88ac5.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+26eedf3631650972f17c@syzkaller.appspotmail.com
>
> executing program
> BUG: memory leak
> unreferenced object 0xffff8881009b40a8 (size 8):
> comm "syz-executor225", pid 5035, jiffies 4294944336 (age 13.730s)
> hex dump (first 8 bytes):
> 2e 00 00 00 00 00 00 00 ........
> backtrace:
> [<ffffffff8163331d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
> [<ffffffff8163331d>] slab_post_alloc_hook mm/slab.h:766 [inline]
> [<ffffffff8163331d>] slab_alloc_node mm/slub.c:3478 [inline]
> [<ffffffff8163331d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
> [<ffffffff8157e57c>] __do_kmalloc_node mm/slab_common.c:1006 [inline]
> [<ffffffff8157e57c>] __kmalloc_node_track_caller+0x4c/0x150 mm/slab_common.c:1027
> [<ffffffff8156da4c>] kstrdup+0x3c/0x70 mm/util.c:62
> [<ffffffff81d0438a>] ovl_parse_param_lowerdir fs/overlayfs/params.c:496 [inline]
> [<ffffffff81d0438a>] ovl_parse_param+0x70a/0xc70 fs/overlayfs/params.c:576
> [<ffffffff8170542b>] vfs_parse_fs_param+0xfb/0x190 fs/fs_context.c:146
> [<ffffffff81705556>] vfs_parse_fs_string+0x96/0xd0 fs/fs_context.c:188
> [<ffffffff8170566f>] vfs_parse_monolithic_sep+0xdf/0x130 fs/fs_context.c:230
> [<ffffffff816dff08>] do_new_mount fs/namespace.c:3333 [inline]
> [<ffffffff816dff08>] path_mount+0xc48/0x10d0 fs/namespace.c:3664
> [<ffffffff816e0b41>] do_mount fs/namespace.c:3677 [inline]
> [<ffffffff816e0b41>] __do_sys_mount fs/namespace.c:3886 [inline]
> [<ffffffff816e0b41>] __se_sys_mount fs/namespace.c:3863 [inline]
> [<ffffffff816e0b41>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3863
> [<ffffffff84b67d8f>] do_syscall_x64 arch/x86/entry/common.c:51 [inline]
> [<ffffffff84b67d8f>] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
> [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0x6b
>
> BUG: memory leak
> unreferenced object 0xffff88814002d070 (size 8):
> comm "syz-executor225", pid 5036, jiffies 4294944900 (age 8.090s)
> hex dump (first 8 bytes):
> 2e 00 00 00 00 00 00 00 ........
> backtrace:
> [<ffffffff8163331d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
> [<ffffffff8163331d>] slab_post_alloc_hook mm/slab.h:766 [inline]
> [<ffffffff8163331d>] slab_alloc_node mm/slub.c:3478 [inline]
> [<ffffffff8163331d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
> [<ffffffff8157e57c>] __do_kmalloc_node mm/slab_common.c:1006 [inline]
> [<ffffffff8157e57c>] __kmalloc_node_track_caller+0x4c/0x150 mm/slab_common.c:1027
> [<ffffffff8156da4c>] kstrdup+0x3c/0x70 mm/util.c:62
> [<ffffffff81d0438a>] ovl_parse_param_lowerdir fs/overlayfs/params.c:496 [inline]
> [<ffffffff81d0438a>] ovl_parse_param+0x70a/0xc70 fs/overlayfs/params.c:576
> [<ffffffff8170542b>] vfs_parse_fs_param+0xfb/0x190 fs/fs_context.c:146
> [<ffffffff81705556>] vfs_parse_fs_string+0x96/0xd0 fs/fs_context.c:188
> [<ffffffff8170566f>] vfs_parse_monolithic_sep+0xdf/0x130 fs/fs_context.c:230
> [<ffffffff816dff08>] do_new_mount fs/namespace.c:3333 [inline]
> [<ffffffff816dff08>] path_mount+0xc48/0x10d0 fs/namespace.c:3664
> [<ffffffff816e0b41>] do_mount fs/namespace.c:3677 [inline]
> [<ffffffff816e0b41>] __do_sys_mount fs/namespace.c:3886 [inline]
> [<ffffffff816e0b41>] __se_sys_mount fs/namespace.c:3863 [inline]
> [<ffffffff816e0b41>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3863
> [<ffffffff84b67d8f>] do_syscall_x64 arch/x86/entry/common.c:51 [inline]
> [<ffffffff84b67d8f>] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
> [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0x6b
>
>
#syz test: https://github.com/amir73il/linux ovl-fixes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [overlayfs?] memory leak in ovl_parse_param
2023-11-12 9:10 ` [syzbot] [overlayfs?] " Amir Goldstein
@ 2023-11-12 9:21 ` syzbot
2023-11-12 14:36 ` Amir Goldstein
1 sibling, 0 replies; 9+ messages in thread
From: syzbot @ 2023-11-12 9:21 UTC (permalink / raw)
To: amir73il, linux-fsdevel, linux-kernel, linux-unionfs, miklos,
syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
memory leak in ovl_parse_param
BUG: memory leak
unreferenced object 0xffff88814002d0c8 (size 8):
comm "syz-executor.0", pid 5498, jiffies 4294944229 (age 12.660s)
hex dump (first 8 bytes):
2e 00 00 00 00 00 00 00 ........
backtrace:
[<ffffffff8163331d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
[<ffffffff8163331d>] slab_post_alloc_hook mm/slab.h:766 [inline]
[<ffffffff8163331d>] slab_alloc_node mm/slub.c:3478 [inline]
[<ffffffff8163331d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
[<ffffffff8157e57c>] __do_kmalloc_node mm/slab_common.c:1006 [inline]
[<ffffffff8157e57c>] __kmalloc_node_track_caller+0x4c/0x150 mm/slab_common.c:1027
[<ffffffff8156da4c>] kstrdup+0x3c/0x70 mm/util.c:62
[<ffffffff81d0424e>] ovl_parse_param_lowerdir fs/overlayfs/params.c:496 [inline]
[<ffffffff81d0424e>] ovl_parse_param+0x70e/0xc60 fs/overlayfs/params.c:576
[<ffffffff817053ab>] vfs_parse_fs_param+0xfb/0x190 fs/fs_context.c:146
[<ffffffff817054d6>] vfs_parse_fs_string+0x96/0xd0 fs/fs_context.c:188
[<ffffffff817055ef>] vfs_parse_monolithic_sep+0xdf/0x130 fs/fs_context.c:230
[<ffffffff816dfe88>] do_new_mount fs/namespace.c:3333 [inline]
[<ffffffff816dfe88>] path_mount+0xc48/0x10d0 fs/namespace.c:3664
[<ffffffff816e0ac1>] do_mount fs/namespace.c:3677 [inline]
[<ffffffff816e0ac1>] __do_sys_mount fs/namespace.c:3886 [inline]
[<ffffffff816e0ac1>] __se_sys_mount fs/namespace.c:3863 [inline]
[<ffffffff816e0ac1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3863
[<ffffffff84b67d8f>] do_syscall_x64 arch/x86/entry/common.c:51 [inline]
[<ffffffff84b67d8f>] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0x6b
BUG: memory leak
unreferenced object 0xffff8881009ec0c8 (size 8):
comm "syz-executor.0", pid 5752, jiffies 4294944765 (age 7.300s)
hex dump (first 8 bytes):
2e 00 00 00 00 00 00 00 ........
backtrace:
[<ffffffff8163331d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
[<ffffffff8163331d>] slab_post_alloc_hook mm/slab.h:766 [inline]
[<ffffffff8163331d>] slab_alloc_node mm/slub.c:3478 [inline]
[<ffffffff8163331d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
[<ffffffff8157e57c>] __do_kmalloc_node mm/slab_common.c:1006 [inline]
[<ffffffff8157e57c>] __kmalloc_node_track_caller+0x4c/0x150 mm/slab_common.c:1027
[<ffffffff8156da4c>] kstrdup+0x3c/0x70 mm/util.c:62
[<ffffffff81d0424e>] ovl_parse_param_lowerdir fs/overlayfs/params.c:496 [inline]
[<ffffffff81d0424e>] ovl_parse_param+0x70e/0xc60 fs/overlayfs/params.c:576
[<ffffffff817053ab>] vfs_parse_fs_param+0xfb/0x190 fs/fs_context.c:146
[<ffffffff817054d6>] vfs_parse_fs_string+0x96/0xd0 fs/fs_context.c:188
[<ffffffff817055ef>] vfs_parse_monolithic_sep+0xdf/0x130 fs/fs_context.c:230
[<ffffffff816dfe88>] do_new_mount fs/namespace.c:3333 [inline]
[<ffffffff816dfe88>] path_mount+0xc48/0x10d0 fs/namespace.c:3664
[<ffffffff816e0ac1>] do_mount fs/namespace.c:3677 [inline]
[<ffffffff816e0ac1>] __do_sys_mount fs/namespace.c:3886 [inline]
[<ffffffff816e0ac1>] __se_sys_mount fs/namespace.c:3863 [inline]
[<ffffffff816e0ac1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3863
[<ffffffff84b67d8f>] do_syscall_x64 arch/x86/entry/common.c:51 [inline]
[<ffffffff84b67d8f>] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0x6b
BUG: memory leak
unreferenced object 0xffff8881009ec0e0 (size 8):
comm "syz-executor.0", pid 5754, jiffies 4294944766 (age 7.290s)
hex dump (first 8 bytes):
2e 00 00 00 00 00 00 00 ........
backtrace:
[<ffffffff8163331d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
[<ffffffff8163331d>] slab_post_alloc_hook mm/slab.h:766 [inline]
[<ffffffff8163331d>] slab_alloc_node mm/slub.c:3478 [inline]
[<ffffffff8163331d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
[<ffffffff8157e57c>] __do_kmalloc_node mm/slab_common.c:1006 [inline]
[<ffffffff8157e57c>] __kmalloc_node_track_caller+0x4c/0x150 mm/slab_common.c:1027
[<ffffffff8156da4c>] kstrdup+0x3c/0x70 mm/util.c:62
[<ffffffff81d0424e>] ovl_parse_param_lowerdir fs/overlayfs/params.c:496 [inline]
[<ffffffff81d0424e>] ovl_parse_param+0x70e/0xc60 fs/overlayfs/params.c:576
[<ffffffff817053ab>] vfs_parse_fs_param+0xfb/0x190 fs/fs_context.c:146
[<ffffffff817054d6>] vfs_parse_fs_string+0x96/0xd0 fs/fs_context.c:188
[<ffffffff817055ef>] vfs_parse_monolithic_sep+0xdf/0x130 fs/fs_context.c:230
[<ffffffff816dfe88>] do_new_mount fs/namespace.c:3333 [inline]
[<ffffffff816dfe88>] path_mount+0xc48/0x10d0 fs/namespace.c:3664
[<ffffffff816e0ac1>] do_mount fs/namespace.c:3677 [inline]
[<ffffffff816e0ac1>] __do_sys_mount fs/namespace.c:3886 [inline]
[<ffffffff816e0ac1>] __se_sys_mount fs/namespace.c:3863 [inline]
[<ffffffff816e0ac1>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3863
[<ffffffff84b67d8f>] do_syscall_x64 arch/x86/entry/common.c:51 [inline]
[<ffffffff84b67d8f>] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
[<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0x6b
Tested on:
commit: 3f653af2 ovl: fix memory leak in ovl_parse_param()
git tree: https://github.com/amir73il/linux ovl-fixes
console output: https://syzkaller.appspot.com/x/log.txt?x=13a07ea7680000
kernel config: https://syzkaller.appspot.com/x/.config?x=ecfdf78a410c834
dashboard link: https://syzkaller.appspot.com/bug?extid=26eedf3631650972f17c
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
Note: no patches were applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [PATCH] Test memory leak in ovl_parse_param
2023-11-12 4:18 [syzbot] [overlayfs?] memory leak in ovl_parse_param syzbot
2023-11-12 5:16 ` [syzbot] [PATCH] Test " syzbot
2023-11-12 9:10 ` [syzbot] [overlayfs?] " Amir Goldstein
@ 2023-11-12 9:25 ` syzbot
2023-11-12 10:35 ` [PATCH] ovl: fix " Edward Adam Davis
3 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-11-12 9:25 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] Test memory leak in ovl_parse_param
Author: eadavis@qq.com
please test memory leak in ovl_parse_param
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 13d88ac54ddd
diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c
index ddab9ea267d1..735ae0db404a 100644
--- a/fs/overlayfs/params.c
+++ b/fs/overlayfs/params.c
@@ -530,6 +530,7 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc)
return 0;
out_put:
+ ctx->nr = nr;
ovl_reset_lowerdirs(ctx);
out_err:
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] ovl: fix memory leak in ovl_parse_param
2023-11-12 4:18 [syzbot] [overlayfs?] memory leak in ovl_parse_param syzbot
` (2 preceding siblings ...)
2023-11-12 9:25 ` [syzbot] [PATCH] Test " syzbot
@ 2023-11-12 10:35 ` Edward Adam Davis
2023-11-12 14:36 ` Amir Goldstein
3 siblings, 1 reply; 9+ messages in thread
From: Edward Adam Davis @ 2023-11-12 10:35 UTC (permalink / raw)
To: syzbot+26eedf3631650972f17c
Cc: amir73il, linux-fsdevel, linux-kernel, linux-unionfs, miklos,
syzkaller-bugs
After failing to parse parameters in ovl_parse_param_lowerdir(), it is
necessary to update ctx->nr with the correct nr before using
ovl_reset_lowerdirs() to release l->name.
Reported-and-tested-by: syzbot+26eedf3631650972f17c@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
fs/overlayfs/params.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c
index ddab9ea267d1..1f73f0173015 100644
--- a/fs/overlayfs/params.c
+++ b/fs/overlayfs/params.c
@@ -530,6 +530,7 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc)
return 0;
out_put:
+ ctx->nr = nr;
ovl_reset_lowerdirs(ctx);
out_err:
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] ovl: fix memory leak in ovl_parse_param
2023-11-12 10:35 ` [PATCH] ovl: fix " Edward Adam Davis
@ 2023-11-12 14:36 ` Amir Goldstein
0 siblings, 0 replies; 9+ messages in thread
From: Amir Goldstein @ 2023-11-12 14:36 UTC (permalink / raw)
To: Edward Adam Davis
Cc: syzbot+26eedf3631650972f17c, linux-fsdevel, linux-kernel,
linux-unionfs, miklos, syzkaller-bugs
On Sun, Nov 12, 2023 at 12:35 PM Edward Adam Davis <eadavis@qq.com> wrote:
>
> After failing to parse parameters in ovl_parse_param_lowerdir(), it is
> necessary to update ctx->nr with the correct nr before using
> ovl_reset_lowerdirs() to release l->name.
>
> Reported-and-tested-by: syzbot+26eedf3631650972f17c@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
> fs/overlayfs/params.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c
> index ddab9ea267d1..1f73f0173015 100644
> --- a/fs/overlayfs/params.c
> +++ b/fs/overlayfs/params.c
> @@ -530,6 +530,7 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc)
> return 0;
>
> out_put:
> + ctx->nr = nr;
> ovl_reset_lowerdirs(ctx);
>
> out_err:
> --
> 2.25.1
>
Thanks for the patch!
I prefer to fix it by eliminating the local vars instead of
syncing with them:
I've kept your commit message and tagged you as Co-authored-by:
https://github.com/amir73il/linux/commit/97d58994e880ccb19e1b9b935928538903fca41c
Thanks,
Amir.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [overlayfs?] memory leak in ovl_parse_param
2023-11-12 9:10 ` [syzbot] [overlayfs?] " Amir Goldstein
2023-11-12 9:21 ` syzbot
@ 2023-11-12 14:36 ` Amir Goldstein
2023-11-12 15:09 ` syzbot
1 sibling, 1 reply; 9+ messages in thread
From: Amir Goldstein @ 2023-11-12 14:36 UTC (permalink / raw)
To: syzbot; +Cc: linux-fsdevel, linux-kernel, linux-unionfs, miklos, syzkaller-bugs
On Sun, Nov 12, 2023 at 11:10 AM Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Sun, Nov 12, 2023 at 6:18 AM syzbot
> <syzbot+26eedf3631650972f17c@syzkaller.appspotmail.com> wrote:
> >
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: 13d88ac54ddd Merge tag 'vfs-6.7.fsid' of git://git.kernel...
> > git tree: upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=121cf047680000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=ecfdf78a410c834
> > dashboard link: https://syzkaller.appspot.com/bug?extid=26eedf3631650972f17c
> > 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=15c7a6eb680000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13f8b787680000
> >
> > Downloadable assets:
> > disk image: https://storage.googleapis.com/syzbot-assets/9bb27a01f17c/disk-13d88ac5.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/fb496feed171/vmlinux-13d88ac5.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/f4da22719ffa/bzImage-13d88ac5.xz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+26eedf3631650972f17c@syzkaller.appspotmail.com
> >
> > executing program
> > BUG: memory leak
> > unreferenced object 0xffff8881009b40a8 (size 8):
> > comm "syz-executor225", pid 5035, jiffies 4294944336 (age 13.730s)
> > hex dump (first 8 bytes):
> > 2e 00 00 00 00 00 00 00 ........
> > backtrace:
> > [<ffffffff8163331d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
> > [<ffffffff8163331d>] slab_post_alloc_hook mm/slab.h:766 [inline]
> > [<ffffffff8163331d>] slab_alloc_node mm/slub.c:3478 [inline]
> > [<ffffffff8163331d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
> > [<ffffffff8157e57c>] __do_kmalloc_node mm/slab_common.c:1006 [inline]
> > [<ffffffff8157e57c>] __kmalloc_node_track_caller+0x4c/0x150 mm/slab_common.c:1027
> > [<ffffffff8156da4c>] kstrdup+0x3c/0x70 mm/util.c:62
> > [<ffffffff81d0438a>] ovl_parse_param_lowerdir fs/overlayfs/params.c:496 [inline]
> > [<ffffffff81d0438a>] ovl_parse_param+0x70a/0xc70 fs/overlayfs/params.c:576
> > [<ffffffff8170542b>] vfs_parse_fs_param+0xfb/0x190 fs/fs_context.c:146
> > [<ffffffff81705556>] vfs_parse_fs_string+0x96/0xd0 fs/fs_context.c:188
> > [<ffffffff8170566f>] vfs_parse_monolithic_sep+0xdf/0x130 fs/fs_context.c:230
> > [<ffffffff816dff08>] do_new_mount fs/namespace.c:3333 [inline]
> > [<ffffffff816dff08>] path_mount+0xc48/0x10d0 fs/namespace.c:3664
> > [<ffffffff816e0b41>] do_mount fs/namespace.c:3677 [inline]
> > [<ffffffff816e0b41>] __do_sys_mount fs/namespace.c:3886 [inline]
> > [<ffffffff816e0b41>] __se_sys_mount fs/namespace.c:3863 [inline]
> > [<ffffffff816e0b41>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3863
> > [<ffffffff84b67d8f>] do_syscall_x64 arch/x86/entry/common.c:51 [inline]
> > [<ffffffff84b67d8f>] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
> > [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0x6b
> >
> > BUG: memory leak
> > unreferenced object 0xffff88814002d070 (size 8):
> > comm "syz-executor225", pid 5036, jiffies 4294944900 (age 8.090s)
> > hex dump (first 8 bytes):
> > 2e 00 00 00 00 00 00 00 ........
> > backtrace:
> > [<ffffffff8163331d>] kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
> > [<ffffffff8163331d>] slab_post_alloc_hook mm/slab.h:766 [inline]
> > [<ffffffff8163331d>] slab_alloc_node mm/slub.c:3478 [inline]
> > [<ffffffff8163331d>] __kmem_cache_alloc_node+0x2dd/0x3f0 mm/slub.c:3517
> > [<ffffffff8157e57c>] __do_kmalloc_node mm/slab_common.c:1006 [inline]
> > [<ffffffff8157e57c>] __kmalloc_node_track_caller+0x4c/0x150 mm/slab_common.c:1027
> > [<ffffffff8156da4c>] kstrdup+0x3c/0x70 mm/util.c:62
> > [<ffffffff81d0438a>] ovl_parse_param_lowerdir fs/overlayfs/params.c:496 [inline]
> > [<ffffffff81d0438a>] ovl_parse_param+0x70a/0xc70 fs/overlayfs/params.c:576
> > [<ffffffff8170542b>] vfs_parse_fs_param+0xfb/0x190 fs/fs_context.c:146
> > [<ffffffff81705556>] vfs_parse_fs_string+0x96/0xd0 fs/fs_context.c:188
> > [<ffffffff8170566f>] vfs_parse_monolithic_sep+0xdf/0x130 fs/fs_context.c:230
> > [<ffffffff816dff08>] do_new_mount fs/namespace.c:3333 [inline]
> > [<ffffffff816dff08>] path_mount+0xc48/0x10d0 fs/namespace.c:3664
> > [<ffffffff816e0b41>] do_mount fs/namespace.c:3677 [inline]
> > [<ffffffff816e0b41>] __do_sys_mount fs/namespace.c:3886 [inline]
> > [<ffffffff816e0b41>] __se_sys_mount fs/namespace.c:3863 [inline]
> > [<ffffffff816e0b41>] __x64_sys_mount+0x1a1/0x1f0 fs/namespace.c:3863
> > [<ffffffff84b67d8f>] do_syscall_x64 arch/x86/entry/common.c:51 [inline]
> > [<ffffffff84b67d8f>] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82
> > [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0x6b
> >
> >
>
> #syz test: https://github.com/amir73il/linux ovl-fixes
Please test take #2:
#syz test: https://github.com/amir73il/linux ovl-fixes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [overlayfs?] memory leak in ovl_parse_param
2023-11-12 14:36 ` Amir Goldstein
@ 2023-11-12 15:09 ` syzbot
0 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-11-12 15:09 UTC (permalink / raw)
To: amir73il, linux-fsdevel, linux-kernel, linux-unionfs, miklos,
syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+26eedf3631650972f17c@syzkaller.appspotmail.com
Tested on:
commit: 97d58994 ovl: fix memory leak in ovl_parse_param()
git tree: https://github.com/amir73il/linux ovl-fixes
console output: https://syzkaller.appspot.com/x/log.txt?x=12394b97680000
kernel config: https://syzkaller.appspot.com/x/.config?x=ecfdf78a410c834
dashboard link: https://syzkaller.appspot.com/bug?extid=26eedf3631650972f17c
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-11-12 15:09 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-12 4:18 [syzbot] [overlayfs?] memory leak in ovl_parse_param syzbot
2023-11-12 5:16 ` [syzbot] [PATCH] Test " syzbot
2023-11-12 9:10 ` [syzbot] [overlayfs?] " Amir Goldstein
2023-11-12 9:21 ` syzbot
2023-11-12 14:36 ` Amir Goldstein
2023-11-12 15:09 ` syzbot
2023-11-12 9:25 ` [syzbot] [PATCH] Test " syzbot
2023-11-12 10:35 ` [PATCH] ovl: fix " Edward Adam Davis
2023-11-12 14:36 ` Amir Goldstein
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.