* Re: [PATCH] ext4: use a stable source for the kmmpd thread name
2026-11-16 12:16 ` Jan Kara
@ 2026-11-16 16:36 ` Zhao Gongyi
2026-11-16 16:42 ` sashiko-bot
0 siblings, 1 reply; 5+ messages in thread
From: Zhao Gongyi @ 2026-11-16 16:36 UTC (permalink / raw)
To: Jan Kara
Cc: tytso, linux-ext4, linux-kernel, adilger.kernel, libaokun,
ojaswin, ritesh.list, yi.zhang
[-- Attachment #1: Type: text/plain, Size: 2210 bytes --]
Hi Jan,
On 11/16/26 8:16 PM, Jan Kara wrote:
> What can change it? I don't see anything that should be doing that...
A concurrent buffered write to the loop block device can change it. In
one diagnostic run, the write reached the page-cache buffer ext4 was
using for MMP. mmp_bdevname is embedded at bh->b_data + 0x50.
In an x86 QEMU diagnostic run based on commit
7475ea8b58616b33c04afb976cf0fbaad9dd63fb, kvasprintf() first read
"loop0" at ffff888013e1d050. A kprobe on mark_buffer_dirty() then
fired for a buffer starting at ffff888013e1d000, covering that field.
The stack was:
ksys_write -> blkdev_write_iter -> blkdev_buffered_write
-> iomap_file_buffered_write -> iomap_write_end
-> block_write_end -> block_commit_write -> mark_buffer_dirty
The buffered write path copies data into the page cache before
block_commit_write(). About one second later, the same source page
contained an empty string, and kvasprintf() reported return values 11
and 6. The kprobe records the buffer being dirtied; it does not trap
the byte-copy instruction itself. My earlier description of a
concurrent MMP mount changing the name was imprecise.
The original syzkaller manager report shows the warning on an
unmodified kernel. Standalone QEMU replays without a delay did not hit
it reliably. To obtain the trace above, I used a diagnostic build with
a one-second delay after the first vsnprintf() pass, source snapshots,
an exported MMP buffer address, and a kprobe module. The attached
test-only delay patch widens the window but does not collect the writer
trace by itself. None of this diagnostic code is part of the proposed fix.
The attached repro.syz is input to syz-execprog. I ran it in the guest with:
/root/syz-execprog -executor=/root/syz-executor -arch=amd64 \
-sandbox=none -procs=12 -repeat=0 -threaded=true -slowdown=1 \
-sandbox_arg=0 -type=qemu /root/repro.syz
I understand that raw writes to a block device during ext4 access can
corrupt metadata. The proposed change gives the two-pass thread-name
formatting a stable source; it does not change MMP's protection logic.
I can provide the full diagnostic diff, kprobe module, and console log
if useful.
Thanks,
Gongyi
[-- Attachment #2: repro.syz --]
[-- Type: text/plain, Size: 9996 bytes --]
# {Threaded:true Repeat:true RepeatTimes:0 Procs:1 Slowdown:1 Sandbox: SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false Cgroups:false BinfmtMisc:false CloseFDs:false KCSAN:false DevlinkPCI:false NicVF:false USB:false VhciInjection:false Wifi:false IEEE802154:false Sysctl:false Swap:false UseTmpDir:true HandleSegv:true Trace:false CallComments:true LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}}
r0 = syz_open_dev$ptys(0xc, 0x3, 0x1)
r1 = syz_open_dev$sg(&(0x7f0000000140), 0x4cf, 0x60300)
mmap(&(0x7f0000ffc000/0x4000)=nil, 0x4000, 0x0, 0x13, r1, 0x0)
mmap(&(0x7f0000ffc000/0x4000)=nil, 0x4000, 0x0, 0x13, r1, 0x0)
mremap(&(0x7f0000ff6000/0x4000)=nil, 0x4000, 0x4000, 0x3, &(0x7f0000ffb000/0x4000)=nil)
madvise(&(0x7f0000ffc000/0x4000)=nil, 0x4000, 0x15)
ioctl$TIOCSPTLCK(r0, 0x40045431, &(0x7f0000000000)) (async)
ioctl$RTC_EPOCH_SET(0xffffffffffffffff, 0x4008700e, 0x70b) (async)
openat(0xffffffffffffff9c, &(0x7f0000000040)='./file1\x00', 0x42, 0x1ff)
syz_mount_image$ext4(&(0x7f0000000c00)='ext4\x00', &(0x7f00000045c0)='./file1\x00', 0x9400, &(0x7f0000000080)={[{@nomblk_io_submit}, {@errors_continue}]}, 0x1, 0xc28, &(0x7f00000046c0)="$eJzs2M9vG1kdAPDvTOI0/UGTIoRYLhvBYSvBOk3SVGXhsBVCSIiVKuCI1LVSNwm14yh2pY1XaLPaAxcOOaCVEOKAhMQBDtUeuNITN26A2D8ACVZUHOAGyGjscTZt4jjZup62+Xykl3lv3nj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O/O/8/vP9/On9Mg/BtYVdtLv1wWN3R8Q+cljT+Hx4x/g+7///SMdtovOz9Zlid+T8AAAAAAAAAAAAAAAAAAAAAAAAAAADnUWdre2Wh1WpsnGKm6GsEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgKL8NwAA//+71f46")
openat(0xffffffffffffff9c, &(0x7f0000000040)='./file1\x00', 0x84402, 0x0)
write(r2, &(0x7f0000000000)="01", 0xfffffec2)
truncate(0x0, 0xb)
write$FUSE_NOTIFY_POLL(0xffffffffffffffff, 0x0, 0x0) (async)
write$FUSE_NOTIFY_POLL(0xffffffffffffffff, 0x0, 0x0)
ioctl$TIOCGPTPEER(r0, 0x5441, 0x80000001) (async)
r3 = ioctl$TIOCGPTPEER(r0, 0x5441, 0x80000001)
fallocate(0xffffffffffffffff, 0x30, 0x100, 0xe60) (async)
fallocate(0xffffffffffffffff, 0x30, 0x100, 0xe60)
syz_open_dev$tty1(0xc, 0x4, 0x3)
symlinkat(&(0x7f0000004480)='./file0\x00', 0xffffffffffffffff, &(0x7f0000004540)='./file0\x00') (async)
symlinkat(&(0x7f0000004480)='./file0\x00', 0xffffffffffffffff, &(0x7f0000004540)='./file0\x00')
openat$ptmx(0xffffffffffffff9c, &(0x7f0000004580), 0x80, 0x0)
ioctl$VT_GETMODE(r3, 0x5601, 0x0)
[-- Attachment #3: delay-kvasprintf-kmmpd-name-race-v2.patch --]
[-- Type: text/plain, Size: 1795 bytes --]
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
Date: Sat, 14 Nov 2026 22:35:00 +0800
Subject: [PATCH] DEBUG: kvasprintf: widen old and fixed kmmpd name windows
This is a reproducer-only delay patch for validating:
WARNING in __kthread_create_on_node
different return values (11 and 6) from vsnprintf("kmmpd-%.*s", ...)
The first delay patch only matched "kmmpd-%.*s". That made the A side
easy to reproduce, but after applying the fix the B side uses
"kmmpd-%s" and therefore did not hit the same artificial kvasprintf()
delay window.
Delay both old and fixed kmmpd thread-name formats after kvasprintf()'s
first vsnprintf() pass. With this patch, A verifies that the original
buffer-backed string can change during the widened window, while B uses
the same widened kvasprintf() window but passes the fixed stack-backed
string source.
Do not use this patch as a fix and do not ship it outside validation.
---
lib/kasprintf.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/kasprintf.c b/lib/kasprintf.c
index 6ec7e041c5cc..000000000000 100644
--- a/lib/kasprintf.c
+++ b/lib/kasprintf.c
@@ -7,6 +7,7 @@
#include <linux/stdarg.h>
#include <linux/export.h>
+#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/string.h>
@@ -21,6 +22,15 @@ char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap)
first = vsnprintf(NULL, 0, fmt, aq);
va_end(aq);
+ /*
+ * Reproducer-only delay. Cover both the original ext4 MMP thread-name
+ * format and the fixed format so A and B execute the same widened
+ * kvasprintf() window.
+ */
+ if (!strcmp(fmt, "kmmpd-%.*s") ||
+ !strcmp(fmt, "kmmpd-%s"))
+ msleep(1000);
+
p = kmalloc_track_caller(first+1, gfp);
if (!p)
return NULL;
--
2.50.1
^ permalink raw reply related [flat|nested] 5+ messages in thread