Skip to content

net: don't redirect decrypted skbs to ingress, psp time-wait validator

Todd Freed bpf lkml netdev stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 2 repliesIn review 1 of 3 applied
  2. v13 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Cc: stable on patches 1 and 2 (Jamal)
- patch 2: also clear tc_at_ingress before running an LWT xmit program. Sashiko found this in its review of the same patch in the net-next series v1:
https://lore.kernel.org/netdev/[email protected]
- drop commit message references to the net-next series (Daniel)
- rebased on net/main

Patches in v2 1 of 3 applied

#Subject and filesSizeRepliesApplied
1/3net/sched: act_mirred: don't send decrypted skbs from egress to ingressnet/sched/act_mirred.c+6 -00 replies
2/3bpf: don't redirect decrypted skbs from egress to ingressnet/core/filter.c net/core/lwt_bpf.c+18 -00 replies
3/3psp: only give time-wait sockets of PSP connections a validatornet/psp/psp_sock.c+4 -20 repliesApplied

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchJamal Hadi SalimDaniel Zahka
1/3R-b
2/3
3/3R-b

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

Read the v2 thread

Cover letter [PATCH net v2 0/3] net: don't redirect decrypted skbs to ingress, psp time-wait validator

Three fixes that are relevant for the net-next series, "psp: introduce socket-less associations". These were previously patches 6-8 of its v1:

https://lore.kernel.org/netdev/[email protected]

The first two patches prevent sending decrypted skbs from egress to ingress, since the meaning of skb->decrypted depends on the direction. This affects the packets of kTLS and PSP device offload sockets.

The third patch makes psp_twsk_init() give a validator only to the time-wait sockets of PSP connections with a Tx key, instead of to every TCP time-wait socket. It has no effect today, but the net-next series will rely on the presence of the validator to check if the socket has an encryption offload.

Testing, on two hosts with mlx5 (ConnectX-7), with and without the
patches: an egress rule on a connection's flow sends its packets to the device's ingress, with mirred (mirror and redirect) or bpf (bpf_clone_redirect() and bpf_redirect() with BPF_F_INGRESS), for a PSP device offload socket, a kTLS device offload socket and a plain TCP socket.

Without the patches, the PSP and kTLS sockets' packets arrive on ingress in all four cases. With them, none do: mirrored and cloned packets still go out, encrypted by the device, and redirected ones are dropped. The plain TCP socket's packets arrive on ingress in all four cases, with and without the patches. The PSP and plain TCP cases give the same results on netdevsim.

drivers/net psp.py and hw/tls_hw_offload.py pass, with and without the patches, as does tc-testing mirred.json on netdevsim (39 pass, 7 skipped by their dependsOn probes). Each patch builds without warnings (gcc and clang, allmodconfig, W=1).

v2 was re-tested as above, plus bpf selftests lwt_redirect, lwt_reroute and lwt_misc

v2:
- Cc: stable on patches 1 and 2 (Jamal)
- patch 2: also clear tc_at_ingress before running an LWT xmit program. Sashiko found this in its review of the same patch in the net-next series v1:
https://lore.kernel.org/netdev/[email protected]
- drop commit message references to the net-next series (Daniel)
- rebased on net/main

v1: https://lore.kernel.org/netdev/[email protected]

Todd Freed (3):
net/sched: act_mirred: don't send decrypted skbs from egress to
ingress
bpf: don't redirect decrypted skbs from egress to ingress
psp: only give time-wait sockets of PSP connections a validator

 net/core/filter.c      | 10 ++++++++++
 net/core/lwt_bpf.c     |  8 ++++++++
 net/psp/psp_sock.c     |  6 ++++--
 net/sched/act_mirred.c |  6 ++++++
 4 files changed, 28 insertions(+), 2 deletions(-)

base-commit: 5e9b2ad9b8384cd3c417cd5e2c3bc7eee4a72791

Signature · 1 line
2.53.1-Meta