From: Danish Khateeb <danishkhateeb03@gmail.com>
To: "Martin K. Petersen" <mkp@kernel.org>
Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Akinobu Mita <akinobu.mita@gmail.com>,
Danish Khateeb <danishkhateeb03@gmail.com>
Subject: [PATCH 0/2] scsi: target: core: Fix and convert kmap_atomic() in SBC emulation
Date: Wed, 23 Sep 2026 08:13:17 -0500 [thread overview]
Message-ID: <20260923131319.310123-1-danishkhateeb03@gmail.com> (raw)
Patch 1 fixes the address sbc_dif_copy_prot() passes to kunmap_atomic(),
which has been off by one page since v4.2. It keeps kmap_atomic() so it
can be backported on its own, which is why checkpatch warns about the
deprecated call there. Patch 2 then converts the kmap_atomic() calls in
target_core_sbc.c to kmap_local_page().
The rd backend's protection pages are lowmem, so the bug only shows on
32-bit x86 with CONFIG_DEBUG_HIGHMEM, which gives lowmem pages a real
kmap slot too. I have not Cc'd stable for that reason.
Testing, in QEMU/KVM, with PREEMPT_LAZY and DEBUG_PREEMPT:
- i386 with HIGHMEM and DEBUG_HIGHMEM. On fe2ec83746e5 (v7.3-rc4+),
kunmap_local_indexed() warns from sbc_dif_copy_prot(), the log has 103
"DIFv1 checksum failed" errors, and 9 of the 23 checks fail with
EILSEQ or EIO on the rd PI disk. With patch 1, and with both patches,
all 23 pass with no warnings.
- x86-64 with KASAN. All 23 checks pass before and after the series,
with no reports.
A static init sets up three rd_mcp devices through configfs and exports
them through tcm_loop: one with pi_prot_type=1, one without PI behind a
TPG with fabric_prot_type=1, and a plain one. It then runs O_DIRECT and
buffered writes and read-backs on the two PI disks, SG_IO WRITE(10) and
READ(10) without PI so the target inserts and strips it, and COMPARE AND
WRITE with a match and with a miscompare at byte 403. Kprobes show that
sbc_dif_generate(), sbc_dif_verify(), sbc_dif_copy_prot() and
compare_and_write_callback(), which inlines compare_and_write_do_cmp(),
all ran. W=1 and sparse are clean for target_core_sbc.c. I can post the
init program if it is useful.
Danish Khateeb (2):
scsi: target: core: Fix kunmap_atomic() address in sbc_dif_copy_prot()
scsi: target: core: Use kmap_local_page() in SBC emulation
drivers/target/target_core_sbc.c | 58 ++++++++++++++++----------------
1 file changed, 29 insertions(+), 29 deletions(-)
base-commit: fe2ec83746e501645709761605c2464a44fd2929
--
2.55.0
next reply other threads:[~2026-09-23 13:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 13:13 Danish Khateeb [this message]
2026-09-23 13:13 ` [PATCH 1/2] scsi: target: core: Fix kunmap_atomic() address in sbc_dif_copy_prot() Danish Khateeb
2026-09-23 13:13 ` [PATCH 2/2] scsi: target: core: Use kmap_local_page() in SBC emulation Danish Khateeb
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=20260923131319.310123-1-danishkhateeb03@gmail.com \
--to=danishkhateeb03@gmail.com \
--cc=akinobu.mita@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mkp@kernel.org \
--cc=target-devel@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
all inboxes | Powered by JetHome®