1. 27 Sep, 2022 2 commits
    • lei he's avatar
      virtio-crypto: fix memory-leak · 1bedcf22
      lei he authored
      Fix memory-leak for virtio-crypto akcipher request, this problem is
      introduced by 59ca6c93(virtio-crypto: implement RSA algorithm).
      The leak can be reproduced and tested with the following script
      inside virtual machine:
      
      #!/bin/bash
      
      LOOP_TIMES=10000
      
      # required module: pkcs8_key_parser, virtio_crypto
      modprobe pkcs8_key_parser # if CONFIG_PKCS8_PRIVATE_KEY_PARSER=m
      modprobe virtio_crypto # if CONFIG_CRYPTO_DEV_VIRTIO=m
      rm -rf /tmp/data
      dd if=/dev/random of=/tmp/data count=1 bs=230
      
      # generate private key and self-signed cert
      openssl req -nodes -x509 -newkey rsa:2048 -keyout key.pem \
      		-outform der -out cert.der  \
      		-subj "/C=CN/ST=GD/L=SZ/O=vihoo/OU=dev/CN=always.com/emailAddress=yy@always.com"
      # convert private key from pem to der
      openssl pkcs8 -in key.pem -topk8 -nocrypt -outform DER -out key.der
      
      # add key
      PRIV_KEY_ID=`cat key.der | keyctl padd asymmetric test_priv_key @s`
      echo "priv key id = "$PRIV_KEY_ID
      PUB_KEY_ID=`cat cert.der | keyctl padd asymmetric test_pub_key @s`
      echo "pub key id = "$PUB_KEY_ID
      
      # query key
      keyctl pkey_query $PRIV_KEY_ID 0
      keyctl pkey_query $PUB_KEY_ID 0
      
      # here we only run pkey_encrypt becasuse it is the fastest interface
      function bench_pub() {
      	keyctl pkey_encrypt $PUB_KEY_ID 0 /tmp/data enc=pkcs1 >/tmp/enc.pub
      }
      
      # do bench_pub in loop to obtain the memory leak
      for (( i = 0; i < ${LOOP_TIMES}; ++i )); do
      	bench_pub
      done
      Signed-off-by: default avatarlei he <helei.sig11@bytedance.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarGonglei <arei.gonglei@huawei.com>
      Message-Id: <20220919075158.3625-1-helei.sig11@bytedance.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      1bedcf22
    • Angus Chen's avatar
      vdpa/ifcvf: fix the calculation of queuepair · db5db1a0
      Angus Chen authored
      The q_pair_id to address a queue pair in the lm bar should be
      calculated by queue_id / 2 rather than queue_id / nr_vring.
      
      Fixes: 2ddae773 ("vDPA/ifcvf: detect and use the onboard number of queues directly")
      Signed-off-by: default avatarAngus Chen <angus.chen@jaguarmicro.com>
      Reviewed-by: default avatarJason Wang <jasowang@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Acked-by: default avatarZhu Lingshan <lingshan.zhu@intel.com>
      Message-Id: <20220923091013.191-1-angus.chen@jaguarmicro.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      db5db1a0
  2. 25 Sep, 2022 8 commits
  3. 24 Sep, 2022 10 commits
  4. 23 Sep, 2022 18 commits
  5. 22 Sep, 2022 2 commits