From: Yu Junzhe <junzheyu1@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@kernel.org>,
Mikulas Patocka <mpatocka@redhat.com>,
Benjamin Marzinski <bmarzins@redhat.com>
Cc: linux-block@vger.kernel.org, dm-devel@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: [BUG] blk_update_request: NULL integrity complete_fn on loop via dm-crypt integrity:none
Date: Mon, 30 Nov 2026 11:52:22 +0000 [thread overview]
Message-ID: <20261130115222.174-1-junzheyu1@gmail.com> (raw)
Hello,
I am reporting a NULL-pointer dereference in blk_update_request() on a
successful REQ_INTEGRITY read. The request flag is set by dm-crypt
"integrity:<bytes>:none" and the request completes on a loop queue that
never registered an integrity profile.
Summary
=======
On 6.6, blk_update_request() does:
if (blk_integrity_rq(req) && req_op(req) == REQ_OP_READ &&
error == BLK_STS_OK)
req->q->integrity.profile->complete_fn(req, nr_bytes);
blk_integrity_rq() tests only rq->cmd_flags & REQ_INTEGRITY. The same
unguarded call is in blk_complete_request().
dm-crypt "integrity:16:none" sets on_disk_tag_size. crypt_integrity_ctr(),
which requires an underlying DM-DIF-EXT-TAG profile, runs only for AEAD
or an integrity IV, so "none" loads on a plain loop device. On a read,
kcryptd_io_read() clones the bio onto that loop device and
dm_crypt_integrity_io_alloc() calls bio_integrity_alloc(), which sets
REQ_INTEGRITY. Loop never calls blk_integrity_register(), so
q->integrity.profile is NULL and the completion faults at offset 0x18.
Affected
========
Same PoC (loop + dm-crypt integrity:16:none + read), KASAN, 2026-11-30:
- Crashes: 6.6.163, 6.1.193, 5.15.226, 5.10.275
(RIP in blk_update_request, KASAN range [0x18-0x1f], profile pointer 0)
- Does not crash: 7.4-rc5, 6.18.65, 6.12.119
(crypt table loads, 32 reads return, no oops)
- First seen on 6.6.144 (campaign crash 7b701911f170e96193541cff13ccd4729c7fc5b6)
- v6.11 removed struct blk_integrity_profile
(e9f5f44ad372 "block: remove the blk_integrity_profile structure").
On 6.12 and later, integrity:N:none also leaves tuple_size at 0, so
the read is not tagged REQ_INTEGRITY.
- Files: block/blk-mq.c, drivers/md/dm-crypt.c
- Config: CONFIG_BLK_DEV_INTEGRITY=y, CONFIG_DM_CRYPT=y, CONFIG_BLK_DEV_LOOP=y
- Needs CAP_SYS_ADMIN
Crash excerpt (packaged PoC, Linux 6.6.163 #1, ksoftirqd)
==========================================================
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
CPU: 1 PID: 21 Comm: ksoftirqd/1 Not tainted 6.6.163 #1
RIP: 0010:blk_update_request+0xa5d/0x1190
Call Trace:
<TASK>
blk_mq_end_request
blk_complete_reqs
handle_softirqs
run_ksoftirqd
</TASK>
A self-contained reproducer creates a loop device, loads one dm-crypt
table ("aes-cbc-plain … integrity:16:none") over it, and preads the
mapped device. I can send the Docker/QEMU package or test a patch.
Thanks,
Yu Junzhe
FuzzAnything <fuzzanything@gmail.com>
reply other threads:[~2026-11-30 11:52 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=20261130115222.174-1-junzheyu1@gmail.com \
--to=junzheyu1@gmail.com \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@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