mbox series

[v5,00/11] memset security fixes

Message ID 20250211173720.1188517-1-stephen@networkplumber.org (mailing list archive)
Headers
Series memset security fixes |

Message

Stephen Hemminger Feb. 11, 2025, 5:35 p.m. UTC
This series handles memset related bugs indentified by PVS Studio.
The root cause is that Gcc and other compilers are free to
optimize away memset called before free.

Most of the places memset was being used like this were bogus;
probably some developer debug habit, and can be safely removed.

v6 - add stable to the ntnic bug fix
   - drop elimination of void cast in ntnic - unrelated change
   - rebase

Stephen Hemminger (11):
  eal: introduce new secure memory fill
  eal: add new secure free function
  crypto/qat: force zero of keys
  crypto/qat: fix size calculation for memset
  crypto/qat: use secure memset
  bus/uacce: remove memset before free
  compress/octeontx: remove unnecessary memset
  test: remove unneeded memset
  net/ntnic: check result of malloc
  net/ntnic: remove unnecessary memset
  devtools/cocci: add script to find problematic memset

 app/test/test_cmdline_cirbuf.c                |  2 --
 devtools/cocci/memset_free.cocci              | 20 +++++++++++++
 drivers/bus/uacce/uacce.c                     |  1 -
 drivers/compress/octeontx/otx_zip.c           |  1 -
 drivers/compress/octeontx/otx_zip_pmd.c       |  2 --
 drivers/crypto/qat/qat_asym.c                 |  5 +---
 drivers/crypto/qat/qat_sym_session.c          | 27 +++++++++--------
 drivers/net/ntnic/nthw/core/nthw_hif.c        |  5 +---
 drivers/net/ntnic/nthw/core/nthw_iic.c        |  5 +---
 drivers/net/ntnic/nthw/core/nthw_pcie3.c      |  5 +---
 drivers/net/ntnic/nthw/core/nthw_rpf.c        |  5 +---
 drivers/net/ntnic/nthw/core/nthw_sdc.c        |  5 +---
 drivers/net/ntnic/nthw/core/nthw_si5340.c     |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_cat.c    |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_csu.c    |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_flm.c    |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_hfu.c    |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_hsh.c    |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_info.c   |  5 +---
 .../net/ntnic/nthw/flow_filter/flow_nthw_km.c |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_pdb.c    |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_qsl.c    |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_slc_lr.c |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c |  1 -
 .../ntnic/nthw/flow_filter/flow_nthw_tx_ins.c |  5 +---
 .../ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c |  5 +---
 .../net/ntnic/nthw/model/nthw_fpga_model.c    |  1 -
 drivers/net/ntnic/nthw/nthw_rac.c             |  4 ++-
 lib/eal/common/rte_malloc.c                   | 30 +++++++++++++++----
 lib/eal/include/rte_malloc.h                  | 18 +++++++++++
 lib/eal/include/rte_string_fns.h              | 27 +++++++++++++++++
 lib/eal/version.map                           |  3 ++
 33 files changed, 129 insertions(+), 108 deletions(-)
 create mode 100644 devtools/cocci/memset_free.cocci
  

Comments

Patrick Robb Feb. 11, 2025, 8:59 p.m. UTC | #1
There is a performance failure for Intel E810 for this patch, but it is
coming from dpdk mainline, not this patchseries. I think something was
merged recently which bumped up the variance on forwarding because the
periodic runs on the E810 for DPDK 24.11 are stable, but all the current
runs on new patches which are applied on mainline have a significantly
higher variance. I am about to look into this - once we have it sorted and
stable I will request a retest on this patchseries, which will remove the
fail on Patchwork. I will pick up any ensuing conversation on the CI
mailing list as I don't want to flood your cover letter with discussion
about another patch.

On Tue, Feb 11, 2025 at 12:37 PM Stephen Hemminger <
stephen@networkplumber.org> wrote:

> This series handles memset related bugs indentified by PVS Studio.
> The root cause is that Gcc and other compilers are free to
> optimize away memset called before free.
>
> Most of the places memset was being used like this were bogus;
> probably some developer debug habit, and can be safely removed.
>
> v6 - add stable to the ntnic bug fix
>    - drop elimination of void cast in ntnic - unrelated change
>    - rebase
>
> Stephen Hemminger (11):
>   eal: introduce new secure memory fill
>   eal: add new secure free function
>   crypto/qat: force zero of keys
>   crypto/qat: fix size calculation for memset
>   crypto/qat: use secure memset
>   bus/uacce: remove memset before free
>   compress/octeontx: remove unnecessary memset
>   test: remove unneeded memset
>   net/ntnic: check result of malloc
>   net/ntnic: remove unnecessary memset
>   devtools/cocci: add script to find problematic memset
>
>  app/test/test_cmdline_cirbuf.c                |  2 --
>  devtools/cocci/memset_free.cocci              | 20 +++++++++++++
>  drivers/bus/uacce/uacce.c                     |  1 -
>  drivers/compress/octeontx/otx_zip.c           |  1 -
>  drivers/compress/octeontx/otx_zip_pmd.c       |  2 --
>  drivers/crypto/qat/qat_asym.c                 |  5 +---
>  drivers/crypto/qat/qat_sym_session.c          | 27 +++++++++--------
>  drivers/net/ntnic/nthw/core/nthw_hif.c        |  5 +---
>  drivers/net/ntnic/nthw/core/nthw_iic.c        |  5 +---
>  drivers/net/ntnic/nthw/core/nthw_pcie3.c      |  5 +---
>  drivers/net/ntnic/nthw/core/nthw_rpf.c        |  5 +---
>  drivers/net/ntnic/nthw/core/nthw_sdc.c        |  5 +---
>  drivers/net/ntnic/nthw/core/nthw_si5340.c     |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_cat.c    |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_csu.c    |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_flm.c    |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_hfu.c    |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_hsh.c    |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_info.c   |  5 +---
>  .../net/ntnic/nthw/flow_filter/flow_nthw_km.c |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_pdb.c    |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_qsl.c    |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_slc_lr.c |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c |  1 -
>  .../ntnic/nthw/flow_filter/flow_nthw_tx_ins.c |  5 +---
>  .../ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c |  5 +---
>  .../net/ntnic/nthw/model/nthw_fpga_model.c    |  1 -
>  drivers/net/ntnic/nthw/nthw_rac.c             |  4 ++-
>  lib/eal/common/rte_malloc.c                   | 30 +++++++++++++++----
>  lib/eal/include/rte_malloc.h                  | 18 +++++++++++
>  lib/eal/include/rte_string_fns.h              | 27 +++++++++++++++++
>  lib/eal/version.map                           |  3 ++
>  33 files changed, 129 insertions(+), 108 deletions(-)
>  create mode 100644 devtools/cocci/memset_free.cocci
>
> --
> 2.47.2
>
>