The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: syzbot <syzbot+542d2bc50fc9545a27d6@syzkaller.appspotmail.com>
To: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org,
	 daniel@iogearbox.net, eddyz87@gmail.com, emil@etsalapatis.com,
	 ihor.solodrai@linux.dev, jolsa@kernel.org,
	linux-kernel@vger.kernel.org,  martin.lau@linux.dev,
	memxor@gmail.com, song@kernel.org,
	 syzkaller-bugs@googlegroups.com, yonghong.song@linux.dev
Subject: [syzbot] [bpf?] KCSAN: data-race in bcmp / htab_lru_map_update_elem
Date: Tue, 24 Nov 2026 16:53:57 -0800	[thread overview]
Message-ID: <6b0631a5.eee51036.26eb72.03da.GAE@google.com> (raw)

Hello,

syzbot found the following issue on:

HEAD commit:    b6a9fa34ce41 Linux 7.4-rc4
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17783865580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
dashboard link: https://syzkaller.appspot.com/bug?extid=542d2bc50fc9545a27d6
compiler:       Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1cd533522ae8/disk-b6a9fa34.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/19d6c1c369e3/vmlinux-b6a9fa34.xz
kernel image: https://storage.googleapis.com/syzbot-assets/dfb541770724/bzImage-b6a9fa34.xz

AI-generated root cause summary:
Lockless RCU lookups in `BPF_MAP_TYPE_LRU_HASH` maps (`__lookup_elem_raw()`)
traverse `hlist_nulls` buckets and compare `l->key` via `memcmp()` without
waiting for an RCU grace period when elements are recycled. Concurrently,
`htab_lru_map_update_elem()` -> `prealloc_lru_pop()` evicts/pops an element `l`
via `bpf_lru_pop_free()` (which unlinks it with `hlist_nulls_del_rcu()` and
immediately writes the new `hash`) and overwrites `l->elem.key` with `memcpy()`.
An RCU reader that already loaded `l` and observes `htab_elem_hash(l) == hash`
concurrently executes `memcmp(&l->key, key, key_size)` against the in-progress
`memcpy()`, triggering a KCSAN data race and allowing torn key comparisons.

full analysis:  https://syzkaller.appspot.com/x/ai_root_cause?x=542d2bc50fc9545a27d6

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+542d2bc50fc9545a27d6@syzkaller.appspotmail.com

==================================================================
BUG: KCSAN: data-race in bcmp / htab_lru_map_update_elem

write to 0xffff88811ee5cda0 of 280 bytes by task 12413 on cpu 0:
 prealloc_lru_pop kernel/bpf/hashtab.c:407 [inline]
 htab_lru_map_update_elem+0x223/0x7d0 kernel/bpf/hashtab.c:1516
 bpf_map_update_value+0x4f7/0x570 kernel/bpf/syscall.c:297
 generic_map_update_batch+0x4e6/0x700 kernel/bpf/syscall.c:2125
 bpf_map_do_batch+0x26a/0x3b0 kernel/bpf/syscall.c:5849
 __sys_bpf+0x784/0xc50 kernel/bpf/syscall.c:-1
 __do_sys_bpf kernel/bpf/syscall.c:6582 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:6579 [inline]
 __x64_sys_bpf+0x69/0x80 kernel/bpf/syscall.c:6579
 x64_sys_call+0xf26/0x2550 arch/x86/include/generated/asm/syscalls_64.h:322
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff88811ee5ce88 of 8 bytes by task 12419 on cpu 1:
 memcmp lib/string.c:665 [inline]
 bcmp+0x23/0x90 lib/string.c:697
 memcmp include/linux/fortify-string.h:675 [inline]
 __lookup_elem_raw kernel/bpf/hashtab.c:827 [inline]
 lookup_nulls_elem_raw kernel/bpf/hashtab.c:865 [inline]
 __htab_lookup kernel/bpf/hashtab.c:889 [inline]
 __htab_map_lookup_elem+0x246/0x390 kernel/bpf/hashtab.c:906
 __htab_lru_map_lookup_elem kernel/bpf/hashtab.c:973 [inline]
 htab_lru_map_lookup_elem_sys+0x1d/0x60 kernel/bpf/hashtab.c:991
 bpf_map_copy_value+0x442/0x500 kernel/bpf/syscall.c:-1
 map_lookup_elem+0x511/0x700 kernel/bpf/syscall.c:1847
 __sys_bpf+0x683/0xc50 kernel/bpf/syscall.c:6440
 __do_sys_bpf kernel/bpf/syscall.c:6582 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:6579 [inline]
 __x64_sys_bpf+0x69/0x80 kernel/bpf/syscall.c:6579
 x64_sys_call+0xf26/0x2550 arch/x86/include/generated/asm/syscalls_64.h:322
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 12419 Comm: syz.0.3950 Not tainted syzkaller #0 PREEMPT(lazy) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================


---
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 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

                 reply	other threads:[~2026-11-25  0:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b0631a5.eee51036.26eb72.03da.GAE@google.com \
    --to=syzbot+542d2bc50fc9545a27d6@syzkaller.appspotmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=song@kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox