[syzbot] [kernel?] KASAN: slab-out-of-bounds Read in __futex_pivot_hash

1 view
Skip to first unread message

syzbot

unread,
Jun 1, 2025, 10:01:31 PMJun 1
Hello,

syzbot found the following issue on:

HEAD commit: feacb1774bd5 Merge tag 'sched_ext-for-6.16' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=172ec482580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d2e9181801c1d2a6
dashboard link: https://syzkaller.appspot.com/bug?extid=0a5079ee014f4b907817
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14cc0970580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1436fbf4580000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-feacb177.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d08852142ce8/vmlinux-feacb177.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7e6cf2dd1995/bzImage-feacb177.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

==================================================================
BUG: KASAN: slab-out-of-bounds in __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
BUG: KASAN: slab-out-of-bounds in _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
Read of size 1 at addr ffff8880254867e0 by task syz-executor404/6471

CPU: 0 UID: 0 PID: 6471 Comm: syz-executor404 Not tainted 6.15.0-syzkaller-03589-gfeacb1774bd5 #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:408 [inline]
print_report+0xcd/0x680 mm/kasan/report.c:521
kasan_report+0xe0/0x110 mm/kasan/report.c:634
__kasan_check_byte+0x36/0x50 mm/kasan/common.c:557
kasan_check_byte include/linux/kasan.h:399 [inline]
lock_acquire kernel/locking/lockdep.c:5845 [inline]
lock_acquire+0xfc/0x350 kernel/locking/lockdep.c:5828
__raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
_raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
spin_lock include/linux/spinlock.h:351 [inline]
futex_rehash_private kernel/futex/core.c:213 [inline]
__futex_pivot_hash+0x1dd/0x540 kernel/futex/core.c:251
futex_hash_allocate+0xad1/0xf00 kernel/futex/core.c:1662
futex_hash_prctl+0x1f4/0x650 kernel/futex/core.c:1757
__do_sys_prctl+0x171f/0x24c0 kernel/sys.c:2825
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f1955b6f2a9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f1955b28238 EFLAGS: 00000246 ORIG_RAX: 000000000000009d
RAX: ffffffffffffffda RBX: 00007f1955bf9308 RCX: 00007f1955b6f2a9
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 000000000000004e
RBP: 00007f1955bf9300 R08: 0000000000000000 R09: 00007f1955b286c0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f1955bf930c
R13: 0000000000000000 R14: 00007ffeebf41a80 R15: 00007ffeebf41b68
</TASK>

Allocated by task 6472:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
kasan_kmalloc include/linux/kasan.h:260 [inline]
__do_kmalloc_node mm/slub.c:4327 [inline]
__kvmalloc_node_noprof+0x279/0x620 mm/slub.c:5012
futex_hash_allocate+0x49d/0xf00 kernel/futex/core.c:1601
futex_hash_prctl+0x1f4/0x650 kernel/futex/core.c:1757
__do_sys_prctl+0x171f/0x24c0 kernel/sys.c:2825
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff888025486780
which belongs to the cache kmalloc-cg-64 of size 64
The buggy address is located 32 bytes to the right of
allocated 64-byte region [ffff888025486780, ffff8880254867c0)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25486
ksm flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000000 ffff88801b449a40 ffffea000074d500 dead000000000003
raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 223, tgid 223 (kworker/u32:5), ts 8925570999, free_ts 8794215069
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1714
prep_new_page mm/page_alloc.c:1722 [inline]
get_page_from_freelist+0x135c/0x3950 mm/page_alloc.c:3684
__alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:4974
alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2301
alloc_slab_page mm/slub.c:2450 [inline]
allocate_slab mm/slub.c:2618 [inline]
new_slab+0x23b/0x330 mm/slub.c:2672
___slab_alloc+0xd9c/0x1940 mm/slub.c:3858
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3948
__slab_alloc_node mm/slub.c:4023 [inline]
slab_alloc_node mm/slub.c:4184 [inline]
__do_kmalloc_node mm/slub.c:4326 [inline]
__kmalloc_noprof+0x2f2/0x510 mm/slub.c:4339
kmalloc_noprof include/linux/slab.h:909 [inline]
kzalloc_noprof include/linux/slab.h:1039 [inline]
lsm_blob_alloc+0x68/0x90 security/security.c:684
lsm_cred_alloc security/security.c:701 [inline]
security_prepare_creds+0x30/0x270 security/security.c:3241
prepare_creds+0x56f/0x7d0 kernel/cred.c:242
copy_creds+0xa7/0xa50 kernel/cred.c:312
copy_process+0x10ff/0x9170 kernel/fork.c:2293
kernel_clone+0xfc/0x960 kernel/fork.c:2859
user_mode_thread+0xc7/0x110 kernel/fork.c:2937
call_usermodehelper_exec_work kernel/umh.c:171 [inline]
call_usermodehelper_exec_work+0xcb/0x170 kernel/umh.c:157
page last free pid 54 tgid 54 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1258 [inline]
__free_frozen_pages+0x7f8/0x1180 mm/page_alloc.c:2721
vfree+0x176/0xa40 mm/vmalloc.c:3384
delayed_vfree_work+0x56/0x70 mm/vmalloc.c:3304
process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3238
process_scheduled_works kernel/workqueue.c:3321 [inline]
worker_thread+0x6c8/0xf10 kernel/workqueue.c:3402
kthread+0x3c5/0x780 kernel/kthread.c:464
ret_from_fork+0x5d4/0x6f0 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

