Skip to contentSkip to conversation

problem with 'raw' patch and REJECT target

PATCH In review Gatis Peisenieks 2 participants 2 messages Jan 8, 2004 – Jan 9, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 problem with 'raw' patch and REJECT target

Hello all,

here is a patch that fixes (?) a bug in 'raw' table. The bug can be replicated by using raw table with one NOTRACK rule that matches everything and a filter rule (in my case in INPUT chain) that has REJECT target. First ICMP/TCP packet that matches the REJECT rule make the kernel crash with NULL pointer dereference.

Investigation showed that the cause of a crash is REJECTs generated ICMP error and TCP RST packets that used uninitialised entries in ip_conntrack_untracked ip_conntrack.

Not sure about right solution of the problem, but the following patch made the crash go away.
diff was generated on net/ipv4/netfilter/ip_conntrack_core.c with raw.patch applied.

RCS file: /kernel/linux4/net/ipv4/netfilter/ip_conntrack_core.c,v retrieving revision 1.12

ip_conntrack_core.c 8 Jan 2004 16:58:05 -0000 renamed from ip_conntrack_core.c 2 Dec 2003 11:50:36 -0000 1.12 +0 -0
diff -u -r1.12 ip_conntrack_core.c
@@ -1473,7 +1473,8 @@
        set_bit(IPS_CONFIRMED_BIT, &ip_conntrack_untracked.status);
        /*  - and prepare the ctinfo field for NAT. */
        ip_conntrack_untracked.infos[IP_CT_NEW].master =

&ip_conntrack_untracked.ct_general;
-
+ ip_conntrack_untracked.infos[IP_CT_RELATED].master =
&ip_conntrack_untracked.ct_general;
+ ip_conntrack_untracked.infos[IP_CT_RELATED + IP_CT_IS_REPLY].master

= &ip_conntrack_untracked.ct_general;
        return ret;

err_free_hash:

Gatis

#1 lore raw

Hi Gatis,

Quoted 5 lines · Gatis Peisenieks

here is a patch that fixes (?) a bug in 'raw' table. The bug can be replicated by using raw table with one NOTRACK rule that matches everything and a filter rule (in my case in INPUT chain) that has REJECT target. First ICMP/TCP packet that matches the REJECT rule make the kernel crash with NULL pointer dereference.

Your analysis and patch is correct. Thank you very much, I'll add the fixed raw patch to cvs.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary