From: David Hildenbrand <david@redhat.com>
To: Jeongjun Park <aha310510@gmail.com>,
akpm@linux-foundation.org, willy@infradead.org
Cc: wangkefeng.wang@huawei.com, ziy@nvidia.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, syzbot <syzkaller@googlegroups.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] mm: migrate: annotate data-race in migrate_folio_unmap()
Date: Thu, 26 Sep 2024 13:18:40 +0200 [thread overview]
Message-ID: <b036d16a-8af8-44b1-b4cb-5ca10a51728b@redhat.com> (raw)
In-Reply-To: <20240924130053.107490-1-aha310510@gmail.com>
On 24.09.24 15:00, Jeongjun Park wrote:
> I found a report from syzbot [1]
>
> This report shows that the value can be changed, but in reality, the
> value of __folio_set_movable() cannot be changed because it holds the
> folio refcount.
>
> Therefore, it is appropriate to add an annotate to make KCSAN
> ignore that data-race.
>
> [1]
>
> ==================================================================
> BUG: KCSAN: data-race in __filemap_remove_folio / migrate_pages_batch
>
> write to 0xffffea0004b81dd8 of 8 bytes by task 6348 on cpu 0:
> page_cache_delete mm/filemap.c:153 [inline]
> __filemap_remove_folio+0x1ac/0x2c0 mm/filemap.c:233
> filemap_remove_folio+0x6b/0x1f0 mm/filemap.c:265
> truncate_inode_folio+0x42/0x50 mm/truncate.c:178
> shmem_undo_range+0x25b/0xa70 mm/shmem.c:1028
> shmem_truncate_range mm/shmem.c:1144 [inline]
> shmem_evict_inode+0x14d/0x530 mm/shmem.c:1272
> evict+0x2f0/0x580 fs/inode.c:731
> iput_final fs/inode.c:1883 [inline]
> iput+0x42a/0x5b0 fs/inode.c:1909
> dentry_unlink_inode+0x24f/0x260 fs/dcache.c:412
> __dentry_kill+0x18b/0x4c0 fs/dcache.c:615
> dput+0x5c/0xd0 fs/dcache.c:857
> __fput+0x3fb/0x6d0 fs/file_table.c:439
> ____fput+0x1c/0x30 fs/file_table.c:459
> task_work_run+0x13a/0x1a0 kernel/task_work.c:228
> resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
> exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
> exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
> __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
> syscall_exit_to_user_mode+0xbe/0x130 kernel/entry/common.c:218
> do_syscall_64+0xd6/0x1c0 arch/x86/entry/common.c:89
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> read to 0xffffea0004b81dd8 of 8 bytes by task 6342 on cpu 1:
> __folio_test_movable include/linux/page-flags.h:699 [inline]
> migrate_folio_unmap mm/migrate.c:1199 [inline]
> migrate_pages_batch+0x24c/0x1940 mm/migrate.c:1797
> migrate_pages_sync mm/migrate.c:1963 [inline]
> migrate_pages+0xff1/0x1820 mm/migrate.c:2072
> do_mbind mm/mempolicy.c:1390 [inline]
> kernel_mbind mm/mempolicy.c:1533 [inline]
> __do_sys_mbind mm/mempolicy.c:1607 [inline]
> __se_sys_mbind+0xf76/0x1160 mm/mempolicy.c:1603
> __x64_sys_mbind+0x78/0x90 mm/mempolicy.c:1603
> x64_sys_call+0x2b4d/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:238
> do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> do_syscall_64+0xc9/0x1c0 arch/x86/entry/common.c:83
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> value changed: 0xffff888127601078 -> 0x0000000000000000
>
> Reported-by: syzbot <syzkaller@googlegroups.com>
> Cc: stable@vger.kernel.org
Hmm, why stable?
> Fixes: 7e2a5e5ab217 ("mm: migrate: use __folio_test_movable()")
> Signed-off-by: Jeongjun Park <aha310510@gmail.com>
> ---
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
prev parent reply other threads:[~2024-09-26 11:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 13:00 Jeongjun Park
2024-09-26 11:18 ` David Hildenbrand [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b036d16a-8af8-44b1-b4cb-5ca10a51728b@redhat.com \
--to=david@redhat.com \
--cc=aha310510@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=stable@vger.kernel.org \
--cc=syzkaller@googlegroups.com \
--cc=wangkefeng.wang@huawei.com \
--cc=willy@infradead.org \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox