DPDK patches and discussions
 help / color / mirror / Atom feed
From: Linfeng Li <linfli@qti.qualcomm.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: "john.griffin@intel.com" <john.griffin@intel.com>,
	"fiona.trahe@intel.com" <fiona.trahe@intel.com>,
	"deepak.k.jain@intel.com" <deepak.k.jain@intel.com>,
	 Steve Rizor <srizor@qti.qualcomm.com>,
	Emil Meng <emeng@qti.qualcomm.com>
Subject: [dpdk-dev] Potential bug in QAT PMD code
Date: Tue, 23 Feb 2021 00:34:20 +0000	[thread overview]
Message-ID: <CY4PR0201MB3508A9861C5DEF4CEF2DB859FA809@CY4PR0201MB3508.namprd02.prod.outlook.com> (raw)

Hi,



We believe we found a potential bug in the QAT PMD code.



file link: https://github.com/DPDK/dpdk/blob/main/drivers/crypto/qat/qat_sym.c



The undesired behavior happens when:
*         symmetric operation
*         out-of-place operation
*         encryption
*         do cipher + do hash
*         SGL enabled on either src/dst mbuf chain
*         min_ofs is smaller than the length of the first segment of the src mbuf chain



behavior: In dst mbuf, payload is ciphered as expected, but mac-i remains plain text where it's expected to be ciphered as well.



potential cause:
*         When min_ofs is smaller than the length of the first segment of the src mbuf chain with the foregoing scenario , auth_param->auth_off is calculated by auth_ofs-min_ofs(line 512 in qat_sym.c).
*         When SGL enabled + do auth + do cipher, the remaining_off is calculated by auth_param->auth_off + auth_param->auth_len + alignment_adjustment(line 534 in qat_sym.c). so remaining_off doesn't include the offset applied on auth_param->auth_off in this scenario.
*         The auth_data_end(line 546 in qat_sym.c) found doesn't seem proper since the while loop (line 540 in qat_sym.c) iterates from the very beginning of the dst mbuf.



Proposal fix:

add min_ofs in the calculation of remaining_off(line 534 in qat_sym.c)



Please let us know what your thoughts are about this issue and feel free to contact us if there are any questions.

Linfeng

             reply	other threads:[~2021-02-23  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23  0:34 Linfeng Li [this message]
2021-03-03  9:00 ` Doherty, Declan
2021-04-13 22:19   ` Linfeng Li

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=CY4PR0201MB3508A9861C5DEF4CEF2DB859FA809@CY4PR0201MB3508.namprd02.prod.outlook.com \
    --to=linfli@qti.qualcomm.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=emeng@qti.qualcomm.com \
    --cc=fiona.trahe@intel.com \
    --cc=john.griffin@intel.com \
    --cc=srizor@qti.qualcomm.com \
    /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;
as well as URLs for NNTP newsgroup(s).