[syzbot] [mm?] KMSAN: uninit-value in shrinker_alloc

5 views
Skip to first unread message

syzbot

unread,
Jan 2, 2024, 8:55:21 AMJan 2
to ak...@linux-foundation.org, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d2da77f431ac Merge tag 'parisc-for-6.7-rc3' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16aec608e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=e32016b84cf917ca
dashboard link: https://syzkaller.appspot.com/bug?extid=1e0ed05798af62917464
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1712ebc8e80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/4c6f2e6a124d/disk-d2da77f4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c53690e51338/vmlinux-d2da77f4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c0799b7d74db/bzImage-d2da77f4.xz

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

RBP: 00007f43defc4120 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
R13: 000000000000000b R14: 00007f43de39bf80 R15: 00007f43de4bfa48
</TASK>
=====================================================
BUG: KMSAN: uninit-value in shrinker_unit_free mm/shrinker.c:33 [inline]
BUG: KMSAN: uninit-value in shrinker_unit_alloc mm/shrinker.c:52 [inline]
BUG: KMSAN: uninit-value in expand_one_shrinker_info mm/shrinker.c:136 [inline]
BUG: KMSAN: uninit-value in expand_shrinker_info mm/shrinker.c:165 [inline]
BUG: KMSAN: uninit-value in shrinker_memcg_alloc mm/shrinker.c:227 [inline]
BUG: KMSAN: uninit-value in shrinker_alloc+0xd7c/0x1100 mm/shrinker.c:697
shrinker_unit_free mm/shrinker.c:33 [inline]
shrinker_unit_alloc mm/shrinker.c:52 [inline]
expand_one_shrinker_info mm/shrinker.c:136 [inline]
expand_shrinker_info mm/shrinker.c:165 [inline]
shrinker_memcg_alloc mm/shrinker.c:227 [inline]
shrinker_alloc+0xd7c/0x1100 mm/shrinker.c:697
alloc_super+0x9a6/0xf00 fs/super.c:386
sget_fc+0x36b/0xf80 fs/super.c:797
vfs_get_super fs/super.c:1333 [inline]
get_tree_nodev+0x48/0x340 fs/super.c:1357
mqueue_get_tree+0xff/0x1c0 ipc/mqueue.c:435
vfs_get_tree+0xa5/0x520 fs/super.c:1771
fc_mount+0x33/0x110 fs/namespace.c:1114
mq_create_mount ipc/mqueue.c:485 [inline]
mq_init_ns+0x51c/0x760 ipc/mqueue.c:1700
create_ipc_ns ipc/namespace.c:73 [inline]
copy_ipcs+0x4b3/0xa40 ipc/namespace.c:112
create_new_namespaces+0x3ad/0xdb0 kernel/nsproxy.c:90
unshare_nsproxy_namespaces+0x17a/0x2b0 kernel/nsproxy.c:228
ksys_unshare+0x8fa/0x1340 kernel/fork.c:3433
__do_sys_unshare kernel/fork.c:3504 [inline]
__se_sys_unshare kernel/fork.c:3502 [inline]
__x64_sys_unshare+0x48/0x70 kernel/fork.c:3502
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
entry_SYSCALL_64_after_hwframe+0x63/0x6b

Uninit was created at:
slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768
slab_alloc_node mm/slub.c:3478 [inline]
__kmem_cache_alloc_node+0x5c9/0x970 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1006 [inline]
__kmalloc_node+0x11c/0x3c0 mm/slab_common.c:1014
kmalloc_node include/linux/slab.h:620 [inline]
kvmalloc_node+0xc0/0x2d0 mm/util.c:617
expand_one_shrinker_info mm/shrinker.c:129 [inline]
expand_shrinker_info mm/shrinker.c:165 [inline]
shrinker_memcg_alloc mm/shrinker.c:227 [inline]
shrinker_alloc+0x606/0x1100 mm/shrinker.c:697
alloc_super+0x9a6/0xf00 fs/super.c:386
sget_fc+0x36b/0xf80 fs/super.c:797
vfs_get_super fs/super.c:1333 [inline]
get_tree_nodev+0x48/0x340 fs/super.c:1357
mqueue_get_tree+0xff/0x1c0 ipc/mqueue.c:435
vfs_get_tree+0xa5/0x520 fs/super.c:1771
fc_mount+0x33/0x110 fs/namespace.c:1114
mq_create_mount ipc/mqueue.c:485 [inline]
mq_init_ns+0x51c/0x760 ipc/mqueue.c:1700
create_ipc_ns ipc/namespace.c:73 [inline]
copy_ipcs+0x4b3/0xa40 ipc/namespace.c:112
create_new_namespaces+0x3ad/0xdb0 kernel/nsproxy.c:90
unshare_nsproxy_namespaces+0x17a/0x2b0 kernel/nsproxy.c:228
ksys_unshare+0x8fa/0x1340 kernel/fork.c:3433
__do_sys_unshare kernel/fork.c:3504 [inline]
__se_sys_unshare kernel/fork.c:3502 [inline]
__x64_sys_unshare+0x48/0x70 kernel/fork.c:3502
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
entry_SYSCALL_64_after_hwframe+0x63/0x6b

CPU: 1 PID: 5127 Comm: syz-executor.1 Not tainted 6.7.0-rc2-syzkaller-00265-gd2da77f431ac #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
=====================================================


---
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.

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

Tetsuo Handa

unread,
Jan 2, 2024, 10:46:54 AMJan 2
to syzbot, linu...@kvack.org, syzkall...@googlegroups.com, Andrew Morton, Qi Zheng, Muchun Song
syzbot is reporting uninit-value at shrinker_alloc(), for
commit 307bececcd12 ("mm: shrinker: add a secondary array for
shrinker_info::{map, nr_deferred}") which assumed that the ->unit was
allocated with __GFP_ZERO forgot to replace kvmalloc_node() in
memcg_expand_one_shrinker_map() with kvzalloc_node().

Reported-by: syzbot <syzbot+1e0ed0...@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=1e0ed05798af62917464
Fixes: 307bececcd12 ("mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}")
Signed-off-by: Tetsuo Handa <penguin...@I-love.SAKURA.ne.jp>
---
mm/shrinker.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/shrinker.c b/mm/shrinker.c
index dd91eab43ed3..dc5d2a6fcfc4 100644
--- a/mm/shrinker.c
+++ b/mm/shrinker.c
@@ -126,7 +126,7 @@ static int expand_one_shrinker_info(struct mem_cgroup *memcg, int new_size,
if (new_nr_max <= old->map_nr_max)
continue;

- new = kvmalloc_node(sizeof(*new) + new_size, GFP_KERNEL, nid);
+ new = kvzalloc_node(sizeof(*new) + new_size, GFP_KERNEL, nid);
if (!new)
return -ENOMEM;

--
2.18.4


Reply all
Reply to author
Forward
0 new messages