Memory state around the buggy address:
ffff888025486680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888025486700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff888025486780: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
^
ffff888025486800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888025486880: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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 [email protected].

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

Hillf Danton

unread,
Jun 2, 2025, 2:16:37 AMJun 2
> Date: Sun, 01 Jun 2025 12:01:29 -0700
> syzbot found the following issue on:
>
> HEAD commit: feacb1774bd5 Merge tag 'sched_ext-for-6.16' of git://git.k..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=172ec482580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=d2e9181801c1d2a6
> dashboard link: https://syzkaller.appspot.com/bug?extid=0a5079ee014f4b907817
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14cc0970580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1436fbf4580000

#syz test

--- x/kernel/futex/core.c
+++ y/kernel/futex/core.c
@@ -248,7 +248,9 @@ static bool __futex_pivot_hash(struct mm
return false;
}

+ rcu_read_lock();
futex_rehash_private(fph, new);
+ rcu_read_unlock();
}
rcu_assign_pointer(mm->futex_phash, new);
kvfree_rcu(fph, rcu);
--

syzbot

unread,
Jun 2, 2025, 2:31:04 AMJun 2
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-out-of-bounds Read in __futex_pivot_hash

==================================================================
BUG: KASAN: slab-out-of-bounds in __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
BUG: KASAN: slab-out-of-bounds in _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
Read of size 1 at addr ffff888052d074e0 by task syz.0.16/6505

CPU: 1 UID: 0 PID: 6505 Comm: syz.0.16 Not tainted 6.15.0-syzkaller-gcd2e103d57e5-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:408 [inline]
print_report+0xcd/0x680 mm/kasan/report.c:521
kasan_report+0xe0/0x110 mm/kasan/report.c:634
__kasan_check_byte+0x36/0x50 mm/kasan/common.c:557
kasan_check_byte include/linux/kasan.h:399 [inline]
lock_acquire kernel/locking/lockdep.c:5845 [inline]
lock_acquire+0xfc/0x350 kernel/locking/lockdep.c:5828
__raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
_raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
spin_lock include/linux/spinlock.h:351 [inline]
futex_rehash_private kernel/futex/core.c:213 [inline]
__futex_pivot_hash+0x225/0x6d0 kernel/futex/core.c:252
futex_hash_allocate+0xad1/0xf00 kernel/futex/core.c:1664
futex_hash_prctl+0x1f4/0x650 kernel/futex/core.c:1759
__do_sys_prctl+0x171f/0x24c0 kernel/sys.c:2825
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f7e8738e969
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f7e882e3038 EFLAGS: 00000246 ORIG_RAX: 000000000000009d
RAX: ffffffffffffffda RBX: 00007f7e875b5fa0 RCX: 00007f7e8738e969
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 000000000000004e
RBP: 00007f7e87410ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f7e875b5fa0 R15: 00007fff0b994368
</TASK>

