kernel panic TPROXY , vanilla 4.7.1
Subsystems (3)
Hi!
Tried to run squid on latest kernel, and hit a panic Sometimes it just shows warning in dmesg (but doesnt work properly)
[ 75.701666] IPv4: Attempt to release TCP socket in state 10 ffff88102d430780 [ 83.866974] squid (2700) used greatest stack depth: 12912 bytes left [ 87.506644] IPv4: Attempt to release TCP socket in state 10 ffff880078a48780 [ 114.704295] IPv4: Attempt to release TCP socket in state 10 ffff881029f8ad00
I cannot catch yet oops/panic message, netconsole not working.
After triggering warning message 3 times, i am unable to run squid anymore (without reboot), and in netstat it doesnt show port running.
firewall is:
*mangle
-A PREROUTING -p tcp -m socket -j DIVERT
-A PREROUTING -p tcp -m tcp --dport 80 -i eno1 -j TPROXY --on-port 3129 --on-ip 0.0.0.0 --tproxy-mark 0x1/0x1 -A DIVERT -j MARK --set-xmark 0x1/0xffffffff
-A DIVERT -j ACCEPT
routing
ip rule add fwmark 1 lookup 100
ip route add local default dev eno1 table 100
squid config is default with tproxy optionhttp_port 3129 tproxy
Quoted 25 lines · Denys Fedoryshchenko
Hi!
Tried to run squid on latest kernel, and hit a panic Sometimes it just shows warning in dmesg (but doesnt work properly)
[ 75.701666] IPv4: Attempt to release TCP socket in state 10 ffff88102d430780 [ 83.866974] squid (2700) used greatest stack depth: 12912 bytes left [ 87.506644] IPv4: Attempt to release TCP socket in state 10 ffff880078a48780 [ 114.704295] IPv4: Attempt to release TCP socket in state 10
ffff881029f8ad00I cannot catch yet oops/panic message, netconsole not working.
After triggering warning message 3 times, i am unable to run squid anymore (without reboot), and in netstat it doesnt show port running.
firewall is:
*mangle(quoted diff) +0
-5-A PREROUTING -p tcp -m socket -j DIVERT -A PREROUTING -p tcp -m tcp --dport 80 -i eno1 -j TPROXY --on-port 3129 --on-ip 0.0.0.0 --tproxy-mark 0x1/0x1 -A DIVERT -j MARK --set-xmark 0x1/0xffffffff -A DIVERT -j ACCEPT
Quoted 8 lines
routing
ip rule add fwmark 1 lookup 100
ip route add local default dev eno1 table 100squid config is default with tproxy option
http_port3129 tproxy
Hmppff... sorry for this, I will send a fix.
Thanks for the report !
Quoted 31 lines · Eric Dumazet
Quoted 30 lines · Denys Fedoryshchenko
Hi!
Tried to run squid on latest kernel, and hit a panic Sometimes it just shows warning in dmesg (but doesnt work properly)
[ 75.701666] IPv4: Attempt to release TCP socket in state 10 ffff88102d430780 [ 83.866974] squid (2700) used greatest stack depth: 12912 bytes left [ 87.506644] IPv4: Attempt to release TCP socket in state 10 ffff880078a48780 [ 114.704295] IPv4: Attempt to release TCP socket in state 10
ffff881029f8ad00I cannot catch yet oops/panic message, netconsole not working.
After triggering warning message 3 times, i am unable to run squid anymore (without reboot), and in netstat it doesnt show port running.
firewall is:
*mangle(quoted diff) +0
-5-A PREROUTING -p tcp -m socket -j DIVERT -A PREROUTING -p tcp -m tcp --dport 80 -i eno1 -j TPROXY --on-port 3129 --on-ip 0.0.0.0 --tproxy-mark 0x1/0x1 -A DIVERT -j MARK --set-xmark 0x1/0xffffffff -A DIVERT -j ACCEPTrouting
ip rule add fwmark 1 lookup 100
ip route add local default dev eno1 table 100
Quoted 8 lines
Quoted 3 lines
squid config is default with tproxy option
http_port3129 tproxyHmppff... sorry for this, I will send a fix.
Thanks for the report !
Could you try the following ?
Thanks !
net/netfilter/xt_TPROXY.c | 4 ++++ 1 file changed, 4 insertions(+)
net/netfilter/xt_TPROXY.c +4 -0
@@ -127,6 +127,8 @@ nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb, void *hp, daddr, dport, in->ifindex); +if (sk && !atomic_inc_not_zero (&sk->sk_refcnt)) + sk =NULL ;/* NOTE: we return listeners even if bound to * 0.0.0.0, those are filtered out in * xt_socket, since xt_TPROXY needs 0 bound
@@ -195,6 +197,8 @@ nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff, void *hp, daddr,ntohs (dport), in->ifindex); +if (sk && !atomic_inc_not_zero (&sk->sk_refcnt)) + sk =NULL ;/* NOTE: we return listeners even if bound to * 0.0.0.0, those are filtered out in * xt_socket, since xt_TPROXY needs 0 bound
Quoted 72 lines · Eric Dumazet
Quoted 31 lines · Eric Dumazet
Quoted 30 lines · Denys Fedoryshchenko
Hi!
Tried to run squid on latest kernel, and hit a panic Sometimes it just shows warning in dmesg (but doesnt work properly)
[ 75.701666] IPv4: Attempt to release TCP socket in state 10 ffff88102d430780 [ 83.866974] squid (2700) used greatest stack depth: 12912 bytes left [ 87.506644] IPv4: Attempt to release TCP socket in state 10 ffff880078a48780 [ 114.704295] IPv4: Attempt to release TCP socket in state 10
ffff881029f8ad00I cannot catch yet oops/panic message, netconsole not working.
After triggering warning message 3 times, i am unable to run squid anymore (without reboot), and in netstat it doesnt show port running.
firewall is:
*mangle(quoted diff) +0
-5-A PREROUTING -p tcp -m socket -j DIVERT -A PREROUTING -p tcp -m tcp --dport 80 -i eno1 -j TPROXY --on-port 3129 --on-ip 0.0.0.0 --tproxy-mark 0x1/0x1 -A DIVERT -j MARK --set-xmark 0x1/0xffffffff -A DIVERT -j ACCEPTrouting
ip rule add fwmark 1 lookup 100
ip route add local default dev eno1 table 100Quoted 8 lines
Quoted 3 lines
squid config is default with tproxy option
http_port3129 tproxyHmppff... sorry for this, I will send a fix.
Thanks for the report !
Could you try the following ?
Thanks !
net/netfilter/xt_TPROXY.c | 4 ++++ 1 file changed, 4 insertions(+)net/netfilter/xt_TPROXY.c +2
-0@@ -127,6 +127,8 @@ nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb, void *hp, daddr, dport, in->ifindex); +if (sk && !atomic_inc_not_zero (&sk->sk_refcnt)) + sk =NULL ;/* NOTE: we return listeners even if bound to * 0.0.0.0, those are filtered out in net/netfilter/xt_TPROXY.c +2
-0* xt_socket, since xt_TPROXY needs 0 bound @@ -195,6 +197,8 @@ nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff, void *hp, daddr,ntohs (dport ), in->ifindex); +if (sk && !atomic_inc_not_zero (&sk->sk_refcnt)) + sk =NULL ;/* NOTE: we return listeners even if bound to * 0.0.0.0, those are filtered out in
Quoted 1 line
*
xt_socket, sincext_TPROXYneeds 0 bound
Yes, everything fine after patch!
Thanks a lot
Quoted 2 lines · Denys Fedoryshchenko
Yes, everything fine after patch!
Thanks a lot
Perfect, thanks for testing, I am sending the official patch.
PATCH 1/1 netfilter: tproxy: properly refcount tcp listeners
In reply to Denys FedoryshchenkoFrom: Eric Dumazet <[email protected]>
inet_lookup_listener() and inet6_lookup_listener() no longer take a reference on the found listener.
This minimal patch adds back the refcounting, but we might do this differently in net-next later.
---
Note: bug added in 4.7, stable candidate.
net/netfilter/xt_TPROXY.c | 4 ++++ 1 file changed, 4 insertions(+)
net/netfilter/xt_TPROXY.c +4 -0
@@ -127,6 +127,8 @@ nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb, void *hp, daddr, dport, in->ifindex); +if (sk && !atomic_inc_not_zero (&sk->sk_refcnt)) + sk =NULL ;/* NOTE: we return listeners even if bound to * 0.0.0.0, those are filtered out in * xt_socket, since xt_TPROXY needs 0 bound
@@ -195,6 +197,8 @@ nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff, void *hp, daddr,ntohs (dport), in->ifindex); +if (sk && !atomic_inc_not_zero (&sk->sk_refcnt)) + sk =NULL ;/* NOTE: we return listeners even if bound to * 0.0.0.0, those are filtered out in * xt_socket, since xt_TPROXY needs 0 bound
Re: [PATCH net] netfilter: tproxy: properly refcount tcp listeners
Quoted 7 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
inet_lookup_listener()andinet6_lookup_listener()no longer take a reference on the found listener.This minimal patch adds back the refcounting, but we might do this differently in net-next later.
Applied, thanks Eric!