Skip to content

Fixes and rework for paes_s390 and phmac_s390

Harald Freudenberger linux-crypto linux-s390 7 versions – Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest9 patches 1 replyApplied
  2. v69 patches 3 repliesSuperseded
  3. v58 patches 2 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v47 patches5 repliesSuperseded
v36 patches5 repliesSuperseded
v26 patches0 repliesSuperseded
v13 patches0 repliesSuperseded

Patches in v7 Applied

#Subject and filesSizeRepliesApplied
1/9s390/crypto: Fix return code handling at skcipher_walk_done in PAES algorithmsarch/s390/crypto/paes_s390.c+27 -110 replies
2/9s390/crypto: Fix missing scrub of temp buffers with PAES algorithmarch/s390/crypto/paes_s390.c+2 -10 replies
3/9s390/crypto: Fix use of mutex in atomic context in PAESarch/s390/crypto/paes_s390.c+57 -500 replies
4/9s390/crypto: Fix missing cra_flags in paes_s390arch/s390/crypto/paes_s390.c+4 -00 replies
5/9s390/crypto: Fix handling of EBUSY in PAES when req is pushed to crypto enginearch/s390/crypto/paes_s390.c+24 -120 replies
6/9s390/crypto: Fix handling of EBUSY in PHMAC when req is pushed to crypto enginearch/s390/crypto/phmac_s390.c+21 -90 replies
7/9s390/crypto: Fix wrong return code to engine in asynch callbacksarch/s390/crypto/paes_s390.c arch/s390/crypto/phmac_s390.c+5 -50 replies
8/9s390/crypto: Map EBUSY to EIO when key conversion fails repeatedlyarch/s390/crypto/paes_s390.c arch/s390/crypto/phmac_s390.c+8 -00 replies
9/9s390/crypto: Enable CONTEXT_ANALYSISarch/s390/crypto/Makefile+2 -00 replies

Reviews trailers per patch

All 9 patches have a Reviewed-by or Acked-by.

PatchHolger DenglerHarald Freudenberger
1/9R-b
2/9R-b
3/9R-b
4/9R-b
5/9R-b
6/9R-b
7/9R-b
8/9R-b
9/9R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 0/9] Fixes and rework for paes_s390 and phmac_s390

Fix and rework some issues around arch/s390/paes_s390.c and arch/s390/phmac_s390.c:

- Fix skcipher_walk return code handling in paes_s390
- Add scrub of some temp buffers
- Shift from using a mutex to using a semaphore in PAES CTR Surprisingly clang code analysis is able to deal with semaphores and thus the shift also fixes the issue with CONTEXT_ANALYSIS enabled.
- And some more fixes related to paes and phmac (see changelog).

For more details please see patch headers.

Changelog:

v1: initial version - however, all these patches are follow up patches
from a similar patch queue for aes_s390.c
v2: - On one error path in the CTR implementation the scrubbing of a
temp buffer could be bypassed. Also checked Sashikos claim about possible double free but this is not the case.
- All paes algorithms did not set any base.cra_flags. So now set the ASYNC and the NO_FALLBACK flag.
- If a request is pushed to the crypto engine there is another return code EBUSY also indicating success but the code handled this as a failure.
- The very same was with the phmac implementation. So corrected the return code handling there as well.
v3: - Reworked the -EBUSY handling in paes and phmac again. The
synchronous path could have emitted -EBUSY also and would have triggered the failure handling. So map -EBUSY to -EINPROGRESS.
v4: - Mapping EBUSY to EINPROGRESS is not the right approach. So
reworked again more thoroughly.
- There came another reply from Sashiko about a possible double processing maybe even double free as a result of wrongly returning a failure code in the callback functions back to the engine when a request has been completed. The callback must return 0 - so another patch for this.
v5: - Sashiko found a potential for a deadlock with phmac where a
persistent key conversion failure results in an -EBUSY which is as such written into the request. However, -EBUSY is swallowed by the engine layer and thus the calling process never gets it's callback invoked and may wait forever. So map -EBUSY to -EIO in the conversion function when there is a persistent inability to convert a key - in the end this is an IO failure.
v6: - Added Fixes and Cc tags to patch #8.
- And finally picked Heiko's update on arch/s390/Makefile to enable context analysis for the clang compiler.
v7: - Reworked the mutex to semaphore patch by rearranging the code
to get rid of the conditional locking as suggested by Heiko.

Harald Freudenberger (8):
s390/crypto: Fix return code handling at skcipher_walk_done in PAES
algorithms
s390/crypto: Fix missing scrub of temp buffers with PAES algorithm s390/crypto: Fix use of mutex in atomic context in PAES s390/crypto: Fix missing cra_flags in paes_s390 s390/crypto: Fix handling of EBUSY in PAES when req is pushed to
crypto engine
s390/crypto: Fix handling of EBUSY in PHMAC when req is pushed to
crypto engine
s390/crypto: Fix wrong return code to engine in asynch callbacks s390/crypto: Map EBUSY to EIO when key conversion fails repeatedly

Heiko Carstens (1):
s390/crypto: Enable CONTEXT_ANALYSIS

 arch/s390/crypto/Makefile     |   2 +
 arch/s390/crypto/paes_s390.c  | 184 +++++++++++++++++++++-------------
 arch/s390/crypto/phmac_s390.c |  36 +++++--
 3 files changed, 142 insertions(+), 80 deletions(-)

base-commit: 8d3ae59288f1e7d58d76558a6ee96d533bc5019f --
2.43.0