linux-stable/tools
Davide Caratti 6b1a3968fb act_mirred: use the backlog for nested calls to mirred ingress
[ Upstream commit ca22da2fbd ]

William reports kernel soft-lockups on some OVS topologies when TC mirred
egress->ingress action is hit by local TCP traffic [1].
The same can also be reproduced with SCTP (thanks Xin for verifying), when
client and server reach themselves through mirred egress to ingress, and
one of the two peers sends a "heartbeat" packet (from within a timer).

Enqueueing to backlog proved to fix this soft lockup; however, as Cong
noticed [2], we should preserve - when possible - the current mirred
behavior that counts as "overlimits" any eventual packet drop subsequent to
the mirred forwarding action [3]. A compromise solution might use the
backlog only when tcf_mirred_act() has a nest level greater than one:
change tcf_mirred_forward() accordingly.

Also, add a kselftest that can reproduce the lockup and verifies TC mirred
ability to account for further packet drops after TC mirred egress->ingress
(when the nest level is 1).

 [1] https://lore.kernel.org/netdev/33dc43f587ec1388ba456b4915c75f02a8aae226.1663945716.git.dcaratti@redhat.com/
 [2] https://lore.kernel.org/netdev/Y0w%2FWWY60gqrtGLp@pop-os.localdomain/
 [3] such behavior is not guaranteed: for example, if RPS or skb RX
     timestamping is enabled on the mirred target device, the kernel
     can defer receiving the skb and return NET_RX_SUCCESS inside
     tcf_mirred_forward().

Reported-by: William Zhao <wizhao@redhat.com>
CC: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ skulkarni: Adjusted patch for file 'tc_actions.sh' wrt the mainline commit ]
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-28 16:21:36 +02:00
..
accounting
arch x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map 2024-06-16 13:28:39 +02:00
bpf bpftool: Fix memory leak in dump_xx_nlmsg on realloc failure 2025-08-28 16:21:19 +02:00
build tools/build: Don't pass test log files to linker 2025-06-04 14:32:30 +02:00
cgroup
debugging
firewire
firmware
gpio
hv
iio tools/iio: Add memory allocation failure check for trigger_name 2024-11-08 16:20:45 +01:00
include tools: move alignment-related macros to new <linux/align.h> 2024-09-04 13:15:02 +02:00
io_uring
kvm/kvm_stat
laptop
leds
lib libbpf: Add NULL checks to bpf_object__{prev_map,next_map} 2024-09-12 11:03:54 +02:00
memory-model tools/memory-model: Fix bug in lock.cat 2024-08-19 05:33:37 +02:00
nfsd
objtool objtool: Add support for intra-function calls 2024-04-13 12:51:29 +02:00
pci
pcmcia
perf perf tests bp_account: Fix leaked file descriptor 2025-08-28 16:21:20 +02:00
power pm: cpupower: Fix the snapshot-order of tsc,mperf, clock in mperf_stop() 2025-08-28 16:21:25 +02:00
scripts
spi
testing act_mirred: use the backlog for nested calls to mirred ingress 2025-08-28 16:21:36 +02:00
thermal/tmon
time
usb usbip: tools: Fix detach_port() invalid port error path 2024-11-08 16:20:53 +01:00
virtio
vm
wmi
Makefile