Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH 0/2] crypto: qat - bound the live migration import parser
@ 2026-06-14 13:06 Michael Bommarito
  2026-06-14 13:06 ` [PATCH 1/2] crypto: qat - validate migration section header is in bounds Michael Bommarito
  2026-06-14 13:06 ` [PATCH 2/2] crypto: qat - add KUnit coverage for the migration import parser Michael Bommarito
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Bommarito @ 2026-06-14 13:06 UTC (permalink / raw)
  To: Giovanni Cabiddu, Herbert Xu
  Cc: David S . Miller, Kees Cook, qat-linux, linux-crypto,
	linux-kernel

adf_mstate_mgr_init_from_remote() sets the section-walk cursor to
mgr->buf + preh_len from a remote-supplied preh_len, and the default
preamble checker only rejects preh_len > mgr->size. A remote preamble
with preh_len == mgr->size moves the cursor one region past the
allocation while n_sects is still honoured, so adf_mstate_sect_validate()
reads sect->size before the section header is proven in bounds. The
remote stream reaches this parser from the destination-host VFIO
migration path (qat_vf_resume_write), so a malformed import reads out of
bounds in the destination host kernel (fatal under KASAN / panic_on_warn).

Patch 1 rejects section headers not fully contained in the state buffer.
Patch 2 adds KUnit coverage and is offered separately so it can be taken
or dropped on its own. The parser was driven on QEMU x86_64 under KASAN
via the patch 2 suite (Level-2: buggy code unchanged, surrounding VFIO/PF
environment synthesized); the boundary trigger reports the out-of-bounds
read on the unfixed parser and is gone after patch 1, with two benign
controls passing on both trees.

Michael Bommarito (2):
  crypto: qat - validate migration section header is in bounds
  crypto: qat - add KUnit coverage for the migration import parser

 drivers/crypto/intel/qat/Kconfig              | 16 ++++
 .../intel/qat/qat_common/adf_mstate_mgr.c     | 18 ++++-
 .../qat/qat_common/adf_mstate_mgr_test.c      | 81 +++++++++++++++++++
 3 files changed, 113 insertions(+), 2 deletions(-)
 create mode 100644 drivers/crypto/intel/qat/qat_common/adf_mstate_mgr_test.c

-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-14 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-14 13:06 [PATCH 0/2] crypto: qat - bound the live migration import parser Michael Bommarito
2026-06-14 13:06 ` [PATCH 1/2] crypto: qat - validate migration section header is in bounds Michael Bommarito
2026-06-14 13:06 ` [PATCH 2/2] crypto: qat - add KUnit coverage for the migration import parser Michael Bommarito

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox