1. 15 5月, 2023 3 次提交
    • C
      SUNRPC: Fix trace_svc_register() call site · 07a27305
      Chuck Lever 提交于
      The trace event recorded incorrect values for the registered family,
      protocol, and port because the arguments are in the wrong order.
      
      Fixes: b4af5932 ("SUNRPC: Trace server-side rpcbind registration events")
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      07a27305
    • N
      SUNRPC: always free ctxt when freeing deferred request · 948f072a
      NeilBrown 提交于
      Since the ->xprt_ctxt pointer was added to svc_deferred_req, it has not
      been sufficient to use kfree() to free a deferred request.  We may need
      to free the ctxt as well.
      
      As freeing the ctxt is all that ->xpo_release_rqst() does, we repurpose
      it to explicit do that even when the ctxt is not stored in an rqst.
      So we now have ->xpo_release_ctxt() which is given an xprt and a ctxt,
      which may have been taken either from an rqst or from a dreq.  The
      caller is now responsible for clearing that pointer after the call to
      ->xpo_release_ctxt.
      
      We also clear dr->xprt_ctxt when the ctxt is moved into a new rqst when
      revisiting a deferred request.  This ensures there is only one pointer
      to the ctxt, so the risk of double freeing in future is reduced.  The
      new code in svc_xprt_release which releases both the ctxt and any
      rq_deferred depends on this.
      
      Fixes: 773f91b2 ("SUNRPC: Fix NFSD's request deferral on RDMA transports")
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Reviewed-by: NJeff Layton <jlayton@kernel.org>
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      948f072a
    • N
      SUNRPC: double free xprt_ctxt while still in use · eb8d3a2c
      NeilBrown 提交于
      When an RPC request is deferred, the rq_xprt_ctxt pointer is moved out
      of the svc_rqst into the svc_deferred_req.
      When the deferred request is revisited, the pointer is copied into
      the new svc_rqst - and also remains in the svc_deferred_req.
      
      In the (rare?) case that the request is deferred a second time, the old
      svc_deferred_req is reused - it still has all the correct content.
      However in that case the rq_xprt_ctxt pointer is NOT cleared so that
      when xpo_release_xprt is called, the ctxt is freed (UDP) or possible
      added to a free list (RDMA).
      When the deferred request is revisited for a second time, it will
      reference this ctxt which may be invalid, and the free the object a
      second time which is likely to oops.
      
      So change svc_defer() to *always* clear rq_xprt_ctxt, and assert that
      the value is now stored in the svc_deferred_req.
      
      Fixes: 773f91b2 ("SUNRPC: Fix NFSD's request deferral on RDMA transports")
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Reviewed-by: NJeff Layton <jlayton@kernel.org>
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      eb8d3a2c
  2. 06 5月, 2023 1 次提交
  3. 03 5月, 2023 3 次提交
  4. 02 5月, 2023 1 次提交
    • A
      SUNRPC: Avoid relying on crypto API to derive CBC-CTS output IV · af97b7df
      Ard Biesheuvel 提交于
      Scott reports SUNRPC self-test failures regarding the output IV on arm64
      when using the SIMD accelerated implementation of AES in CBC mode with
      ciphertext stealing ("cts(cbc(aes))" in crypto API speak).
      
      These failures are the result of the fact that, while RFC 3962 does
      specify what the output IV should be and includes test vectors for it,
      the general concept of an output IV is poorly defined, and generally,
      not specified by the various algorithms implemented by the crypto API.
      Only algorithms that support transparent chaining (e.g., CBC mode on a
      block boundary) have requirements on the output IV, but ciphertext
      stealing (CTS) is fundamentally about how to encapsulate CBC in a way
      where the length of the entire message may not be an integral multiple
      of the cipher block size, and the concept of an output IV does not exist
      here because it has no defined purpose past the end of the message.
      
      The generic CTS template takes advantage of this chaining capability of
      the CBC implementations, and as a result, happens to return an output
      IV, simply because it passes its IV buffer directly to the encapsulated
      CBC implementation, which operates on full blocks only, and always
      returns an IV. This output IV happens to match how RFC 3962 defines it,
      even though the CTS template itself does not contain any output IV logic
      whatsoever, and, for this reason, lacks any test vectors that exercise
      this accidental output IV generation.
      
      The arm64 SIMD implementation of cts(cbc(aes)) does not use the generic
      CTS template at all, but instead, implements the CBC mode and ciphertext
      stealing directly, and therefore does not encapsule a CBC implementation
      that returns an output IV in the same way. The arm64 SIMD implementation
      complies with the specification and passes all internal tests, but when
      invoked by the SUNRPC code, fails to produce the expected output IV and
      causes its selftests to fail.
      
      Given that the output IV is defined as the penultimate block (where the
      final block may smaller than the block size), we can quite easily derive
      it in the caller by copying the appropriate slice of ciphertext after
      encryption.
      
      Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
      Cc: Anna Schumaker <anna@kernel.org>
      Cc: Chuck Lever <chuck.lever@oracle.com>
      Cc: Jeff Layton <jlayton@kernel.org>
      Reported-by: NScott Mayhew <smayhew@redhat.com>
      Tested-by: NScott Mayhew <smayhew@redhat.com>
      Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      af97b7df
  5. 28 4月, 2023 7 次提交
  6. 26 4月, 2023 25 次提交