* [syzbot] [kernel?] WARNING in futex_pivot_pending
@ 2026-08-15 14:36 syzbot
2026-08-16 2:25 ` Edward Adam Davis
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: syzbot @ 2026-08-15 14:36 UTC (permalink / raw)
To: andrealmeid, dave, dvhart, linux-kernel, mingo, peterz,
syzkaller-bugs, tglx
Hello,
syzbot found the following issue on:
HEAD commit: f9054278acf4 Merge branch 'for-next/core' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=11ee7879580000
kernel config: https://syzkaller.appspot.com/x/.config?x=ccf4bea59f67007
dashboard link: https://syzkaller.appspot.com/bug?extid=9c28ada89c468ad30713
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=163b3132580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14d52a9e580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/dbe6df6b5108/disk-f9054278.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c3892df8a641/vmlinux-f9054278.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0a12ddc085ab/Image-f9054278.gz.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9c28ada89c468ad30713@syzkaller.appspotmail.com
------------[ cut here ]------------
do not call blocking ops when !TASK_RUNNING; state=2 set at [<000000003d62a0c3>] prepare_to_wait_event+0x2e4/0x3ac kernel/sched/wait.c:-1
WARNING: kernel/sched/core.c:9124 at __might_sleep+0xc0/0xdc kernel/sched/core.c:9120, CPU#0: syz.0.17/4920
Modules linked in:
CPU: 0 UID: 0 PID: 4920 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/02/2026
pstate: 63400005 (nZCv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
pc : __might_sleep+0xc0/0xdc kernel/sched/core.c:9120
lr : __might_sleep+0xc0/0xdc kernel/sched/core.c:9120
sp : ffff8000954d7930
x29: ffff8000954d7930 x28: ffff8000805a9ec8 x27: ffff8000954d7a00
x26: 0000000000000000 x25: ffff8000954d7a08 x24: 0000000000000000
x23: ffff700012a9af3c x22: ffff0000c4c716d0 x21: 0000000000000002
x20: ffff8000869ca160 x19: 000000000000026f x18: 00000000ffffffff
x17: ffff8000801682f0 x16: ffff800080168534 x15: ffff80008034b12c
x14: 0000000000000000 x13: 0000000000000001 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000002 x9 : dd2fee083d5bf500
x8 : dd2fee083d5bf500 x7 : ffff80008048ea5c x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff8000802f8870
x2 : 0000000100000000 x1 : ffff0000c4c70000 x0 : 0000000000000000
Call trace:
__might_sleep+0xc0/0xdc kernel/sched/core.c:9120 (P)
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0xf8/0xf14 kernel/locking/mutex.c:821
mutex_lock_nested+0x24/0x30 kernel/locking/mutex.c:874
class_mutex_constructor include/linux/mutex.h:253 [inline]
futex_pivot_pending+0x30/0xa4 kernel/futex/core.c:1789
futex_hash_allocate+0x73c/0xc20 kernel/futex/core.c:1872
futex_hash_prctl+0xd0/0x324 kernel/futex/core.c:2027
__do_sys_prctl kernel/sys.c:2885 [inline]
__se_sys_prctl kernel/sys.c:2534 [inline]
__arm64_sys_prctl+0x9c0/0x14e8 kernel/sys.c:2534
__invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
invoke_syscall+0x98/0x244 arch/arm64/kernel/syscall.c:49
el0_svc_common+0xec/0x23c arch/arm64/kernel/syscall.c:121
do_el0_svc+0x4c/0x5c arch/arm64/kernel/syscall.c:140
el0_svc+0x64/0x260 arch/arm64/kernel/entry-common.c:758
el0t_64_sync_handler+0x48/0x148 arch/arm64/kernel/entry-common.c:777
el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:590
irq event stamp: 78
hardirqs last enabled at (77): [<ffff800080492020>] vprintk_store+0x924/0xb94 kernel/printk/printk.c:2385
hardirqs last disabled at (78): [<ffff8000869055a8>] el1_brk64+0x20/0x54 arch/arm64/kernel/entry-common.c:445
softirqs last enabled at (54): [<ffff80008013c050>] local_bh_enable include/linux/bottom_half.h:33 [inline]
softirqs last enabled at (54): [<ffff80008013c050>] put_cpu_fpsimd_context arch/arm64/kernel/fpsimd.c:251 [inline]
softirqs last enabled at (54): [<ffff80008013c050>] fpsimd_restore_current_state+0x39c/0x9c8 arch/arm64/kernel/fpsimd.c:1797
softirqs last disabled at (52): [<ffff80008013bcf8>] local_bh_disable include/linux/bottom_half.h:20 [inline]
softirqs last disabled at (52): [<ffff80008013bcf8>] get_cpu_fpsimd_context arch/arm64/kernel/fpsimd.c:234 [inline]
softirqs last disabled at (52): [<ffff80008013bcf8>] fpsimd_restore_current_state+0x44/0x9c8 arch/arm64/kernel/fpsimd.c:1790
---[ end trace 0000000000000000 ]---
---
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] 6+ messages in thread
* Re: [syzbot] [kernel?] WARNING in futex_pivot_pending
2026-08-15 14:36 [syzbot] [kernel?] WARNING in futex_pivot_pending syzbot
@ 2026-08-16 2:25 ` Edward Adam Davis
2026-08-16 2:50 ` syzbot
2026-08-17 4:48 ` Edward Adam Davis
2026-08-17 5:33 ` [PATCH] futex: Temporarily set the task state to running for pivot pending Edward Adam Davis
2 siblings, 1 reply; 6+ messages in thread
From: Edward Adam Davis @ 2026-08-16 2:25 UTC (permalink / raw)
To: syzbot+9c28ada89c468ad30713; +Cc: linux-kernel, syzkaller-bugs
#syz test
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 128c5752f225..154140fb6081 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1786,6 +1786,7 @@ static bool futex_pivot_pending(struct mm_struct *mm)
struct futex_mm_phash *mmph = &mm->futex.phash;
struct futex_private_hash *fph;
+ sched_annotate_sleep();
guard(mutex)(&mmph->lock);
if (!mmph->hash_new)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [syzbot] [kernel?] WARNING in futex_pivot_pending
2026-08-16 2:25 ` Edward Adam Davis
@ 2026-08-16 2:50 ` syzbot
0 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2026-08-16 2:50 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+9c28ada89c468ad30713@syzkaller.appspotmail.com
Tested-by: syzbot+9c28ada89c468ad30713@syzkaller.appspotmail.com
Tested on:
commit: 21d6ac05 Merge branch 'for-next/core' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=11b2c6c6580000
kernel config: https://syzkaller.appspot.com/x/.config?x=95ac36a2cf7bfd28
dashboard link: https://syzkaller.appspot.com/bug?extid=9c28ada89c468ad30713
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=1585e949580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [syzbot] [kernel?] WARNING in futex_pivot_pending
2026-08-15 14:36 [syzbot] [kernel?] WARNING in futex_pivot_pending syzbot
2026-08-16 2:25 ` Edward Adam Davis
@ 2026-08-17 4:48 ` Edward Adam Davis
2026-08-17 5:18 ` syzbot
2026-08-17 5:33 ` [PATCH] futex: Temporarily set the task state to running for pivot pending Edward Adam Davis
2 siblings, 1 reply; 6+ messages in thread
From: Edward Adam Davis @ 2026-08-17 4:48 UTC (permalink / raw)
To: syzbot+9c28ada89c468ad30713; +Cc: linux-kernel, syzkaller-bugs
#syz test
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 128c5752f225..a0b17d2f41da 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1785,14 +1785,24 @@ static bool futex_pivot_pending(struct mm_struct *mm)
{
struct futex_mm_phash *mmph = &mm->futex.phash;
struct futex_private_hash *fph;
+ unsigned int state;
+ bool ret;
+
+ state = current->__state;
+ __set_current_state(TASK_RUNNING);
+ scoped_guard(mutex, &mmph->lock) {
+ if (!mmph->hash_new) {
+ ret = true;
+ goto out;
+ }
- guard(mutex)(&mmph->lock);
-
- if (!mmph->hash_new)
- return true;
+ fph = rcu_dereference_raw(mmph->hash);
+ ret = futex_ref_is_dead(fph);
+ }
+out:
+ __set_current_state(state);
+ return ret;
- fph = rcu_dereference_raw(mmph->hash);
- return futex_ref_is_dead(fph);
}
static bool futex_hash_less(struct futex_private_hash *a,
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [syzbot] [kernel?] WARNING in futex_pivot_pending
2026-08-17 4:48 ` Edward Adam Davis
@ 2026-08-17 5:18 ` syzbot
0 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2026-08-17 5:18 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+9c28ada89c468ad30713@syzkaller.appspotmail.com
Tested-by: syzbot+9c28ada89c468ad30713@syzkaller.appspotmail.com
Tested on:
commit: 21d6ac05 Merge branch 'for-next/core' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=12d1ea25580000
kernel config: https://syzkaller.appspot.com/x/.config?x=95ac36a2cf7bfd28
dashboard link: https://syzkaller.appspot.com/bug?extid=9c28ada89c468ad30713
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=13f1da79580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] futex: Temporarily set the task state to running for pivot pending
2026-08-15 14:36 [syzbot] [kernel?] WARNING in futex_pivot_pending syzbot
2026-08-16 2:25 ` Edward Adam Davis
2026-08-17 4:48 ` Edward Adam Davis
@ 2026-08-17 5:33 ` Edward Adam Davis
2 siblings, 0 replies; 6+ messages in thread
From: Edward Adam Davis @ 2026-08-17 5:33 UTC (permalink / raw)
To: syzbot+9c28ada89c468ad30713
Cc: andrealmeid, dave, dvhart, linux-kernel, mingo, peterz, yaokai34,
syzkaller-bugs, tglx
There is a report of futex_pivot_pending() locking a mutex while not
TASK_RUNNING, which is due to wait_var_event(mm, futex_pivot_pending(mm))
calls __wait_var_event(), which sets the current task state to 2 before
the condition function `futex_pivot_pending()` executes, which triggers
the warning in [1].
Temporarily set the current task state to 0 within futex_pivot_pending()
to allow `mmph->lock` to complete its lifecycle normally.
[1]
do not call blocking ops when !TASK_RUNNING; state=2 set at [<000000003d62a0c3>] prepare_to_wait_event+0x2e4/0x3ac kernel/sched/wait.c:-1
WARNING: kernel/sched/core.c:9124 at __might_sleep+0xc0/0xdc kernel/sched/core.c:9120, CPU#0: syz.0.17/4920
Call trace:
class_mutex_constructor include/linux/mutex.h:253 [inline]
futex_pivot_pending+0x30/0xa4 kernel/futex/core.c:1789
futex_hash_allocate+0x73c/0xc20 kernel/futex/core.c:1872
futex_hash_prctl+0xd0/0x324 kernel/futex/core.c:2027
Fixes: 8e7ff730dd96 ("futex: Fix race in futex_pivot_pending() during private hash resize")
Reported-by: syzbot+9c28ada89c468ad30713@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=9c28ada89c468ad30713
Tested-by: syzbot+9c28ada89c468ad30713@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
kernel/futex/core.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 128c5752f225..a0b17d2f41da 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1785,14 +1785,24 @@ static bool futex_pivot_pending(struct mm_struct *mm)
{
struct futex_mm_phash *mmph = &mm->futex.phash;
struct futex_private_hash *fph;
+ unsigned int state;
+ bool ret;
+
+ state = current->__state;
+ __set_current_state(TASK_RUNNING);
+ scoped_guard(mutex, &mmph->lock) {
+ if (!mmph->hash_new) {
+ ret = true;
+ goto out;
+ }
- guard(mutex)(&mmph->lock);
-
- if (!mmph->hash_new)
- return true;
+ fph = rcu_dereference_raw(mmph->hash);
+ ret = futex_ref_is_dead(fph);
+ }
+out:
+ __set_current_state(state);
+ return ret;
- fph = rcu_dereference_raw(mmph->hash);
- return futex_ref_is_dead(fph);
}
static bool futex_hash_less(struct futex_private_hash *a,
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-17 5:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-15 14:36 [syzbot] [kernel?] WARNING in futex_pivot_pending syzbot
2026-08-16 2:25 ` Edward Adam Davis
2026-08-16 2:50 ` syzbot
2026-08-17 4:48 ` Edward Adam Davis
2026-08-17 5:18 ` syzbot
2026-08-17 5:33 ` [PATCH] futex: Temporarily set the task state to running for pivot pending Edward Adam Davis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.