[LTP] [PATCH v2 0/5] Netlink helper functions refactoring + CVE 2023-31248

Martin Doucha mdoucha@suse.cz
Tue Nov 14 13:31:21 CET 2023


Let's refactor the rtnetlink helper functions for generic use where possible.
The Netlink context structure can be used for other Netlink protocols like
NETLINK_CRYPTO or NETLINK_NETFILTER. One of the exceptions is
the NETLINK_KOBJECT_UEVENT protocol which returns raw data without the usual
headers.

The first patch replaces the tst_rtnl_* and RTNL_* prefix with tst_netlink_*
and NETLINK_* respectively to signify that the functions can be used
for generic netlink communication. The attribute handling functions are
specific to the NETLINK_ROUTE protocol so they keep the old prefix. The fourth
patch adds new attribute handling functions for generic struct nlattr.

The third patch replaces old netlink send/receive helper functions
with the context-based helpers in crypto test code.

Finally, add test for CVE 2023-31248 which was promised in v1.

Martin Doucha (5):
  tst_rtnetlink: Refactor helper function for generic use
  tst_netlink_destroy_context(): Allow safely passing NULL context
  crypto: Replace old netlink helper functions with netlink contexts
  tst_netlink: Add helper functions for handling generic attributes
  Add test for CVE 2023-31248

 doc/C-Test-Network-API.asciidoc         | 159 +++++++++---------
 include/tst_crypto.h                    |  69 +-------
 include/tst_netdevice.h                 |   8 +-
 include/tst_netlink.h                   | 195 +++++++++++++---------
 include/tst_rtnetlink.h                 | 108 ------------
 lib/tst_crypto.c                        |  90 ++--------
 lib/tst_netdevice.c                     | 115 ++++++-------
 lib/{tst_rtnetlink.c => tst_netlink.c}  | 170 ++++++++++++++-----
 testcases/cve/tcindex01.c               |  16 +-
 testcases/kernel/crypto/crypto_user01.c |  58 +++----
 testcases/kernel/crypto/crypto_user02.c |  17 +-
 testcases/kernel/crypto/pcrypt_aead01.c |  10 +-
 testcases/network/iptables/Makefile     |   2 +-
 testcases/network/iptables/nft02.c      | 211 ++++++++++++++++++++++++
 14 files changed, 667 insertions(+), 561 deletions(-)
 delete mode 100644 include/tst_rtnetlink.h
 rename lib/{tst_rtnetlink.c => tst_netlink.c} (63%)
 create mode 100644 testcases/network/iptables/nft02.c

-- 
2.42.0



More information about the ltp mailing list