Allocated by task 6506:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
kasan_kmalloc include/linux/kasan.h:260 [inline]
__do_kmalloc_node mm/slub.c:4327 [inline]
__kvmalloc_node_noprof+0x279/0x620 mm/slub.c:5012
futex_hash_allocate+0x49d/0xf00 kernel/futex/core.c:1603
futex_hash_prctl+0x1f4/0x650 kernel/futex/core.c:1759
__do_sys_prctl+0x171f/0x24c0 kernel/sys.c:2825
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff888052d07480
which belongs to the cache kmalloc-cg-64 of size 64
The buggy address is located 32 bytes to the right of
allocated 64-byte region [ffff888052d07480, ffff888052d074c0)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888052d07800 pfn:0x52d07
memcg:ffff888029437c01
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000000 ffff88801b849a40 dead000000000122 0000000000000000
raw: ffff888052d07800 000000008020001e 00000000f5000000 ffff888029437c01
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 6405, tgid 6405 (syz-executor), ts 88336803313, free_ts 88336042403
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1704
prep_new_page mm/page_alloc.c:1712 [inline]
get_page_from_freelist+0x1321/0x3890 mm/page_alloc.c:3669
__alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:4959
alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2419
alloc_slab_page mm/slub.c:2450 [inline]
allocate_slab mm/slub.c:2618 [inline]
new_slab+0x23b/0x330 mm/slub.c:2672
___slab_alloc+0xd9c/0x1940 mm/slub.c:3858
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3948
__slab_alloc_node mm/slub.c:4023 [inline]
slab_alloc_node mm/slub.c:4184 [inline]
__do_kmalloc_node mm/slub.c:4326 [inline]
__kvmalloc_node_noprof+0x3af/0x620 mm/slub.c:5012
allocate_hook_entries_size net/netfilter/core.c:58 [inline]
nf_hook_entries_grow+0x22b/0x860 net/netfilter/core.c:137
__nf_register_net_hook+0x1cd/0x730 net/netfilter/core.c:432
nf_register_net_hook+0x109/0x160 net/netfilter/core.c:575
nf_register_net_hooks+0x5d/0xd0 net/netfilter/core.c:591
arpt_register_table+0x29b/0x410 net/ipv4/netfilter/arp_tables.c:1561
arptable_filter_table_init+0x40/0x60 net/ipv4/netfilter/arptable_filter.c:39
xt_find_table_lock+0x2e1/0x520 net/netfilter/x_tables.c:1260
xt_request_find_table_lock+0x28/0xf0 net/netfilter/x_tables.c:1285
page last free pid 6405 tgid 6405 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1248 [inline]
__free_frozen_pages+0x7fe/0x1180 mm/page_alloc.c:2706
___free_pages_bulk mm/kasan/shadow.c:332 [inline]
__kasan_populate_vmalloc mm/kasan/shadow.c:375 [inline]
kasan_populate_vmalloc+0x18c/0x1f0 mm/kasan/shadow.c:417
alloc_vmap_area+0x959/0x29c0 mm/vmalloc.c:2084
__get_vm_area_node+0x1ca/0x330 mm/vmalloc.c:3179
__vmalloc_node_range_noprof+0x271/0x14b0 mm/vmalloc.c:3845
__vmalloc_node_noprof+0xad/0xf0 mm/vmalloc.c:3948
ebt_register_table+0x243/0xfc0 net/bridge/netfilter/ebtables.c:1211
find_inlist_lock_noload net/bridge/netfilter/ebtables.c:343 [inline]
find_inlist_lock.constprop.0+0x1d0/0x730 net/bridge/netfilter/ebtables.c:370
find_table_lock net/bridge/netfilter/ebtables.c:379 [inline]
do_ebt_get_ctl+0x225/0x7c0 net/bridge/netfilter/ebtables.c:2468
nf_getsockopt+0x7c/0xe0 net/netfilter/nf_sockopt.c:116
ip_getsockopt+0x18c/0x1e0 net/ipv4/ip_sockglue.c:1777
tcp_getsockopt+0x9e/0x100 net/ipv4/tcp.c:4760
do_sock_getsockopt+0x3fc/0x800 net/socket.c:2357
__sys_getsockopt+0x12f/0x260 net/socket.c:2386
__do_sys_getsockopt net/socket.c:2393 [inline]
__se_sys_getsockopt net/socket.c:2390 [inline]
__x64_sys_getsockopt+0xbd/0x160 net/socket.c:2390
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94

Memory state around the buggy address:
ffff888052d07380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888052d07400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff888052d07480: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
^
ffff888052d07500: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
ffff888052d07580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================


Tested on:

commit: cd2e103d Merge tag 'hardening-v6.16-rc1-fix1-take2' of..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=168ccc82580000
kernel config: https://syzkaller.appspot.com/x/.config?x=4df26174733e11f3
dashboard link: https://syzkaller.appspot.com/bug?extid=0a5079ee014f4b907817
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1172a80c580000

Edward Adam Davis

unread,
Jun 2, 2025, 6:00:14 AMJun 2
#syz test

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 19a2c65f3d37..ea6b8266efb9 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1754,7 +1754,10 @@ int futex_hash_prctl(unsigned long arg2, unsigned long arg3, unsigned long arg4)
return -EINVAL;
if (arg4 & FH_FLAG_IMMUTABLE)
flags |= FH_IMMUTABLE;
+ DEFINE_MUTEX(fha_syn);
+ mutex_lock(&fha_syn);
ret = futex_hash_allocate(arg3, flags);
+ mutex_unlock(&fha_syn);
break;

case PR_FUTEX_HASH_GET_SLOTS:

syzbot

