* [syzbot] [lsm?] [integrity?] KMSAN: uninit-value in ima_add_template_entry (3)
@ 2025-05-14 14:54 syzbot
2025-05-15 14:06 ` Roberto Sassu
0 siblings, 1 reply; 8+ messages in thread
From: syzbot @ 2025-05-14 14:54 UTC (permalink / raw)
To: dmitry.kasatkin, eric.snowberg, jmorris, linux-integrity,
linux-kernel, linux-security-module, paul, roberto.sassu, serge,
syzkaller-bugs, zohar
Hello,
syzbot found the following issue on:
HEAD commit: 02ddfb981de8 Merge tag 'scsi-fixes' of git://git.kernel.or..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11169670580000
kernel config: https://syzkaller.appspot.com/x/.config?x=9dc42c34a3f5c357
dashboard link: https://syzkaller.appspot.com/bug?extid=3f0b3970f154dfc95e6e
compiler: Debian clang version 20.1.2 (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97), Debian LLD 20.1.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1574d768580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5ca57f5a3f77/disk-02ddfb98.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3f23cbc11e68/vmlinux-02ddfb98.xz
kernel image: https://storage.googleapis.com/syzbot-assets/73e63afac354/bzImage-02ddfb98.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/0afd18737aed/mount_2.gz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3f0b3970f154dfc95e6e@syzkaller.appspotmail.com
bcachefs (loop2): going read-write
bcachefs (loop2): done starting filesystem
=====================================================
BUG: KMSAN: uninit-value in ima_lookup_digest_entry security/integrity/ima/ima_queue.c:64 [inline]
BUG: KMSAN: uninit-value in ima_add_template_entry+0x7a5/0x8d0 security/integrity/ima/ima_queue.c:191
ima_lookup_digest_entry security/integrity/ima/ima_queue.c:64 [inline]
ima_add_template_entry+0x7a5/0x8d0 security/integrity/ima/ima_queue.c:191
ima_store_template security/integrity/ima/ima_api.c:122 [inline]
ima_store_measurement+0x388/0x970 security/integrity/ima/ima_api.c:383
process_measurement+0x3075/0x40e0 security/integrity/ima/ima_main.c:393
ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
security_file_post_open+0xbf/0x530 security/security.c:3130
do_open fs/namei.c:3882 [inline]
path_openat+0x5ac3/0x6760 fs/namei.c:4039
do_filp_open+0x280/0x660 fs/namei.c:4066
do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x240/0x300 fs/open.c:1455
x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
<Zero or more stacks not recorded to save memory>
Uninit was stored to memory at:
sha256_transform lib/crypto/sha256.c:117 [inline]
sha256_transform_blocks+0x276d/0x2880 lib/crypto/sha256.c:127
lib_sha256_base_do_finalize include/crypto/sha256_base.h:101 [inline]
__sha256_final lib/crypto/sha256.c:142 [inline]
sha256_final+0x169/0x460 lib/crypto/sha256.c:148
crypto_sha256_final+0xca/0x120 crypto/sha256_generic.c:49
crypto_shash_final+0x72/0xa0 crypto/shash.c:58
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:498 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
ima_calc_file_hash+0x240a/0x3fd0 security/integrity/ima/ima_crypto.c:568
ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
security_file_post_open+0xbf/0x530 security/security.c:3130
do_open fs/namei.c:3882 [inline]
path_openat+0x5ac3/0x6760 fs/namei.c:4039
do_filp_open+0x280/0x660 fs/namei.c:4066
do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x240/0x300 fs/open.c:1455
x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was stored to memory at:
sha256_transform lib/crypto/sha256.c:117 [inline]
sha256_transform_blocks+0x276d/0x2880 lib/crypto/sha256.c:127
lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
sha256_update+0x392/0x410 lib/crypto/sha256.c:136
crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
security_file_post_open+0xbf/0x530 security/security.c:3130
do_open fs/namei.c:3882 [inline]
path_openat+0x5ac3/0x6760 fs/namei.c:4039
do_filp_open+0x280/0x660 fs/namei.c:4066
do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x240/0x300 fs/open.c:1455
x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was stored to memory at:
BLEND_OP lib/crypto/sha256.c:61 [inline]
sha256_transform lib/crypto/sha256.c:91 [inline]
sha256_transform_blocks+0xded/0x2880 lib/crypto/sha256.c:127
lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
sha256_update+0x392/0x410 lib/crypto/sha256.c:136
crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
security_file_post_open+0xbf/0x530 security/security.c:3130
do_open fs/namei.c:3882 [inline]
path_openat+0x5ac3/0x6760 fs/namei.c:4039
do_filp_open+0x280/0x660 fs/namei.c:4066
do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x240/0x300 fs/open.c:1455
x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was stored to memory at:
BLEND_OP lib/crypto/sha256.c:61 [inline]
sha256_transform lib/crypto/sha256.c:92 [inline]
sha256_transform_blocks+0xe00/0x2880 lib/crypto/sha256.c:127
lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
sha256_update+0x392/0x410 lib/crypto/sha256.c:136
crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
security_file_post_open+0xbf/0x530 security/security.c:3130
do_open fs/namei.c:3882 [inline]
path_openat+0x5ac3/0x6760 fs/namei.c:4039
do_filp_open+0x280/0x660 fs/namei.c:4066
do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x240/0x300 fs/open.c:1455
x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was stored to memory at:
BLEND_OP lib/crypto/sha256.c:61 [inline]
sha256_transform lib/crypto/sha256.c:93 [inline]
sha256_transform_blocks+0xe15/0x2880 lib/crypto/sha256.c:127
lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
sha256_update+0x392/0x410 lib/crypto/sha256.c:136
crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
security_file_post_open+0xbf/0x530 security/security.c:3130
do_open fs/namei.c:3882 [inline]
path_openat+0x5ac3/0x6760 fs/namei.c:4039
do_filp_open+0x280/0x660 fs/namei.c:4066
do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x240/0x300 fs/open.c:1455
x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was stored to memory at:
LOAD_OP lib/crypto/sha256.c:56 [inline]
sha256_transform lib/crypto/sha256.c:82 [inline]
sha256_transform_blocks+0x268b/0x2880 lib/crypto/sha256.c:127
lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
sha256_update+0x392/0x410 lib/crypto/sha256.c:136
crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
security_file_post_open+0xbf/0x530 security/security.c:3130
do_open fs/namei.c:3882 [inline]
path_openat+0x5ac3/0x6760 fs/namei.c:4039
do_filp_open+0x280/0x660 fs/namei.c:4066
do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x240/0x300 fs/open.c:1455
x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was stored to memory at:
memcpy_to_iter lib/iov_iter.c:65 [inline]
iterate_kvec include/linux/iov_iter.h:86 [inline]
iterate_and_advance2 include/linux/iov_iter.h:306 [inline]
iterate_and_advance include/linux/iov_iter.h:328 [inline]
_copy_to_iter+0x176c/0x32f0 lib/iov_iter.c:185
copy_page_to_iter+0x43c/0x8b0 lib/iov_iter.c:362
copy_folio_to_iter include/linux/uio.h:198 [inline]
filemap_read+0xced/0x2190 mm/filemap.c:2753
bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
__kernel_read+0x750/0xda0 fs/read_write.c:528
integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
ima_calc_file_hash+0x1ff9/0x3fd0 security/integrity/ima/ima_crypto.c:568
ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
security_file_post_open+0xbf/0x530 security/security.c:3130
do_open fs/namei.c:3882 [inline]
path_openat+0x5ac3/0x6760 fs/namei.c:4039
do_filp_open+0x280/0x660 fs/namei.c:4066
do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x240/0x300 fs/open.c:1455
x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
__alloc_frozen_pages_noprof+0x689/0xf00 mm/page_alloc.c:4993
alloc_pages_mpol+0x328/0x860 mm/mempolicy.c:2301
alloc_frozen_pages_noprof mm/mempolicy.c:2372 [inline]
alloc_pages_noprof mm/mempolicy.c:2392 [inline]
folio_alloc_noprof+0x109/0x360 mm/mempolicy.c:2402
filemap_alloc_folio_noprof+0x9d/0x420 mm/filemap.c:1007
ractl_alloc_folio mm/readahead.c:186 [inline]
ra_alloc_folio mm/readahead.c:441 [inline]
page_cache_ra_order+0x93f/0x14f0 mm/readahead.c:509
page_cache_sync_ra+0x108a/0x13e0 mm/readahead.c:621
filemap_get_pages+0xfb3/0x3a70 mm/filemap.c:2591
filemap_read+0x5c6/0x2190 mm/filemap.c:2702
bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
__kernel_read+0x750/0xda0 fs/read_write.c:528
integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
ima_calc_file_hash+0x1ff9/0x3fd0 security/integrity/ima/ima_crypto.c:568
ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
security_file_post_open+0xbf/0x530 security/security.c:3130
do_open fs/namei.c:3882 [inline]
path_openat+0x5ac3/0x6760 fs/namei.c:4039
do_filp_open+0x280/0x660 fs/namei.c:4066
do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x240/0x300 fs/open.c:1455
x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
CPU: 0 UID: 0 PID: 7337 Comm: syz.2.106 Not tainted 6.15.0-rc3-syzkaller-00094-g02ddfb981de8 #0 PREEMPT(undef)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
=====================================================
---
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] 8+ messages in thread
* Re: [syzbot] [lsm?] [integrity?] KMSAN: uninit-value in ima_add_template_entry (3)
2025-05-14 14:54 [syzbot] [lsm?] [integrity?] KMSAN: uninit-value in ima_add_template_entry (3) syzbot
@ 2025-05-15 14:06 ` Roberto Sassu
2025-05-15 14:18 ` Kent Overstreet
0 siblings, 1 reply; 8+ messages in thread
From: Roberto Sassu @ 2025-05-15 14:06 UTC (permalink / raw)
To: syzbot, dmitry.kasatkin, eric.snowberg, jmorris, linux-integrity,
linux-kernel, linux-security-module, paul, roberto.sassu, serge,
syzkaller-bugs, zohar, kent.overstreet, linux-bcachefs
On Wed, 2025-05-14 at 07:54 -0700, syzbot wrote:
> Hello,
+ Kent, bcachefs mailing list
I have the feeling that this was recently fixed in one of the latest
pull requests in bcachefs. I don't see it occurring anymore, and there
are more commits after the one reported by syzbot.
Roberto
> syzbot found the following issue on:
>
> HEAD commit: 02ddfb981de8 Merge tag 'scsi-fixes' of git://git.kernel.or..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=11169670580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=9dc42c34a3f5c357
> dashboard link: https://syzkaller.appspot.com/bug?extid=3f0b3970f154dfc95e6e
> compiler: Debian clang version 20.1.2 (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97), Debian LLD 20.1.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1574d768580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/5ca57f5a3f77/disk-02ddfb98.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/3f23cbc11e68/vmlinux-02ddfb98.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/73e63afac354/bzImage-02ddfb98.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/0afd18737aed/mount_2.gz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+3f0b3970f154dfc95e6e@syzkaller.appspotmail.com
>
> bcachefs (loop2): going read-write
> bcachefs (loop2): done starting filesystem
> =====================================================
> BUG: KMSAN: uninit-value in ima_lookup_digest_entry security/integrity/ima/ima_queue.c:64 [inline]
> BUG: KMSAN: uninit-value in ima_add_template_entry+0x7a5/0x8d0 security/integrity/ima/ima_queue.c:191
> ima_lookup_digest_entry security/integrity/ima/ima_queue.c:64 [inline]
> ima_add_template_entry+0x7a5/0x8d0 security/integrity/ima/ima_queue.c:191
> ima_store_template security/integrity/ima/ima_api.c:122 [inline]
> ima_store_measurement+0x388/0x970 security/integrity/ima/ima_api.c:383
> process_measurement+0x3075/0x40e0 security/integrity/ima/ima_main.c:393
> ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> security_file_post_open+0xbf/0x530 security/security.c:3130
> do_open fs/namei.c:3882 [inline]
> path_openat+0x5ac3/0x6760 fs/namei.c:4039
> do_filp_open+0x280/0x660 fs/namei.c:4066
> do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> do_sys_open fs/open.c:1444 [inline]
> __do_sys_openat fs/open.c:1460 [inline]
> __se_sys_openat fs/open.c:1455 [inline]
> __x64_sys_openat+0x240/0x300 fs/open.c:1455
> x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> <Zero or more stacks not recorded to save memory>
>
> Uninit was stored to memory at:
> sha256_transform lib/crypto/sha256.c:117 [inline]
> sha256_transform_blocks+0x276d/0x2880 lib/crypto/sha256.c:127
> lib_sha256_base_do_finalize include/crypto/sha256_base.h:101 [inline]
> __sha256_final lib/crypto/sha256.c:142 [inline]
> sha256_final+0x169/0x460 lib/crypto/sha256.c:148
> crypto_sha256_final+0xca/0x120 crypto/sha256_generic.c:49
> crypto_shash_final+0x72/0xa0 crypto/shash.c:58
> ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:498 [inline]
> ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> ima_calc_file_hash+0x240a/0x3fd0 security/integrity/ima/ima_crypto.c:568
> ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> security_file_post_open+0xbf/0x530 security/security.c:3130
> do_open fs/namei.c:3882 [inline]
> path_openat+0x5ac3/0x6760 fs/namei.c:4039
> do_filp_open+0x280/0x660 fs/namei.c:4066
> do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> do_sys_open fs/open.c:1444 [inline]
> __do_sys_openat fs/open.c:1460 [inline]
> __se_sys_openat fs/open.c:1455 [inline]
> __x64_sys_openat+0x240/0x300 fs/open.c:1455
> x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
> sha256_transform lib/crypto/sha256.c:117 [inline]
> sha256_transform_blocks+0x276d/0x2880 lib/crypto/sha256.c:127
> lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> security_file_post_open+0xbf/0x530 security/security.c:3130
> do_open fs/namei.c:3882 [inline]
> path_openat+0x5ac3/0x6760 fs/namei.c:4039
> do_filp_open+0x280/0x660 fs/namei.c:4066
> do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> do_sys_open fs/open.c:1444 [inline]
> __do_sys_openat fs/open.c:1460 [inline]
> __se_sys_openat fs/open.c:1455 [inline]
> __x64_sys_openat+0x240/0x300 fs/open.c:1455
> x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
> BLEND_OP lib/crypto/sha256.c:61 [inline]
> sha256_transform lib/crypto/sha256.c:91 [inline]
> sha256_transform_blocks+0xded/0x2880 lib/crypto/sha256.c:127
> lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> security_file_post_open+0xbf/0x530 security/security.c:3130
> do_open fs/namei.c:3882 [inline]
> path_openat+0x5ac3/0x6760 fs/namei.c:4039
> do_filp_open+0x280/0x660 fs/namei.c:4066
> do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> do_sys_open fs/open.c:1444 [inline]
> __do_sys_openat fs/open.c:1460 [inline]
> __se_sys_openat fs/open.c:1455 [inline]
> __x64_sys_openat+0x240/0x300 fs/open.c:1455
> x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
> BLEND_OP lib/crypto/sha256.c:61 [inline]
> sha256_transform lib/crypto/sha256.c:92 [inline]
> sha256_transform_blocks+0xe00/0x2880 lib/crypto/sha256.c:127
> lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> security_file_post_open+0xbf/0x530 security/security.c:3130
> do_open fs/namei.c:3882 [inline]
> path_openat+0x5ac3/0x6760 fs/namei.c:4039
> do_filp_open+0x280/0x660 fs/namei.c:4066
> do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> do_sys_open fs/open.c:1444 [inline]
> __do_sys_openat fs/open.c:1460 [inline]
> __se_sys_openat fs/open.c:1455 [inline]
> __x64_sys_openat+0x240/0x300 fs/open.c:1455
> x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
> BLEND_OP lib/crypto/sha256.c:61 [inline]
> sha256_transform lib/crypto/sha256.c:93 [inline]
> sha256_transform_blocks+0xe15/0x2880 lib/crypto/sha256.c:127
> lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> security_file_post_open+0xbf/0x530 security/security.c:3130
> do_open fs/namei.c:3882 [inline]
> path_openat+0x5ac3/0x6760 fs/namei.c:4039
> do_filp_open+0x280/0x660 fs/namei.c:4066
> do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> do_sys_open fs/open.c:1444 [inline]
> __do_sys_openat fs/open.c:1460 [inline]
> __se_sys_openat fs/open.c:1455 [inline]
> __x64_sys_openat+0x240/0x300 fs/open.c:1455
> x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
> LOAD_OP lib/crypto/sha256.c:56 [inline]
> sha256_transform lib/crypto/sha256.c:82 [inline]
> sha256_transform_blocks+0x268b/0x2880 lib/crypto/sha256.c:127
> lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> security_file_post_open+0xbf/0x530 security/security.c:3130
> do_open fs/namei.c:3882 [inline]
> path_openat+0x5ac3/0x6760 fs/namei.c:4039
> do_filp_open+0x280/0x660 fs/namei.c:4066
> do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> do_sys_open fs/open.c:1444 [inline]
> __do_sys_openat fs/open.c:1460 [inline]
> __se_sys_openat fs/open.c:1455 [inline]
> __x64_sys_openat+0x240/0x300 fs/open.c:1455
> x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was stored to memory at:
> memcpy_to_iter lib/iov_iter.c:65 [inline]
> iterate_kvec include/linux/iov_iter.h:86 [inline]
> iterate_and_advance2 include/linux/iov_iter.h:306 [inline]
> iterate_and_advance include/linux/iov_iter.h:328 [inline]
> _copy_to_iter+0x176c/0x32f0 lib/iov_iter.c:185
> copy_page_to_iter+0x43c/0x8b0 lib/iov_iter.c:362
> copy_folio_to_iter include/linux/uio.h:198 [inline]
> filemap_read+0xced/0x2190 mm/filemap.c:2753
> bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
> __kernel_read+0x750/0xda0 fs/read_write.c:528
> integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
> ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline]
> ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> ima_calc_file_hash+0x1ff9/0x3fd0 security/integrity/ima/ima_crypto.c:568
> ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> security_file_post_open+0xbf/0x530 security/security.c:3130
> do_open fs/namei.c:3882 [inline]
> path_openat+0x5ac3/0x6760 fs/namei.c:4039
> do_filp_open+0x280/0x660 fs/namei.c:4066
> do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> do_sys_open fs/open.c:1444 [inline]
> __do_sys_openat fs/open.c:1460 [inline]
> __se_sys_openat fs/open.c:1455 [inline]
> __x64_sys_openat+0x240/0x300 fs/open.c:1455
> x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Uninit was created at:
> __alloc_frozen_pages_noprof+0x689/0xf00 mm/page_alloc.c:4993
> alloc_pages_mpol+0x328/0x860 mm/mempolicy.c:2301
> alloc_frozen_pages_noprof mm/mempolicy.c:2372 [inline]
> alloc_pages_noprof mm/mempolicy.c:2392 [inline]
> folio_alloc_noprof+0x109/0x360 mm/mempolicy.c:2402
> filemap_alloc_folio_noprof+0x9d/0x420 mm/filemap.c:1007
> ractl_alloc_folio mm/readahead.c:186 [inline]
> ra_alloc_folio mm/readahead.c:441 [inline]
> page_cache_ra_order+0x93f/0x14f0 mm/readahead.c:509
> page_cache_sync_ra+0x108a/0x13e0 mm/readahead.c:621
> filemap_get_pages+0xfb3/0x3a70 mm/filemap.c:2591
> filemap_read+0x5c6/0x2190 mm/filemap.c:2702
> bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
> __kernel_read+0x750/0xda0 fs/read_write.c:528
> integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
> ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline]
> ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> ima_calc_file_hash+0x1ff9/0x3fd0 security/integrity/ima/ima_crypto.c:568
> ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> security_file_post_open+0xbf/0x530 security/security.c:3130
> do_open fs/namei.c:3882 [inline]
> path_openat+0x5ac3/0x6760 fs/namei.c:4039
> do_filp_open+0x280/0x660 fs/namei.c:4066
> do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> do_sys_open fs/open.c:1444 [inline]
> __do_sys_openat fs/open.c:1460 [inline]
> __se_sys_openat fs/open.c:1455 [inline]
> __x64_sys_openat+0x240/0x300 fs/open.c:1455
> x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> CPU: 0 UID: 0 PID: 7337 Comm: syz.2.106 Not tainted 6.15.0-rc3-syzkaller-00094-g02ddfb981de8 #0 PREEMPT(undef)
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
> =====================================================
>
>
> ---
> 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] 8+ messages in thread
* Re: [syzbot] [lsm?] [integrity?] KMSAN: uninit-value in ima_add_template_entry (3)
2025-05-15 14:06 ` Roberto Sassu
@ 2025-05-15 14:18 ` Kent Overstreet
2025-05-15 14:30 ` Roberto Sassu
0 siblings, 1 reply; 8+ messages in thread
From: Kent Overstreet @ 2025-05-15 14:18 UTC (permalink / raw)
To: Roberto Sassu
Cc: syzbot, dmitry.kasatkin, eric.snowberg, jmorris, linux-integrity,
linux-kernel, linux-security-module, paul, roberto.sassu, serge,
syzkaller-bugs, zohar, linux-bcachefs
On Thu, May 15, 2025 at 04:06:02PM +0200, Roberto Sassu wrote:
> On Wed, 2025-05-14 at 07:54 -0700, syzbot wrote:
> > Hello,
>
> + Kent, bcachefs mailing list
>
> I have the feeling that this was recently fixed in one of the latest
> pull requests in bcachefs. I don't see it occurring anymore, and there
> are more commits after the one reported by syzbot.
I have no idea how any of the ima stuff works or even what it does, I'm
not even sure where I'd start...
>
> Roberto
>
> > syzbot found the following issue on:
> >
> > HEAD commit: 02ddfb981de8 Merge tag 'scsi-fixes' of git://git.kernel.or..
> > git tree: upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=11169670580000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=9dc42c34a3f5c357
> > dashboard link: https://syzkaller.appspot.com/bug?extid=3f0b3970f154dfc95e6e
> > compiler: Debian clang version 20.1.2 (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97), Debian LLD 20.1.2
> > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1574d768580000
> >
> > Downloadable assets:
> > disk image: https://storage.googleapis.com/syzbot-assets/5ca57f5a3f77/disk-02ddfb98.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/3f23cbc11e68/vmlinux-02ddfb98.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/73e63afac354/bzImage-02ddfb98.xz
> > mounted in repro: https://storage.googleapis.com/syzbot-assets/0afd18737aed/mount_2.gz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+3f0b3970f154dfc95e6e@syzkaller.appspotmail.com
> >
> > bcachefs (loop2): going read-write
> > bcachefs (loop2): done starting filesystem
> > =====================================================
> > BUG: KMSAN: uninit-value in ima_lookup_digest_entry security/integrity/ima/ima_queue.c:64 [inline]
> > BUG: KMSAN: uninit-value in ima_add_template_entry+0x7a5/0x8d0 security/integrity/ima/ima_queue.c:191
> > ima_lookup_digest_entry security/integrity/ima/ima_queue.c:64 [inline]
> > ima_add_template_entry+0x7a5/0x8d0 security/integrity/ima/ima_queue.c:191
> > ima_store_template security/integrity/ima/ima_api.c:122 [inline]
> > ima_store_measurement+0x388/0x970 security/integrity/ima/ima_api.c:383
> > process_measurement+0x3075/0x40e0 security/integrity/ima/ima_main.c:393
> > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > security_file_post_open+0xbf/0x530 security/security.c:3130
> > do_open fs/namei.c:3882 [inline]
> > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > do_filp_open+0x280/0x660 fs/namei.c:4066
> > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > do_sys_open fs/open.c:1444 [inline]
> > __do_sys_openat fs/open.c:1460 [inline]
> > __se_sys_openat fs/open.c:1455 [inline]
> > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> >
> > <Zero or more stacks not recorded to save memory>
> >
> > Uninit was stored to memory at:
> > sha256_transform lib/crypto/sha256.c:117 [inline]
> > sha256_transform_blocks+0x276d/0x2880 lib/crypto/sha256.c:127
> > lib_sha256_base_do_finalize include/crypto/sha256_base.h:101 [inline]
> > __sha256_final lib/crypto/sha256.c:142 [inline]
> > sha256_final+0x169/0x460 lib/crypto/sha256.c:148
> > crypto_sha256_final+0xca/0x120 crypto/sha256_generic.c:49
> > crypto_shash_final+0x72/0xa0 crypto/shash.c:58
> > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:498 [inline]
> > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > ima_calc_file_hash+0x240a/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > security_file_post_open+0xbf/0x530 security/security.c:3130
> > do_open fs/namei.c:3882 [inline]
> > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > do_filp_open+0x280/0x660 fs/namei.c:4066
> > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > do_sys_open fs/open.c:1444 [inline]
> > __do_sys_openat fs/open.c:1460 [inline]
> > __se_sys_openat fs/open.c:1455 [inline]
> > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> >
> > Uninit was stored to memory at:
> > sha256_transform lib/crypto/sha256.c:117 [inline]
> > sha256_transform_blocks+0x276d/0x2880 lib/crypto/sha256.c:127
> > lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> > sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> > crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> > crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > security_file_post_open+0xbf/0x530 security/security.c:3130
> > do_open fs/namei.c:3882 [inline]
> > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > do_filp_open+0x280/0x660 fs/namei.c:4066
> > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > do_sys_open fs/open.c:1444 [inline]
> > __do_sys_openat fs/open.c:1460 [inline]
> > __se_sys_openat fs/open.c:1455 [inline]
> > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> >
> > Uninit was stored to memory at:
> > BLEND_OP lib/crypto/sha256.c:61 [inline]
> > sha256_transform lib/crypto/sha256.c:91 [inline]
> > sha256_transform_blocks+0xded/0x2880 lib/crypto/sha256.c:127
> > lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> > sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> > crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> > crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > security_file_post_open+0xbf/0x530 security/security.c:3130
> > do_open fs/namei.c:3882 [inline]
> > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > do_filp_open+0x280/0x660 fs/namei.c:4066
> > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > do_sys_open fs/open.c:1444 [inline]
> > __do_sys_openat fs/open.c:1460 [inline]
> > __se_sys_openat fs/open.c:1455 [inline]
> > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> >
> > Uninit was stored to memory at:
> > BLEND_OP lib/crypto/sha256.c:61 [inline]
> > sha256_transform lib/crypto/sha256.c:92 [inline]
> > sha256_transform_blocks+0xe00/0x2880 lib/crypto/sha256.c:127
> > lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> > sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> > crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> > crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > security_file_post_open+0xbf/0x530 security/security.c:3130
> > do_open fs/namei.c:3882 [inline]
> > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > do_filp_open+0x280/0x660 fs/namei.c:4066
> > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > do_sys_open fs/open.c:1444 [inline]
> > __do_sys_openat fs/open.c:1460 [inline]
> > __se_sys_openat fs/open.c:1455 [inline]
> > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> >
> > Uninit was stored to memory at:
> > BLEND_OP lib/crypto/sha256.c:61 [inline]
> > sha256_transform lib/crypto/sha256.c:93 [inline]
> > sha256_transform_blocks+0xe15/0x2880 lib/crypto/sha256.c:127
> > lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> > sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> > crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> > crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > security_file_post_open+0xbf/0x530 security/security.c:3130
> > do_open fs/namei.c:3882 [inline]
> > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > do_filp_open+0x280/0x660 fs/namei.c:4066
> > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > do_sys_open fs/open.c:1444 [inline]
> > __do_sys_openat fs/open.c:1460 [inline]
> > __se_sys_openat fs/open.c:1455 [inline]
> > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> >
> > Uninit was stored to memory at:
> > LOAD_OP lib/crypto/sha256.c:56 [inline]
> > sha256_transform lib/crypto/sha256.c:82 [inline]
> > sha256_transform_blocks+0x268b/0x2880 lib/crypto/sha256.c:127
> > lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> > sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> > crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> > crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > security_file_post_open+0xbf/0x530 security/security.c:3130
> > do_open fs/namei.c:3882 [inline]
> > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > do_filp_open+0x280/0x660 fs/namei.c:4066
> > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > do_sys_open fs/open.c:1444 [inline]
> > __do_sys_openat fs/open.c:1460 [inline]
> > __se_sys_openat fs/open.c:1455 [inline]
> > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> >
> > Uninit was stored to memory at:
> > memcpy_to_iter lib/iov_iter.c:65 [inline]
> > iterate_kvec include/linux/iov_iter.h:86 [inline]
> > iterate_and_advance2 include/linux/iov_iter.h:306 [inline]
> > iterate_and_advance include/linux/iov_iter.h:328 [inline]
> > _copy_to_iter+0x176c/0x32f0 lib/iov_iter.c:185
> > copy_page_to_iter+0x43c/0x8b0 lib/iov_iter.c:362
> > copy_folio_to_iter include/linux/uio.h:198 [inline]
> > filemap_read+0xced/0x2190 mm/filemap.c:2753
> > bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
> > __kernel_read+0x750/0xda0 fs/read_write.c:528
> > integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
> > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline]
> > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > ima_calc_file_hash+0x1ff9/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > security_file_post_open+0xbf/0x530 security/security.c:3130
> > do_open fs/namei.c:3882 [inline]
> > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > do_filp_open+0x280/0x660 fs/namei.c:4066
> > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > do_sys_open fs/open.c:1444 [inline]
> > __do_sys_openat fs/open.c:1460 [inline]
> > __se_sys_openat fs/open.c:1455 [inline]
> > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> >
> > Uninit was created at:
> > __alloc_frozen_pages_noprof+0x689/0xf00 mm/page_alloc.c:4993
> > alloc_pages_mpol+0x328/0x860 mm/mempolicy.c:2301
> > alloc_frozen_pages_noprof mm/mempolicy.c:2372 [inline]
> > alloc_pages_noprof mm/mempolicy.c:2392 [inline]
> > folio_alloc_noprof+0x109/0x360 mm/mempolicy.c:2402
> > filemap_alloc_folio_noprof+0x9d/0x420 mm/filemap.c:1007
> > ractl_alloc_folio mm/readahead.c:186 [inline]
> > ra_alloc_folio mm/readahead.c:441 [inline]
> > page_cache_ra_order+0x93f/0x14f0 mm/readahead.c:509
> > page_cache_sync_ra+0x108a/0x13e0 mm/readahead.c:621
> > filemap_get_pages+0xfb3/0x3a70 mm/filemap.c:2591
> > filemap_read+0x5c6/0x2190 mm/filemap.c:2702
> > bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
> > __kernel_read+0x750/0xda0 fs/read_write.c:528
> > integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
> > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline]
> > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > ima_calc_file_hash+0x1ff9/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > security_file_post_open+0xbf/0x530 security/security.c:3130
> > do_open fs/namei.c:3882 [inline]
> > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > do_filp_open+0x280/0x660 fs/namei.c:4066
> > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > do_sys_open fs/open.c:1444 [inline]
> > __do_sys_openat fs/open.c:1460 [inline]
> > __se_sys_openat fs/open.c:1455 [inline]
> > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> >
> > CPU: 0 UID: 0 PID: 7337 Comm: syz.2.106 Not tainted 6.15.0-rc3-syzkaller-00094-g02ddfb981de8 #0 PREEMPT(undef)
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
> > =====================================================
> >
> >
> > ---
> > 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] 8+ messages in thread
* Re: [syzbot] [lsm?] [integrity?] KMSAN: uninit-value in ima_add_template_entry (3)
2025-05-15 14:18 ` Kent Overstreet
@ 2025-05-15 14:30 ` Roberto Sassu
2025-05-15 16:37 ` Kent Overstreet
0 siblings, 1 reply; 8+ messages in thread
From: Roberto Sassu @ 2025-05-15 14:30 UTC (permalink / raw)
To: Kent Overstreet
Cc: syzbot, dmitry.kasatkin, eric.snowberg, jmorris, linux-integrity,
linux-kernel, linux-security-module, paul, roberto.sassu, serge,
syzkaller-bugs, zohar, linux-bcachefs
On Thu, 2025-05-15 at 10:18 -0400, Kent Overstreet wrote:
> On Thu, May 15, 2025 at 04:06:02PM +0200, Roberto Sassu wrote:
> > On Wed, 2025-05-14 at 07:54 -0700, syzbot wrote:
> > > Hello,
> >
> > + Kent, bcachefs mailing list
> >
> > I have the feeling that this was recently fixed in one of the latest
> > pull requests in bcachefs. I don't see it occurring anymore, and there
> > are more commits after the one reported by syzbot.
>
> I have no idea how any of the ima stuff works or even what it does, I'm
> not even sure where I'd start...
Basically, I got a clue that bcachefs would be the cause from the
bottom of the report:
page_cache_sync_ra+0x108a/0x13e0 mm/readahead.c:621
filemap_get_pages+0xfb3/0x3a70 mm/filemap.c:2591
filemap_read+0x5c6/0x2190 mm/filemap.c:2702
bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
__kernel_read+0x750/0xda0 fs/read_write.c:528
integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
This means that IMA is reading a file and calculating a digest over it:
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:498 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
ima_calc_file_hash+0x240a/0x3fd0 security/integrity/ima/ima_crypto.c:568
ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
syzbot is complaining that the data the digest was calculated from was
not initialized (e.g. zeroed).
There is a reproducer, we would be probably able to do a bisection and
find the commit that caused it (and maybe the one that fixed it).
Roberto
> > Roberto
> >
> > > syzbot found the following issue on:
> > >
> > > HEAD commit: 02ddfb981de8 Merge tag 'scsi-fixes' of git://git.kernel.or..
> > > git tree: upstream
> > > console output: https://syzkaller.appspot.com/x/log.txt?x=11169670580000
> > > kernel config: https://syzkaller.appspot.com/x/.config?x=9dc42c34a3f5c357
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=3f0b3970f154dfc95e6e
> > > compiler: Debian clang version 20.1.2 (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97), Debian LLD 20.1.2
> > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1574d768580000
> > >
> > > Downloadable assets:
> > > disk image: https://storage.googleapis.com/syzbot-assets/5ca57f5a3f77/disk-02ddfb98.raw.xz
> > > vmlinux: https://storage.googleapis.com/syzbot-assets/3f23cbc11e68/vmlinux-02ddfb98.xz
> > > kernel image: https://storage.googleapis.com/syzbot-assets/73e63afac354/bzImage-02ddfb98.xz
> > > mounted in repro: https://storage.googleapis.com/syzbot-assets/0afd18737aed/mount_2.gz
> > >
> > > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > > Reported-by: syzbot+3f0b3970f154dfc95e6e@syzkaller.appspotmail.com
> > >
> > > bcachefs (loop2): going read-write
> > > bcachefs (loop2): done starting filesystem
> > > =====================================================
> > > BUG: KMSAN: uninit-value in ima_lookup_digest_entry security/integrity/ima/ima_queue.c:64 [inline]
> > > BUG: KMSAN: uninit-value in ima_add_template_entry+0x7a5/0x8d0 security/integrity/ima/ima_queue.c:191
> > > ima_lookup_digest_entry security/integrity/ima/ima_queue.c:64 [inline]
> > > ima_add_template_entry+0x7a5/0x8d0 security/integrity/ima/ima_queue.c:191
> > > ima_store_template security/integrity/ima/ima_api.c:122 [inline]
> > > ima_store_measurement+0x388/0x970 security/integrity/ima/ima_api.c:383
> > > process_measurement+0x3075/0x40e0 security/integrity/ima/ima_main.c:393
> > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > > security_file_post_open+0xbf/0x530 security/security.c:3130
> > > do_open fs/namei.c:3882 [inline]
> > > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > > do_filp_open+0x280/0x660 fs/namei.c:4066
> > > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > > do_sys_open fs/open.c:1444 [inline]
> > > __do_sys_openat fs/open.c:1460 [inline]
> > > __se_sys_openat fs/open.c:1455 [inline]
> > > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > >
> > > <Zero or more stacks not recorded to save memory>
> > >
> > > Uninit was stored to memory at:
> > > sha256_transform lib/crypto/sha256.c:117 [inline]
> > > sha256_transform_blocks+0x276d/0x2880 lib/crypto/sha256.c:127
> > > lib_sha256_base_do_finalize include/crypto/sha256_base.h:101 [inline]
> > > __sha256_final lib/crypto/sha256.c:142 [inline]
> > > sha256_final+0x169/0x460 lib/crypto/sha256.c:148
> > > crypto_sha256_final+0xca/0x120 crypto/sha256_generic.c:49
> > > crypto_shash_final+0x72/0xa0 crypto/shash.c:58
> > > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:498 [inline]
> > > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > > ima_calc_file_hash+0x240a/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > > security_file_post_open+0xbf/0x530 security/security.c:3130
> > > do_open fs/namei.c:3882 [inline]
> > > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > > do_filp_open+0x280/0x660 fs/namei.c:4066
> > > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > > do_sys_open fs/open.c:1444 [inline]
> > > __do_sys_openat fs/open.c:1460 [inline]
> > > __se_sys_openat fs/open.c:1455 [inline]
> > > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > >
> > > Uninit was stored to memory at:
> > > sha256_transform lib/crypto/sha256.c:117 [inline]
> > > sha256_transform_blocks+0x276d/0x2880 lib/crypto/sha256.c:127
> > > lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> > > sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> > > crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> > > crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> > > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> > > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > > ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > > security_file_post_open+0xbf/0x530 security/security.c:3130
> > > do_open fs/namei.c:3882 [inline]
> > > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > > do_filp_open+0x280/0x660 fs/namei.c:4066
> > > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > > do_sys_open fs/open.c:1444 [inline]
> > > __do_sys_openat fs/open.c:1460 [inline]
> > > __se_sys_openat fs/open.c:1455 [inline]
> > > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > >
> > > Uninit was stored to memory at:
> > > BLEND_OP lib/crypto/sha256.c:61 [inline]
> > > sha256_transform lib/crypto/sha256.c:91 [inline]
> > > sha256_transform_blocks+0xded/0x2880 lib/crypto/sha256.c:127
> > > lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> > > sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> > > crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> > > crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> > > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> > > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > > ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > > security_file_post_open+0xbf/0x530 security/security.c:3130
> > > do_open fs/namei.c:3882 [inline]
> > > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > > do_filp_open+0x280/0x660 fs/namei.c:4066
> > > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > > do_sys_open fs/open.c:1444 [inline]
> > > __do_sys_openat fs/open.c:1460 [inline]
> > > __se_sys_openat fs/open.c:1455 [inline]
> > > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > >
> > > Uninit was stored to memory at:
> > > BLEND_OP lib/crypto/sha256.c:61 [inline]
> > > sha256_transform lib/crypto/sha256.c:92 [inline]
> > > sha256_transform_blocks+0xe00/0x2880 lib/crypto/sha256.c:127
> > > lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> > > sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> > > crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> > > crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> > > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> > > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > > ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > > security_file_post_open+0xbf/0x530 security/security.c:3130
> > > do_open fs/namei.c:3882 [inline]
> > > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > > do_filp_open+0x280/0x660 fs/namei.c:4066
> > > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > > do_sys_open fs/open.c:1444 [inline]
> > > __do_sys_openat fs/open.c:1460 [inline]
> > > __se_sys_openat fs/open.c:1455 [inline]
> > > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > >
> > > Uninit was stored to memory at:
> > > BLEND_OP lib/crypto/sha256.c:61 [inline]
> > > sha256_transform lib/crypto/sha256.c:93 [inline]
> > > sha256_transform_blocks+0xe15/0x2880 lib/crypto/sha256.c:127
> > > lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> > > sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> > > crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> > > crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> > > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> > > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > > ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > > security_file_post_open+0xbf/0x530 security/security.c:3130
> > > do_open fs/namei.c:3882 [inline]
> > > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > > do_filp_open+0x280/0x660 fs/namei.c:4066
> > > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > > do_sys_open fs/open.c:1444 [inline]
> > > __do_sys_openat fs/open.c:1460 [inline]
> > > __se_sys_openat fs/open.c:1455 [inline]
> > > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > >
> > > Uninit was stored to memory at:
> > > LOAD_OP lib/crypto/sha256.c:56 [inline]
> > > sha256_transform lib/crypto/sha256.c:82 [inline]
> > > sha256_transform_blocks+0x268b/0x2880 lib/crypto/sha256.c:127
> > > lib_sha256_base_do_update include/crypto/sha256_base.h:63 [inline]
> > > sha256_update+0x392/0x410 lib/crypto/sha256.c:136
> > > crypto_sha256_update+0x35/0x60 crypto/sha256_generic.c:39
> > > crypto_shash_update+0x7a/0xb0 crypto/shash.c:52
> > > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:491 [inline]
> > > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > > ima_calc_file_hash+0x20d7/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > > security_file_post_open+0xbf/0x530 security/security.c:3130
> > > do_open fs/namei.c:3882 [inline]
> > > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > > do_filp_open+0x280/0x660 fs/namei.c:4066
> > > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > > do_sys_open fs/open.c:1444 [inline]
> > > __do_sys_openat fs/open.c:1460 [inline]
> > > __se_sys_openat fs/open.c:1455 [inline]
> > > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > >
> > > Uninit was stored to memory at:
> > > memcpy_to_iter lib/iov_iter.c:65 [inline]
> > > iterate_kvec include/linux/iov_iter.h:86 [inline]
> > > iterate_and_advance2 include/linux/iov_iter.h:306 [inline]
> > > iterate_and_advance include/linux/iov_iter.h:328 [inline]
> > > _copy_to_iter+0x176c/0x32f0 lib/iov_iter.c:185
> > > copy_page_to_iter+0x43c/0x8b0 lib/iov_iter.c:362
> > > copy_folio_to_iter include/linux/uio.h:198 [inline]
> > > filemap_read+0xced/0x2190 mm/filemap.c:2753
> > > bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
> > > __kernel_read+0x750/0xda0 fs/read_write.c:528
> > > integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
> > > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline]
> > > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > > ima_calc_file_hash+0x1ff9/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > > security_file_post_open+0xbf/0x530 security/security.c:3130
> > > do_open fs/namei.c:3882 [inline]
> > > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > > do_filp_open+0x280/0x660 fs/namei.c:4066
> > > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > > do_sys_open fs/open.c:1444 [inline]
> > > __do_sys_openat fs/open.c:1460 [inline]
> > > __se_sys_openat fs/open.c:1455 [inline]
> > > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > >
> > > Uninit was created at:
> > > __alloc_frozen_pages_noprof+0x689/0xf00 mm/page_alloc.c:4993
> > > alloc_pages_mpol+0x328/0x860 mm/mempolicy.c:2301
> > > alloc_frozen_pages_noprof mm/mempolicy.c:2372 [inline]
> > > alloc_pages_noprof mm/mempolicy.c:2392 [inline]
> > > folio_alloc_noprof+0x109/0x360 mm/mempolicy.c:2402
> > > filemap_alloc_folio_noprof+0x9d/0x420 mm/filemap.c:1007
> > > ractl_alloc_folio mm/readahead.c:186 [inline]
> > > ra_alloc_folio mm/readahead.c:441 [inline]
> > > page_cache_ra_order+0x93f/0x14f0 mm/readahead.c:509
> > > page_cache_sync_ra+0x108a/0x13e0 mm/readahead.c:621
> > > filemap_get_pages+0xfb3/0x3a70 mm/filemap.c:2591
> > > filemap_read+0x5c6/0x2190 mm/filemap.c:2702
> > > bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
> > > __kernel_read+0x750/0xda0 fs/read_write.c:528
> > > integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
> > > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline]
> > > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > > ima_calc_file_hash+0x1ff9/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > > security_file_post_open+0xbf/0x530 security/security.c:3130
> > > do_open fs/namei.c:3882 [inline]
> > > path_openat+0x5ac3/0x6760 fs/namei.c:4039
> > > do_filp_open+0x280/0x660 fs/namei.c:4066
> > > do_sys_openat2+0x1bb/0x2f0 fs/open.c:1429
> > > do_sys_open fs/open.c:1444 [inline]
> > > __do_sys_openat fs/open.c:1460 [inline]
> > > __se_sys_openat fs/open.c:1455 [inline]
> > > __x64_sys_openat+0x240/0x300 fs/open.c:1455
> > > x64_sys_call+0x213/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:258
> > > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> > > do_syscall_64+0xd9/0x1b0 arch/x86/entry/syscall_64.c:94
> > > entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > >
> > > CPU: 0 UID: 0 PID: 7337 Comm: syz.2.106 Not tainted 6.15.0-rc3-syzkaller-00094-g02ddfb981de8 #0 PREEMPT(undef)
> > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
> > > =====================================================
> > >
> > >
> > > ---
> > > 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] 8+ messages in thread
* Re: [syzbot] [lsm?] [integrity?] KMSAN: uninit-value in ima_add_template_entry (3)
2025-05-15 14:30 ` Roberto Sassu
@ 2025-05-15 16:37 ` Kent Overstreet
2025-05-15 16:39 ` Roberto Sassu
0 siblings, 1 reply; 8+ messages in thread
From: Kent Overstreet @ 2025-05-15 16:37 UTC (permalink / raw)
To: Roberto Sassu
Cc: syzbot, dmitry.kasatkin, eric.snowberg, jmorris, linux-integrity,
linux-kernel, linux-security-module, paul, roberto.sassu, serge,
syzkaller-bugs, zohar, linux-bcachefs
On Thu, May 15, 2025 at 04:30:09PM +0200, Roberto Sassu wrote:
> On Thu, 2025-05-15 at 10:18 -0400, Kent Overstreet wrote:
> > On Thu, May 15, 2025 at 04:06:02PM +0200, Roberto Sassu wrote:
> > > On Wed, 2025-05-14 at 07:54 -0700, syzbot wrote:
> > > > Hello,
> > >
> > > + Kent, bcachefs mailing list
> > >
> > > I have the feeling that this was recently fixed in one of the latest
> > > pull requests in bcachefs. I don't see it occurring anymore, and there
> > > are more commits after the one reported by syzbot.
> >
> > I have no idea how any of the ima stuff works or even what it does, I'm
> > not even sure where I'd start...
>
> Basically, I got a clue that bcachefs would be the cause from the
> bottom of the report:
>
> page_cache_sync_ra+0x108a/0x13e0 mm/readahead.c:621
> filemap_get_pages+0xfb3/0x3a70 mm/filemap.c:2591
> filemap_read+0x5c6/0x2190 mm/filemap.c:2702
> bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
> __kernel_read+0x750/0xda0 fs/read_write.c:528
> integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
>
> This means that IMA is reading a file and calculating a digest over it:
>
> ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:498 [inline]
> ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> ima_calc_file_hash+0x240a/0x3fd0 security/integrity/ima/ima_crypto.c:568
> ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
>
> syzbot is complaining that the data the digest was calculated from was
> not initialized (e.g. zeroed).
>
> There is a reproducer, we would be probably able to do a bisection and
> find the commit that caused it (and maybe the one that fixed it).
Ok, that would be fixed by the - multiple - KMSAN fixes, most of those
were spurious but code was lacking annotations. Probably this one:
9c3a2c9b471a bcachefs: Disable asm memcpys when kmsan enabled
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [lsm?] [integrity?] KMSAN: uninit-value in ima_add_template_entry (3)
2025-05-15 16:37 ` Kent Overstreet
@ 2025-05-15 16:39 ` Roberto Sassu
2025-05-15 16:48 ` Kent Overstreet
0 siblings, 1 reply; 8+ messages in thread
From: Roberto Sassu @ 2025-05-15 16:39 UTC (permalink / raw)
To: Kent Overstreet
Cc: syzbot, dmitry.kasatkin, eric.snowberg, jmorris, linux-integrity,
linux-kernel, linux-security-module, paul, roberto.sassu, serge,
syzkaller-bugs, zohar, linux-bcachefs
On Thu, 2025-05-15 at 12:37 -0400, Kent Overstreet wrote:
> On Thu, May 15, 2025 at 04:30:09PM +0200, Roberto Sassu wrote:
> > On Thu, 2025-05-15 at 10:18 -0400, Kent Overstreet wrote:
> > > On Thu, May 15, 2025 at 04:06:02PM +0200, Roberto Sassu wrote:
> > > > On Wed, 2025-05-14 at 07:54 -0700, syzbot wrote:
> > > > > Hello,
> > > >
> > > > + Kent, bcachefs mailing list
> > > >
> > > > I have the feeling that this was recently fixed in one of the latest
> > > > pull requests in bcachefs. I don't see it occurring anymore, and there
> > > > are more commits after the one reported by syzbot.
> > >
> > > I have no idea how any of the ima stuff works or even what it does, I'm
> > > not even sure where I'd start...
> >
> > Basically, I got a clue that bcachefs would be the cause from the
> > bottom of the report:
> >
> > page_cache_sync_ra+0x108a/0x13e0 mm/readahead.c:621
> > filemap_get_pages+0xfb3/0x3a70 mm/filemap.c:2591
> > filemap_read+0x5c6/0x2190 mm/filemap.c:2702
> > bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
> > __kernel_read+0x750/0xda0 fs/read_write.c:528
> > integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
> >
> > This means that IMA is reading a file and calculating a digest over it:
> >
> > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:498 [inline]
> > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > ima_calc_file_hash+0x240a/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> >
> > syzbot is complaining that the data the digest was calculated from was
> > not initialized (e.g. zeroed).
> >
> > There is a reproducer, we would be probably able to do a bisection and
> > find the commit that caused it (and maybe the one that fixed it).
>
> Ok, that would be fixed by the - multiple - KMSAN fixes, most of those
> were spurious but code was lacking annotations. Probably this one:
>
> 9c3a2c9b471a bcachefs: Disable asm memcpys when kmsan enabled
Perfect, thanks a lot!
Will check it and mark this report as fixed.
Roberto
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [lsm?] [integrity?] KMSAN: uninit-value in ima_add_template_entry (3)
2025-05-15 16:39 ` Roberto Sassu
@ 2025-05-15 16:48 ` Kent Overstreet
2025-05-15 16:52 ` Roberto Sassu
0 siblings, 1 reply; 8+ messages in thread
From: Kent Overstreet @ 2025-05-15 16:48 UTC (permalink / raw)
To: Roberto Sassu
Cc: syzbot, dmitry.kasatkin, eric.snowberg, jmorris, linux-integrity,
linux-kernel, linux-security-module, paul, roberto.sassu, serge,
syzkaller-bugs, zohar, linux-bcachefs
On Thu, May 15, 2025 at 06:39:48PM +0200, Roberto Sassu wrote:
> On Thu, 2025-05-15 at 12:37 -0400, Kent Overstreet wrote:
> > On Thu, May 15, 2025 at 04:30:09PM +0200, Roberto Sassu wrote:
> > > On Thu, 2025-05-15 at 10:18 -0400, Kent Overstreet wrote:
> > > > On Thu, May 15, 2025 at 04:06:02PM +0200, Roberto Sassu wrote:
> > > > > On Wed, 2025-05-14 at 07:54 -0700, syzbot wrote:
> > > > > > Hello,
> > > > >
> > > > > + Kent, bcachefs mailing list
> > > > >
> > > > > I have the feeling that this was recently fixed in one of the latest
> > > > > pull requests in bcachefs. I don't see it occurring anymore, and there
> > > > > are more commits after the one reported by syzbot.
> > > >
> > > > I have no idea how any of the ima stuff works or even what it does, I'm
> > > > not even sure where I'd start...
> > >
> > > Basically, I got a clue that bcachefs would be the cause from the
> > > bottom of the report:
> > >
> > > page_cache_sync_ra+0x108a/0x13e0 mm/readahead.c:621
> > > filemap_get_pages+0xfb3/0x3a70 mm/filemap.c:2591
> > > filemap_read+0x5c6/0x2190 mm/filemap.c:2702
> > > bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
> > > __kernel_read+0x750/0xda0 fs/read_write.c:528
> > > integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
> > >
> > > This means that IMA is reading a file and calculating a digest over it:
> > >
> > > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:498 [inline]
> > > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > > ima_calc_file_hash+0x240a/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > >
> > > syzbot is complaining that the data the digest was calculated from was
> > > not initialized (e.g. zeroed).
> > >
> > > There is a reproducer, we would be probably able to do a bisection and
> > > find the commit that caused it (and maybe the one that fixed it).
> >
> > Ok, that would be fixed by the - multiple - KMSAN fixes, most of those
> > were spurious but code was lacking annotations. Probably this one:
> >
> > 9c3a2c9b471a bcachefs: Disable asm memcpys when kmsan enabled
>
> Perfect, thanks a lot!
>
> Will check it and mark this report as fixed.
Btw, since you mentioned syzbot reproducers, I have a tool for running
those locally, with a single command. It's one of the "tests" in ktest:
https://evilpiepirate.org/git/ktest.git/
With that, you can do
build-test-kernel run -IP ~/ktest/tests/syzbot-repro.ktest <syz id>
in your kernel tree, and it'll build a kernel, launch a vm, and run the
reproducer, all in a single command :)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [lsm?] [integrity?] KMSAN: uninit-value in ima_add_template_entry (3)
2025-05-15 16:48 ` Kent Overstreet
@ 2025-05-15 16:52 ` Roberto Sassu
0 siblings, 0 replies; 8+ messages in thread
From: Roberto Sassu @ 2025-05-15 16:52 UTC (permalink / raw)
To: Kent Overstreet
Cc: syzbot, dmitry.kasatkin, eric.snowberg, jmorris, linux-integrity,
linux-kernel, linux-security-module, paul, roberto.sassu, serge,
syzkaller-bugs, zohar, linux-bcachefs
On Thu, 2025-05-15 at 12:48 -0400, Kent Overstreet wrote:
> On Thu, May 15, 2025 at 06:39:48PM +0200, Roberto Sassu wrote:
> > On Thu, 2025-05-15 at 12:37 -0400, Kent Overstreet wrote:
> > > On Thu, May 15, 2025 at 04:30:09PM +0200, Roberto Sassu wrote:
> > > > On Thu, 2025-05-15 at 10:18 -0400, Kent Overstreet wrote:
> > > > > On Thu, May 15, 2025 at 04:06:02PM +0200, Roberto Sassu wrote:
> > > > > > On Wed, 2025-05-14 at 07:54 -0700, syzbot wrote:
> > > > > > > Hello,
> > > > > >
> > > > > > + Kent, bcachefs mailing list
> > > > > >
> > > > > > I have the feeling that this was recently fixed in one of the latest
> > > > > > pull requests in bcachefs. I don't see it occurring anymore, and there
> > > > > > are more commits after the one reported by syzbot.
> > > > >
> > > > > I have no idea how any of the ima stuff works or even what it does, I'm
> > > > > not even sure where I'd start...
> > > >
> > > > Basically, I got a clue that bcachefs would be the cause from the
> > > > bottom of the report:
> > > >
> > > > page_cache_sync_ra+0x108a/0x13e0 mm/readahead.c:621
> > > > filemap_get_pages+0xfb3/0x3a70 mm/filemap.c:2591
> > > > filemap_read+0x5c6/0x2190 mm/filemap.c:2702
> > > > bch2_read_iter+0x559/0x21c0 fs/bcachefs/fs-io-direct.c:221
> > > > __kernel_read+0x750/0xda0 fs/read_write.c:528
> > > > integrity_kernel_read+0x77/0x90 security/integrity/iint.c:28
> > > >
> > > > This means that IMA is reading a file and calculating a digest over it:
> > > >
> > > > ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:498 [inline]
> > > > ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline]
> > > > ima_calc_file_hash+0x240a/0x3fd0 security/integrity/ima/ima_crypto.c:568
> > > > ima_collect_measurement+0x45d/0xe60 security/integrity/ima/ima_api.c:293
> > > > process_measurement+0x2d1a/0x40e0 security/integrity/ima/ima_main.c:385
> > > > ima_file_check+0x8e/0xd0 security/integrity/ima/ima_main.c:613
> > > >
> > > > syzbot is complaining that the data the digest was calculated from was
> > > > not initialized (e.g. zeroed).
> > > >
> > > > There is a reproducer, we would be probably able to do a bisection and
> > > > find the commit that caused it (and maybe the one that fixed it).
> > >
> > > Ok, that would be fixed by the - multiple - KMSAN fixes, most of those
> > > were spurious but code was lacking annotations. Probably this one:
> > >
> > > 9c3a2c9b471a bcachefs: Disable asm memcpys when kmsan enabled
> >
> > Perfect, thanks a lot!
> >
> > Will check it and mark this report as fixed.
>
> Btw, since you mentioned syzbot reproducers, I have a tool for running
> those locally, with a single command. It's one of the "tests" in ktest:
>
> https://evilpiepirate.org/git/ktest.git/
>
> With that, you can do
>
> build-test-kernel run -IP ~/ktest/tests/syzbot-repro.ktest <syz id>
>
> in your kernel tree, and it'll build a kernel, launch a vm, and run the
> reproducer, all in a single command :)
Great, will try that!
Thanks
Roberto
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-05-15 16:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-14 14:54 [syzbot] [lsm?] [integrity?] KMSAN: uninit-value in ima_add_template_entry (3) syzbot
2025-05-15 14:06 ` Roberto Sassu
2025-05-15 14:18 ` Kent Overstreet
2025-05-15 14:30 ` Roberto Sassu
2025-05-15 16:37 ` Kent Overstreet
2025-05-15 16:39 ` Roberto Sassu
2025-05-15 16:48 ` Kent Overstreet
2025-05-15 16:52 ` Roberto Sassu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).