From: Jinmo Yang <jinmo44.yang@gmail.com>
To: David Rheinsberg <david@readahead.eu>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>
Cc: Jinmo Yang <jinmo44.yang@gmail.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: HID: uhid: NULL outq entry reached with head != tail
Date: Sat, 28 Nov 2026 11:04:04 +0000 [thread overview]
Message-ID: <20261128110415.772810-2-jinmo44.yang@gmail.com> (raw)
Found by coverage-guided fuzzing of the HID subsystem through /dev/uhid.
No patch is attached; the exact failing interleaving is not yet captured, and
I am reporting the observed queue invariant and locking mismatch for owner
review.
Kernel: mainline 7.2.0-g66498c75b4f8 (arm64, KASAN)
File: drivers/hid/uhid.c
Impact: NULL pointer read; kernel panic
Repro: syzkaller race; independently observed on a Pixel 9 Pro
## Report
KASAN reported a NULL source read in uhid_char_read():
BUG: KASAN: null-ptr-deref in uhid_char_read
Read of size 4380 at address 0x0
On a Pixel 9 Pro, hardened usercopy caught the same condition:
usercopy: Kernel memory exposure attempt detected from null address
(offset 0, size 4380)!
kernel BUG at mm/usercopy.c
usercopy_abort
__check_object_size
uhid_char_read
vfs_read
4380 is sizeof(struct uhid_event) on that kernel.
## Analysis
uhid_char_read() first decides the queue is nonempty and later copies the
tail entry:
len = min(count, sizeof(**uhid->outq));
if (copy_to_user(buffer, uhid->outq[uhid->tail], len))
...
The reports prove that uhid->outq[uhid->tail] was NULL while the head/tail
state allowed the read to proceed. The trigger churns output-event
generation and reads while repeatedly creating and destroying uhid devices.
uhid_queue() publishes the slot and head under qlock. The consumer updates
tail under qlock, but uhid_char_read() tests head against tail and
dereferences outq[tail] without holding qlock; it holds devlock instead.
Queue producers do not take devlock, so that mutex does not make the
slot/head publication atomic to the reader. On arm64, the observed state is
consistent with the reader seeing the new head before the corresponding slot
value.
I have not captured that precise load/store interleaving, so I am not claiming
more than the demonstrated NULL slot plus the source-level locking mismatch.
The original KASAN report carried only the warning taint and no preceding
memory-corruption report. The independent hardened-usercopy panic on a
shipping-derived kernel also reaches uhid_char_read directly.
## Upstream status
Rechecked against mainline, linux-next, HID maintainer branches, and lore
through 2026-11-28. The invariant violation remains unpatched and I found no
matching submission.
reply other threads:[~2026-11-28 11:06 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=20261128110415.772810-2-jinmo44.yang@gmail.com \
--to=jinmo44.yang@gmail.com \
--cc=bentiss@kernel.org \
--cc=david@readahead.eu \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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