unread,
Jun 2, 2025, 6:15:04 AMJun 2
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
INFO: trying to register non-static key in futex_hash_prctl

INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 3 UID: 0 PID: 6500 Comm: syz.0.16 Not tainted 6.15.0-syzkaller-gcd2e103d57e5-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
assign_lock_key kernel/locking/lockdep.c:987 [inline]
register_lock_class+0x4a3/0x4c0 kernel/locking/lockdep.c:1302
__lock_acquire+0xa6/0x1c90 kernel/locking/lockdep.c:5115
lock_acquire kernel/locking/lockdep.c:5871 [inline]
lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5828
__mutex_lock_common kernel/locking/mutex.c:602 [inline]
__mutex_lock+0x199/0xb90 kernel/locking/mutex.c:747
futex_hash_prctl+0x2fc/0x770 kernel/futex/core.c:1758
__do_sys_prctl+0x171f/0x24c0 kernel/sys.c:2825
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f516c98e969
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f516d8a5038 EFLAGS: 00000246 ORIG_RAX: 000000000000009d
RAX: ffffffffffffffda RBX: 00007f516cbb5fa0 RCX: 00007f516c98e969
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 000000000000004e
RBP: 00007f516ca10ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f516cbb5fa0 R15: 00007ffc88069c38
</TASK>


Tested on:

commit: cd2e103d Merge tag 'hardening-v6.16-rc1-fix1-take2' of..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=104b700c580000
patch: https://syzkaller.appspot.com/x/patch.diff?x=1574b970580000

Edward Adam Davis

unread,
Jun 2, 2025, 6:20:22 AMJun 2
#syz test

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 19a2c65f3d37..ea6b8266efb9 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1754,7 +1754,10 @@ int futex_hash_prctl(unsigned long arg2, unsigned long arg3, unsigned long arg4)
return -EINVAL;
if (arg4 & FH_FLAG_IMMUTABLE)
flags |= FH_IMMUTABLE;
+ static DEFINE_MUTEX(fha_syn);

syzbot

unread,
Jun 2, 2025, 6:40:04 AMJun 2
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: [email protected]
Tested-by: [email protected]

Tested on:

commit: cd2e103d Merge tag 'hardening-v6.16-rc1-fix1-take2' of..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=135b700c580000
patch: https://syzkaller.appspot.com/x/patch.diff?x=107b01d4580000

Note: testing is done by a robot and is best-effort only.

Edward Adam Davis

unread,
Jun 2, 2025, 7:37:45 AMJun 2
Prevent different processes from setting the hash table at the same
time to avoid hash table damage.

Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=0a5079ee014f4b907817
Tested-by: [email protected]
Signed-off-by: Edward Adam Davis <[email protected]>
---
kernel/futex/core.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 19a2c65f3d37..818dc082670f 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1754,7 +1754,12 @@ int futex_hash_prctl(unsigned long arg2, unsigned long arg3, unsigned long arg4)
return -EINVAL;
if (arg4 & FH_FLAG_IMMUTABLE)
flags |= FH_IMMUTABLE;
+
+ static DEFINE_MUTEX(fha_syn);
+
+ mutex_lock(&fha_syn);
ret = futex_hash_allocate(arg3, flags);
+ mutex_unlock(&fha_syn);
break;

case PR_FUTEX_HASH_GET_SLOTS:
--
2.43.0

Hillf Danton

unread,
Jun 2, 2025, 7:38:22 AMJun 2
> Date: Sun, 01 Jun 2025 12:01:29 -0700
> syzbot found the following issue on:
>
> HEAD commit: feacb1774bd5 Merge tag 'sched_ext-for-6.16' of git://git.k..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=172ec482580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=d2e9181801c1d2a6
> dashboard link: https://syzkaller.appspot.com/bug?extid=0a5079ee014f4b907817
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14cc0970580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1436fbf4580000

#syz test

--- x/kernel/futex/core.c
+++ y/kernel/futex/core.c
@@ -205,6 +205,8 @@ static void futex_rehash_private(struct
unsigned int slots = old->hash_mask + 1;
unsigned int i;

+ if (!old->hash_mask)
+ return;
for (i = 0; i < slots; i++) {
struct futex_q *this, *tmp;

--

syzbot

unread,
Jun 2, 2025, 7:58:06 AMJun 2
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: [email protected]
Tested-by: [email protected]

Tested on:

commit: cd2e103d Merge tag 'hardening-v6.16-rc1-fix1-take2' of..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=132bcc82580000
kernel config: https://syzkaller.appspot.com/x/.config?x=4df26174733e11f3
dashboard link: https://syzkaller.appspot.com/bug?extid=0a5079ee014f4b907817
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=12af700c580000
Reply all
Reply to author
Forward
0 new messages