2.6.13-rc4-mm1: iptables DROP crashes the computer
Subsystems (3)
After execing "iptables -A INPUT -j DROP" my computer crashes hard. It dosent hang immediately, but after a couple of seconds.
The machine is an amd64, running a clean x86_64 environment. uname -a: Linux gentoo 2.6.13-rc4-mm1 #1 PREEMPT Thu Aug 4 01:01:44 CEST 2005 x86_64 AMD Athlon(tm) 64 Processor 3400+ AuthenticAMD GNU/Linux
lspci:
0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8385 [K8T800 AGP] Host Bridge (rev 01)
0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI bridge [K8T800/K8T890 South]
0000:00:09.0 Multimedia audio controller: Creative Labs SB Audigy (rev 04) 0000:00:09.1 Input device controller: Creative Labs SB Audigy MIDI/Game port (rev 04)
0000:00:09.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port (rev 04)
0000:00:0a.0 Ethernet controller: Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller (rev 13)
0000:00:0e.0 Multimedia video controller: Conexant CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
0000:00:0f.0 RAID bus controller: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80)
0000:00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06) 0000:00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
0000:00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86) 0000:00:11.0 ISA bridge: VIA Technologies, Inc. VT8237 ISA bridge [KT600/K8T800/K8T890 South]
0000:00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration 0000:00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
0000:00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
0000:00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
0000:01:00.0 VGA compatible controller: ATI Technologies Inc R420 JK [Radeon X800]
0000:01:00.1 Display controller: ATI Technologies Inc: Unknown device 4a6b
.config is attached.
--
Mvh / Best regards
Espen Fjellvær Olsen
[email protected]
Norway
Quoted 6 lines · Espen Fjellvær Olsen
After execing "iptables -A INPUT -j DROP" my computer crashes hard. It dosent hang immediately, but after a couple of seconds.
The machine is an amd64, running a cleanx86_64environment. uname -a: Linux gentoo 2.6.13-rc4-mm1 #1 PREEMPT Thu Aug 4 01:01:44 CEST 2005x86_64AMD Athlon(tm) 64 Processor 3400+ AuthenticAMD
...
Is this reproducible or did it happen only once?
Are there any messages that might give a hint where to search for the problem?
You are reporting this against 2.6.13-rc4-mm1, but are attaching a .config of 2.6.13-rc5-mm1. Which kernels are affected, and which are not?
Does it still happen if you compile your kernel with preemption disabled?
Please send the output of ./scripts/ver_linux .
Quoted 2 lines
Mvh / Best regards
Espen Fjellvær Olsen
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 10 lines · Adrian Bunk
Quoted 6 lines · Espen Fjellvær Olsen
After execing "iptables -A INPUT -j DROP" my computer crashes hard. It dosent hang immediately, but after a couple of seconds.
The machine is an amd64, running a cleanx86_64environment. uname -a: Linux gentoo 2.6.13-rc4-mm1 #1 PREEMPT Thu Aug 4 01:01:44 CEST 2005x86_64AMD Athlon(tm) 64 Processor 3400+ AuthenticAMD
...Is this reproducible or did it happen only once?
It is reproducible, happens each time when running "iptables -A INPUT -j DROP", other rules like "iptables -A INPUT -m --state ESTABLISHED,RELATED -p tcp --dport 22 -j ACCEPT" works well tho.
Quoted 2 lines
Are there any messages that might give a hint where to search for the problem?
The kernel log dont give any messages before the crash, and since the computer crash hard i cant check for relevant messages after the crash ;)
Quoted 3 lines
You are reporting this against 2.6.13-rc4-mm1, but are attaching a .config of 2.6.13-rc5-mm1. Which kernels are affected, and which are not?
Im sorry about that glitch, recently compiled 2.6.13-rc5-mm1, but i got a kernel panic at boot, havent looked into that yet, but it might be related to ACPI.
The config for rc4-mm1 and rc5-mm1 is similar.
Quoted 2 lines
Does it still happen if you compile your kernel with preemption disabled?
Havent tried this yet, but ill do it right away.
Quoted 1 line
Please send the output of
./scripts/ver_linux.
If some fields are empty or look unusual you may have an old version. Compare to the current minimal requirements in Documentation/Changes.
Linux gentoo 2.6.13-rc4-mm1 #1 PREEMPT Thu Aug 4 01:01:44 CEST 2005 x86_64 AMD Athlon(tm) 64 Processor 3400+ AuthenticAMD GNU/Linux
Gnu C 3.4.4 Gnu make 3.80 binutils 2.16.1 util-linux 2.12q mount 2.12q module-init-tools 3.2-pre7 e2fsprogs 1.38 reiserfsprogs line reiser4progs line xfsprogs 2.6.25 Linux C Library 2.3.5 Dynamic linker (ldd) 2.3.5 Procps 3.2.5 Net-tools 1.60 Kbd 1.12 Sh-utils 5.2.1 udev 065 Modules Loaded iptable_filter ip_tables snd_seq_midi
snd_emu10k1_synth snd_emux_synth snd_seq_virmidi snd_seq_midi_event snd_seq_midi_emul snd_seq snd_pcm_oss snd_mixer_oss rtc ntfs snd_emu10k1 snd_rawmidi snd_seq_device snd_ac97_codec snd_pcm snd_timer snd_page_alloc snd_util_mem snd_hwdep snd soundcore usb_storage uhci_hcd usbcore
Signature · 4 lines
Mvh / Best regards Espen Fjellvær Olsen [email protected] Norway
Quoted 9 lines · Adrian Bunk
Quoted 6 lines · Espen Fjellvær Olsen
After execing "iptables -A INPUT -j DROP" my computer crashes hard. It dosent hang immediately, but after a couple of seconds.
The machine is an amd64, running a cleanx86_64environment. uname -a: Linux gentoo 2.6.13-rc4-mm1 #1 PREEMPT Thu Aug 4 01:01:44 CEST 2005x86_64AMD Athlon(tm) 64 Processor 3400+ AuthenticAMD
...
Could be related to the refcnt underflow with conntrack event notifications enabled. If you have CONFIG_IP_NF_CONNTRACK_EVENTS enabled please try this patch.
[NETFILTER]: Fix multiple problems with the conntrack event cache
refcnt underflow: the reference count is decremented when a conntrack entry is removed from the hash but it is not incremented when entering new entries.
missing protection of process context against softirq context: all cache operations need to locally disable softirqs to avoid races. Additionally the event cache can't be initialized when a packet enteres the conntrack code but needs to be initialized whenever we cache an event and the stored conntrack entry doesn't match the current one.
incorrect flushing of the event cache in ip_ct_iterate_cleanup: without real locking we can't flush the cache for different CPUs without incurring races. The cache for different CPUs can only be flushed when no packets are going through the code. ip_ct_iterate_cleanup doesn't need to drop all references, so flushing is moved to the cleanup path.
---
commit d20d18715b8425060334e879ebb4835202457b3e
tree 3279243f59162c14f8ac145473e1c3f4c586b2fa
parent df2e0392536ecdd6385f4319f746045fd6fae38f
author Patrick McHardy <[email protected]> Wed, 03 Aug 2005 20:33:25 +0200 committer Patrick McHardy <[email protected]> Wed, 03 Aug 2005 20:33:25 +0200
include/linux/netfilter_ipv4/ip_conntrack.h | 29 +++--- include/linux/netfilter_ipv4/ip_conntrack_core.h | 14 +-- net/ipv4/netfilter/ip_conntrack_core.c | 107 ++++++++-------------- net/ipv4/netfilter/ip_conntrack_standalone.c | 3 - 4 files changed, 58 insertions(+), 95 deletions(-)
include/linux/netfilter_ipv4/ip_conntrack.h +13 -16
@@ -411,6 +411,7 @@ struct ip_conntrack_stat #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS #include <linux/notifier.h> +#include <linux/interrupt.h> struct ip_conntrack_ecache { struct ip_conntrack *ct;
@@ -445,26 +446,24 @@ ip_conntrack_expect_unregister_notifier(return notifier_chain_unregister (&ip_conntrack_expect_chain, nb); } +extern void ip_ct_deliver_cached_events (const struct ip_conntrack *ct); +extern void __ip_ct_event_cache_init (struct ip_conntrack *ct); +static inline void ip_conntrack_event_cache (enum ip_conntrack_events event,const struct sk_buff *skb) { -struct ip_conntrack_ecache *ecache = - &__get_cpu_var (ip_conntrack_ecache); - -if (unlikely ((struct ip_conntrack *) skb->nfct != ecache->ct)) { -if (net_ratelimit ()) { -printk (KERN_ERR "ctevent: skb->ct != ecache->ct !!!\n" ); -dump_stack (); - } - } +struct ip_conntrack *ct = (struct ip_conntrack *)skb->nfct; +struct ip_conntrack_ecache *ecache; + +local_bh_disable (); + ecache = &__get_cpu_var (ip_conntrack_ecache); +if (ct != ecache->ct) +__ip_ct_event_cache_init (ct); ecache->events |= event; +local_bh_enable (); } -extern void -ip_conntrack_deliver_cached_events_for (const struct ip_conntrack *ct); -extern void ip_conntrack_event_cache_init (const struct sk_buff *skb); -static inline void ip_conntrack_event (enum ip_conntrack_events event,struct ip_conntrack *ct) {
@@ -483,9 +482,7 @@ static inline void ip_conntrack_event_ca const struct sk_buff *skb) {}static inline void ip_conntrack_event (enum ip_conntrack_events event,struct ip_conntrack *ct) {} -static inline void ip_conntrack_deliver_cached_events_for ( -struct ip_conntrack *ct) {} -static inline void ip_conntrack_event_cache_init (const struct sk_buff *skb) {} +static inline void ip_ct_deliver_cached_events (const struct ip_conntrack *ct) {}static inline void ip_conntrack_expect_event (enum ip_conntrack_expect_events event,struct ip_conntrack_expect *exp) {}
include/linux/netfilter_ipv4/ip_conntrack_core.h +5 -9
@@ -44,18 +44,14 @@ static inline int ip_conntrack_confirm(sstruct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct;int ret =NF_ACCEPT ; -if (ct && !is_confirmed (ct)) - ret =__ip_conntrack_confirm (pskb); -ip_conntrack_deliver_cached_events_for (ct); - +if (ct) { +if (!is_confirmed (ct)) + ret =__ip_conntrack_confirm (pskb); +ip_ct_deliver_cached_events (ct); + }return ret; } -#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS -struct ip_conntrack_ecache ; -extern void __ip_ct_deliver_cached_events (struct ip_conntrack_ecache *ec); -#endif -extern void __ip_ct_expect_unlink_destroy (struct ip_conntrack_expect *exp);extern struct list_head *ip_conntrack_hash;
net/ipv4/netfilter/ip_conntrack_core.c +39 -68
149 lines not on this page · raw message
net/ipv4/netfilter/ip_conntrack_standalone.c +1 -2
@@ -401,7 +401,6 @@ static unsigned int ip_confirm(unsigned const struct net_device *out, int (*okfn)(struct sk_buff *)) { - ip_conntrack_event_cache_init(*pskb); /* We've seen it coming out the other side: confirm it */ return ip_conntrack_confirm(pskb); }
@@ -419,7 +418,6 @@ static unsigned int ip_conntrack_help(un ct =ip_conntrack_get (*pskb, &ctinfo);if (ct && ct->helper) {unsigned int ret; -ip_conntrack_event_cache_init (*pskb); ret = ct->helper->help (pskb, ct, ctinfo);if (ret !=NF_ACCEPT )return ret;
@@ -978,6 +976,7 @@ EXPORT_SYMBOL_GPL(ip_conntrack_chain);EXPORT_SYMBOL_GPL (ip_conntrack_expect_chain);EXPORT_SYMBOL_GPL (ip_conntrack_register_notifier);EXPORT_SYMBOL_GPL (ip_conntrack_unregister_notifier); +EXPORT_SYMBOL_GPL (__ip_ct_event_cache_init);EXPORT_PER_CPU_SYMBOL_GPL (ip_conntrack_ecache);#endif EXPORT_SYMBOL (ip_conntrack_protocol_register);
Quoted 4 lines · Patrick McHardy
Could be related to the refcnt underflow with conntrack event notifications enabled. If you have
CONFIG_IP_NF_CONNTRACK_EVENTSenabled please try this patch.
I can confirm that that patch solved my problems, thank you :)
Signature · 4 lines
Mvh / Best regards Espen Fjellvær Olsen [email protected] Norway