summaryrefslogtreecommitdiff
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorJia Jia <physicalmtea@gmail.com>2026-10-12 18:39:54 +0800
committerMichael S. Tsirkin <mst@redhat.com>2026-11-03 05:52:09 -0500
commit1f5bc40e33d8b3e5e3b89047956099b0c19f1d3d (patch)
tree3faabb0150ccaf9719fdb278edd5d99a22d4f9e1 /scripts/Makefile.thinlto
parentf41f153d49b4c18172ec61b69ba934c36e1be745 (diff)
downloadlinux-next-1f5bc40e33d8b3e5e3b89047956099b0c19f1d3d.tar.gz
linux-next-1f5bc40e33d8b3e5e3b89047956099b0c19f1d3d.zip
vhost-scsi: do not count PI bytes in the data length
vhost_scsi_handle_vq() moves pi_bytesout or pi_bytesin into the protection sgl and subtracts those bytes from exp_data_len. The length passed to TCM is still exp_data_len + prot_bytes. prot_bytes comes from virtio_scsi_cmd_req_pi. With VIRTIO_SCSI_F_T10_PI negotiated, vhost reads that header and does not check that the CDB is a READ or WRITE. sbc_check_prot() replaces data_length from the CDB only when the protect field is non-zero. target_cmd_size_check() leaves a write's data_length unchanged when the CDB size is smaller, so a command that does not get that replacement keeps a data_length larger than the data sgl. The KASAN report is a MODE SELECT whose header had pi_bytesout set. The data sgl held only the parameter list. spc_emulate_modeselect() walked data_length and read the next physical page. Pass the data sgl length. Protected READ and WRITE still take their length from the CDB in sbc_check_prot(). KASAN reports: BUG: KASAN: use-after-free in spc_emulate_modeselect+0x145/0x380 [target_core_mod] Read of size 1 spc_emulate_modeselect __target_execute_cmd target_execute_cmd vhost_scsi_write_pending transport_generic_new_cmd __target_submit target_queued_submit_work process_one_work worker_thread kthread ret_from_fork ret_from_fork_asm Fixes: 9f977ef7b671 ("vhost-scsi: Include prot_bytes into expected data transfer length") Signed-off-by: Jia Jia <physicalmtea@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261012103954.136698-1-physicalmtea@gmail.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions