Skip to content

more misc LLM fixes

Florian Westphal netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12src: common: mnl_nlmsg_batch_start may return NULLsrc/common.c+4 -00 replies
2/12src: fix uninitialised attr arrayssrc/expr/data_reg.c src/trace.c+2 -20 replies
3/12src: move several MNL_STRING types to MNL_NUL_STRINGsrc/chain.c src/expr/data_reg.c src/set.c +1 more+6 -50 replies
4/12src: expr: make sure NFTA_EXPR_NAME was parsed successfulysrc/expr.c+4 -10 replies
5/12src: object: don't permit to re-set or clear object type fieldsrc/object.c+14 -30 replies
6/12include: drop semicolon at end of xfree macroinclude/utils.h+1 -10 replies
7/12src: ruleset: remove set_elem member from unionsrc/ruleset.c+1 -20 replies
8/12src: set: clear field_len array before copyingsrc/set.c+1 -01 reply
9/12src: set: check for empty list explicitlysrc/set.c+5 -50 replies
10/12src: set_elem: list_del before freeingsrc/set_elem.c+6 -20 replies
11/12src: udata: clamp buf->end to actally copied sizesrc/udata.c+4 -10 replies
12/12src: remove all remaining MNL_STRING usersexamples/nft-compat-get.c src/chain.c src/expr/dynset.c +12 more+20 -200 replies

Reviews trailers per patch

None of the 12 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPhil SutterFernando Fernandez Mancera
SeriesR-b R-b
1/12
2/12
3/12
4/12
5/12
6/12
7/12
8/12
9/12
10/12
11/12
12/12

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

Read the v1 thread

Cover letter [PATCH libftnl 00/12] more misc LLM fixes

Another round of LLM findings. These commits are all unrelated, except that they are LLM findigs with no observed bug reports.

1) Check mnl_nlmsg_batch_start() for a NULL return. Avoid potential NULL pointer dereference in src/common.

2) Fix uninitialised attr arrays by zero-initialising tb[] arrays.

3) Move several MNL_STRING attribute types to MNL_NUL_STRING so mnl_attr_validate enforces NUL termination. Harden future netlink-attribute parsing against non-kernel sources that may omit the terminator.

4) Validate NFTA_EXPR_NAME parse success. Upgrade string validation to NUL_STRING, since the kernel always appends a trailing NUL.

5) Forbid re-setting or clearing the object type field to prevent inconsistent state and segfaults. Check the correct subtype before freeing to guard against a latent union overlap crash.

6) Drop trailing semicolon from the xfree macro. Callers already append their own ;, so the macro's is redundant.

7) Remove the obsolete set_elem member from the ruleset union. Its last consumer (the removed json interface) no longer exists, and the shared nftnl_set_free path masked a latent type-confusion bug.

8) Clear field_len array before copying to avoid reading stale values from a prior call. Fix a bug where shrinking the array on a second invocation leaks leftover field counts.

9) Guard the s->expr_list traversal against the empty-list case to avoid returning a pointer into the middle of nftnl_set. Initialize data_len to 0.

10) Fix use-after-free by calling list_del() before freeing expressions in set_elem. Prevents dangling next/prev pointers from corrupting a subsequent list_add on the same list.

11) Clamp buf->end to the actually copied size in udata_buf_put. Prevent nftnl_udata_buf_space() from observing an end pointer past the buffer.

12) Remove all remaining MNL_STRING users, switch to MNL_NUL_STRING and mnl_attr_put_strz. Enforce NUL-termination checking on all string attributes to prevent illegal strlen/strdup on unchecked data.

Florian Westphal (12):
src: common: mnl_nlmsg_batch_start may return NULL
src: fix uninitialised attr arrays
src: move several MNL_STRING types to MNL_NUL_STRING
src: expr: make sure NFTA_EXPR_NAME was parsed successfuly
src: object: don't permit to re-set or clear object type field
include: drop semicolon at end of xfree macro
src: ruleset: remove set_elem member from union
src: set: clear field_len array before copying
src: set: check for empty list explicitly
src: set_elem: list_del before freeing
src: udata: clamp buf->end to actally copied size
src: remove all remaining MNL_STRING users

 examples/nft-compat-get.c |  2 +-
 include/utils.h           |  2 +-
 src/chain.c               |  4 ++--
 src/common.c              |  4 ++++
 src/expr.c                |  5 ++++-
 src/expr/data_reg.c       |  4 ++--
 src/expr/dynset.c         |  2 +-
 src/expr/flow_offload.c   |  2 +-
 src/expr/log.c            |  2 +-
 src/expr/lookup.c         |  2 +-
 src/expr/objref.c         |  6 +++---
 src/flowtable.c           |  2 +-
 src/obj/ct_helper.c       |  4 ++--
 src/obj/secmark.c         |  4 ++--
 src/object.c              | 19 +++++++++++++++----
 src/rule.c                |  2 +-
 src/ruleset.c             |  3 +--
 src/set.c                 | 13 +++++++------
 src/set_elem.c            | 10 +++++++---
 src/table.c               |  2 +-
 src/trace.c               |  6 +++---
 src/udata.c               |  5 ++++-
 src/utils.c               |  5 +++--
 23 files changed, 68 insertions(+), 42 deletions(-)
Signature · 1 line
2.55.0