Use of uninitialized dentry->d_time in kernfs_dop_revalidate()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ian, Miklos,

I've just rebased KMSAN to v5.15-rc2 and am seeing the following
reports at kernel boot-time:

=====================================================
BUG: KMSAN: uninit-value in kernfs_dop_revalidate+0x61f/0x840
fs/kernfs/dir.c:1053
 kernfs_dop_revalidate+0x61f/0x840 fs/kernfs/dir.c:1053
 d_revalidate fs/namei.c:854
 lookup_dcache fs/namei.c:1522
 __lookup_hash+0x3a6/0x590 fs/namei.c:1543
 filename_create+0x312/0x7c0 fs/namei.c:3657
 do_mkdirat+0x103/0x930 fs/namei.c:3900
 __do_sys_mkdir fs/namei.c:3931
 __se_sys_mkdir fs/namei.c:3929
 __x64_sys_mkdir+0xda/0x120 fs/namei.c:3929
 do_syscall_x64 arch/x86/entry/common.c:51

Uninit was created at:
 slab_alloc_node mm/slub.c:3221
 slab_alloc mm/slub.c:3230
 kmem_cache_alloc+0x71f/0x1010 mm/slub.c:3235
 __d_alloc+0x85/0xc60 fs/dcache.c:1744
 d_alloc fs/dcache.c:1823
 d_alloc_parallel+0x12b/0x2210 fs/dcache.c:2575
 __lookup_slow+0x1a8/0x7e0 fs/namei.c:1642
 lookup_slow+0xe0/0x140 fs/namei.c:1674
 walk_component fs/namei.c:1970
 link_path_walk+0x1252/0x18a0 fs/namei.c:2297
 path_openat+0x395/0x5d30 fs/namei.c:3557
 do_filp_open+0x29b/0x6a0 fs/namei.c:3588
 do_sys_openat2+0x261/0x8f0 fs/open.c:1200
 do_sys_open fs/open.c:1216
 __do_sys_open fs/open.c:1224
 __se_sys_open fs/open.c:1220
 __x64_sys_open+0x308/0x370 fs/open.c:1220
 do_syscall_x64 arch/x86/entry/common.c:51
=====================================================

Looks like some code forgets to initialize dentry->d_time before
comparing it to parent->dir.rev in kernfs_dir_changed(). When I change
__d_alloc() to allocate dentry with __GFP_ZERO, the problem goes away.

Could you please take a look?

Thanks,
Alex
-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux