[LTP] lapi: Add pkt_cls.h fallback

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Tue Jul 7 16:28:10 CEST 2026


Hi Andrea,

On Tue, 7 Jul 2026 15:42:27 +0200, Andrea Cervesato wrote:
> lapi: Add pkt_cls.h fallback

--- [PATCH 3/4] ---

> +#ifndef TCA_PEDIT_KEY_EX
> +# define TCA_PEDIT_KEY_EX		3
> +#endif

The value is wrong. Counting from TCA_PEDIT_UNSPEC = 0 in the kernel
anonymous enum:

  TCA_PEDIT_UNSPEC  = 0
  TCA_PEDIT_TM      = 1
  TCA_PEDIT_PARMS   = 2
  TCA_PEDIT_PAD     = 3   <-- 3 is PAD, not KEY_EX
  TCA_PEDIT_PARMS_EX = 4
  TCA_PEDIT_KEYS_EX  = 5
  TCA_PEDIT_KEY_EX   = 6  <-- should be 6

With value 3 the kernel would receive a TCA_PEDIT_PAD attribute where
TCA_PEDIT_KEY_EX is expected and reject the filter with "Unknown
attribute, expected extended key".

This also breaks the test in patch 4/4 which uses TCA_PEDIT_KEY_EX
as a netlink attribute type.

> +#ifndef TCA_PEDIT_PARMS_EX
> +# define TCA_PEDIT_PARMS_EX		4
> +#endif
> +
> +#ifndef TCA_PEDIT_KEYS_EX
> +# define TCA_PEDIT_KEYS_EX		5
> +#endif
> +
> +#ifndef TCA_PEDIT_KEY_EX
> +# define TCA_PEDIT_KEY_EX		3
> +#endif
> +
> +#ifndef TCA_PEDIT_KEY_EX_HTYPE
> +# define TCA_PEDIT_KEY_EX_HTYPE		1
> +#endif
> +
> +#ifndef TCA_PEDIT_KEY_EX_CMD
> +# define TCA_PEDIT_KEY_EX_CMD		2
> +#endif

All five of these are anonymous enum values in the kernel header, not
preprocessor macros. A #ifndef guard tests the preprocessor symbol
table, which does not include enum constants. So every one of these
#define lines executes unconditionally even on systems that already
have the full kernel header -- the enum values are silently shadowed
by the macros.

For the four correctly-valued ones this has no observable impact
today, but the guard gives a false sense of safety. For
TCA_PEDIT_KEY_EX the wrong value makes the situation permanent on
every system.

The correct approach for enum-valued constants is to use
AC_CHECK_DECLS in configure.ac, the same way this patch already uses
AC_CHECK_TYPES for the two enum types:

  AC_CHECK_DECLS([TCA_PEDIT_PARMS_EX, TCA_PEDIT_KEYS_EX,
                  TCA_PEDIT_KEY_EX, TCA_PEDIT_KEY_EX_HTYPE,
                  TCA_PEDIT_KEY_EX_CMD],,,[
  #include <linux/tc_act/tc_pedit.h>])

That generates HAVE_DECL_* macros which can be used as guards around
the fallback defines.

--- [PATCH 4/4] ---

> +cve: Add act_pedit page-cache corruption test

The fix commit 899ee91156e5 does not exist in torvalds/linux, and the
field `tcfp_off_max_hint` mentioned in the commit body is absent from
the kernel source. The fix has not been merged to mainline and is
therefore not in any released kernel, including 7.2.

Per the staging rule, a test for an unreleased fix must:
  - carry a [STAGING] subject prefix, and
  - be listed in runtest/staging, not runtest/cve.

> +	.tags = (const struct tst_tag[]) {
> +		{"linux-git", "899ee91156e5"},

The SHA 899ee91156e5 cannot be resolved in torvalds/linux. Update
this to the correct SHA once the fix is merged.

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list