Alexander Potapenko
unread,Mar 16, 2026, 10:37:29 AM (5 days ago) Mar 16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vba...@kernel.org, Christian Brauner, syzbot, Marco Elver, Dmitry Vyukov, Liam.H...@oracle.com, ak...@linux-foundation.org, da...@kernel.org, linux-...@vger.kernel.org, linu...@kvack.org, l...@kernel.org, mho...@suse.com, rp...@kernel.org, sur...@google.com, syzkall...@googlegroups.com, kasan-dev, Sabyrzhan Tasbolatov, Andrey Konovalov
I think KMSAN correctly points out that the data is uninitialized at
the point when copy_from_kernel_nofault executes.
KMSAN actually knows nothing about seqlocks or any other
synchronization primitives, it just tracks the state of every
uninitialized bit in the kernel, and reports an error if the data is
uninitialized when a check is requested.
It's a good question whether we need the aggressive KMSAN check in
copy_from_kernel() (are there cases in which this function copies data
out of the kernel?)
If we do, the following patch should fix the report in question:
diff --git a/fs/dcache.c b/fs/dcache.c
index 9ceab142896f..923e32e6a2d4 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -32,6 +32,7 @@
#include <linux/bit_spinlock.h>
#include <linux/rculist_bl.h>
#include <linux/list_lru.h>
+#include <linux/kmsan-checks.h>
#include "internal.h"
#include "mount.h"
@@ -1749,6 +1750,7 @@ static struct dentry *__d_alloc(struct
super_block *sb, const struct qstr *name)
* be overwriting an internal NUL character
*/
dentry->d_shortname.string[DNAME_INLINE_LEN-1] = 0;
+ kmsan_unpoison_memory(&dentry->d_shortname,
sizeof(dentry->d_shortname));
if (unlikely(!name)) {
name = &slash_name;
dname = dentry->d_shortname.string;