* [syzbot] [kernel?] KASAN: wild-memory-access Read in get_futex_key
@ 2025-05-27 13:36 syzbot
2025-05-27 14:22 ` Peter Zijlstra
0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2025-05-27 13:36 UTC (permalink / raw)
To: andrealmeid, dave, dvhart, linux-kernel, mingo, peterz,
syzkaller-bugs, tglx
Hello,
syzbot found the following issue on:
HEAD commit: 785cdec46e92 Merge tag 'x86-core-2025-05-25' of git://git...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13e47df4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d7ed3189f3c3d3f3
dashboard link: https://syzkaller.appspot.com/bug?extid=9afaf6749e3a7aa1bdf3
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=17ad26d4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=157f3170580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/af5446d375b0/disk-785cdec4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/eb59d48f91fb/vmlinux-785cdec4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/188617605a08/bzImage-785cdec4.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9afaf6749e3a7aa1bdf3@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: wild-memory-access in instrument_atomic_read include/linux/instrumented.h:68 [inline]
BUG: KASAN: wild-memory-access in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
BUG: KASAN: wild-memory-access in node_state include/linux/nodemask.h:429 [inline]
BUG: KASAN: wild-memory-access in get_futex_key+0x595/0x1540 kernel/futex/core.c:587
Read of size 8 at addr 1fffffff818b9088 by task syz-executor931/5831
CPU: 0 UID: 0 PID: 5831 Comm: syz-executor931 Not tainted 6.15.0-syzkaller-01958-g785cdec46e92 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
kasan_report+0xe0/0x110 mm/kasan/report.c:634
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0x100/0x1b0 mm/kasan/generic.c:189
instrument_atomic_read include/linux/instrumented.h:68 [inline]
_test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
node_state include/linux/nodemask.h:429 [inline]
get_futex_key+0x595/0x1540 kernel/futex/core.c:587
futex_wake+0xea/0x530 kernel/futex/waitwake.c:165
__do_sys_futex_wake kernel/futex/syscalls.c:354 [inline]
__se_sys_futex_wake kernel/futex/syscalls.c:338 [inline]
__x64_sys_futex_wake+0x23d/0x2b0 kernel/futex/syscalls.c:338
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x230 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fec9a512429
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe390e0498 EFLAGS: 00000246 ORIG_RAX: 00000000000001c6
RAX: ffffffffffffffda RBX: 00007ffe390e0678 RCX: 00007fec9a512429
RDX: 0000000000000006 RSI: 0000000000000008 RDI: 0000200000000140
RBP: 00007fec9a585610 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000006 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffe390e0668 R14: 0000000000000001 R15: 0000000000000001
</TASK>
==================================================================
---
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] 4+ messages in thread
* Re: [syzbot] [kernel?] KASAN: wild-memory-access Read in get_futex_key
2025-05-27 13:36 [syzbot] [kernel?] KASAN: wild-memory-access Read in get_futex_key syzbot
@ 2025-05-27 14:22 ` Peter Zijlstra
2025-05-27 15:31 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2025-05-27 14:22 UTC (permalink / raw)
To: syzbot
Cc: andrealmeid, dave, dvhart, linux-kernel, mingo, syzkaller-bugs,
tglx, Sebastian Andrzej Siewior
On Tue, May 27, 2025 at 06:36:35AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 785cdec46e92 Merge tag 'x86-core-2025-05-25' of git://git...
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=13e47df4580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=d7ed3189f3c3d3f3
> dashboard link: https://syzkaller.appspot.com/bug?extid=9afaf6749e3a7aa1bdf3
> 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=17ad26d4580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=157f3170580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/af5446d375b0/disk-785cdec4.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/eb59d48f91fb/vmlinux-785cdec4.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/188617605a08/bzImage-785cdec4.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+9afaf6749e3a7aa1bdf3@syzkaller.appspotmail.com
>
> ==================================================================
> BUG: KASAN: wild-memory-access in instrument_atomic_read include/linux/instrumented.h:68 [inline]
> BUG: KASAN: wild-memory-access in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
> BUG: KASAN: wild-memory-access in node_state include/linux/nodemask.h:429 [inline]
> BUG: KASAN: wild-memory-access in get_futex_key+0x595/0x1540 kernel/futex/core.c:587
> Read of size 8 at addr 1fffffff818b9088 by task syz-executor931/5831
>
> CPU: 0 UID: 0 PID: 5831 Comm: syz-executor931 Not tainted 6.15.0-syzkaller-01958-g785cdec46e92 #0 PREEMPT(full)
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
> Call Trace:
> <TASK>
> __dump_stack lib/dump_stack.c:94 [inline]
> dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
> kasan_report+0xe0/0x110 mm/kasan/report.c:634
> check_region_inline mm/kasan/generic.c:183 [inline]
> kasan_check_range+0x100/0x1b0 mm/kasan/generic.c:189
> instrument_atomic_read include/linux/instrumented.h:68 [inline]
> _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
> node_state include/linux/nodemask.h:429 [inline]
> get_futex_key+0x595/0x1540 kernel/futex/core.c:587
Does the this help?
---
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 19a2c65f3d37..e9e46293c0c1 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -583,8 +583,7 @@ int get_futex_key(u32 __user *uaddr, unsigned int flags, union futex_key *key,
if (futex_get_value(&node, naddr))
return -EFAULT;
- if (node != FUTEX_NO_NODE &&
- (node >= MAX_NUMNODES || !node_possible(node)))
+ if ((unsigned)node >= nr_node_ids || !node_possible(node))
return -EINVAL;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [syzbot] [kernel?] KASAN: wild-memory-access Read in get_futex_key
2025-05-27 14:22 ` Peter Zijlstra
@ 2025-05-27 15:31 ` Sebastian Andrzej Siewior
2025-05-27 15:39 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-05-27 15:31 UTC (permalink / raw)
To: Peter Zijlstra
Cc: syzbot, andrealmeid, dave, dvhart, linux-kernel, mingo,
syzkaller-bugs, tglx
On 2025-05-27 16:22:17 [+0200], Peter Zijlstra wrote:
> > get_futex_key+0x595/0x1540 kernel/futex/core.c:587
>
> Does the this help?
it avoids boom but reject FUTEX_NO_NODE. What about
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 19a2c65f3d373..d0f5645eac61c 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -583,8 +583,9 @@ int get_futex_key(u32 __user *uaddr, unsigned int flags, union futex_key *key,
if (futex_get_value(&node, naddr))
return -EFAULT;
- if (node != FUTEX_NO_NODE &&
- (node >= MAX_NUMNODES || !node_possible(node)))
+ if ((node != FUTEX_NO_NODE) &&
+ (node < 0 || node > nr_node_ids ||
+ !node_possible(node)))
return -EINVAL;
}
Sebastian
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [syzbot] [kernel?] KASAN: wild-memory-access Read in get_futex_key
2025-05-27 15:31 ` Sebastian Andrzej Siewior
@ 2025-05-27 15:39 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-05-27 15:39 UTC (permalink / raw)
To: Peter Zijlstra
Cc: syzbot, andrealmeid, dave, dvhart, linux-kernel, mingo,
syzkaller-bugs, tglx
On 2025-05-27 17:31:07 [+0200], To Peter Zijlstra wrote:
> On 2025-05-27 16:22:17 [+0200], Peter Zijlstra wrote:
> > > get_futex_key+0x595/0x1540 kernel/futex/core.c:587
> >
> > Does the this help?
>
> it avoids boom but reject FUTEX_NO_NODE. What about
maybe
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 19a2c65f3d373..558c523766461 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -583,8 +583,9 @@ int get_futex_key(u32 __user *uaddr, unsigned int flags, union futex_key *key,
if (futex_get_value(&node, naddr))
return -EFAULT;
- if (node != FUTEX_NO_NODE &&
- (node >= MAX_NUMNODES || !node_possible(node)))
+ if ((node != FUTEX_NO_NODE) &&
+ (node < 0 || node > MAX_NUMNODES ||
+ !node_possible(node)))
return -EINVAL;
}
to avoid the memory access on nr_node_ids since we need to go through
node_possible() we could use a constant to ensure it is not too big.
Sebastian
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-27 15:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27 13:36 [syzbot] [kernel?] KASAN: wild-memory-access Read in get_futex_key syzbot
2025-05-27 14:22 ` Peter Zijlstra
2025-05-27 15:31 ` Sebastian Andrzej Siewior
2025-05-27 15:39 ` Sebastian Andrzej Siewior
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.