problem with ipset and 2.4.31, again...
Subsystems (2)
Hi
ipset from patch-o-matic-ng(r6345) fails to compile on 2.4.31/32, Problem and solution is the same as this :
http://lists.netfilter.org/pipermail/netfilter-devel/2005-January/018087.html
In some earlier version this was fixed but this problem comes back again :)
When CONFIG_NETFILTER_DEBUG is defined RWLOCK is structure but without DEBUG , only rwlock_t l is use , WRITE_LOCK is write_lock_bh etc etc, maybe this need some note in patch-o-matic-ng/patchlets/set/help that set must by compiled without DEBUG , or use macros everywhere .
patch is attached.
/pch
Signature · 2 lines
Dyslexia bug unpatched since 1977 ... exploit has been leaked to the underground.
ip_set.c renamed from ip_set.c.20060224 +38 -38
@@ -130,7 +130,7 @@IP_SET_ASSERT (ip_set_list[id]);DP ("set: %s, ip: %u.%u.%u.%u" , ip_set_list[id]->name,HIPQUAD (ip)); -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock); set_hash =LIST_FIND (&ip_set_hash[key], ip_hash_cmp, struct ip_set_hash *, id, ip); DP("set: %s, ip: %u.%u.%u.%u, binding: %s", ip_set_list[id]->name,
@@ -139,7 +139,7 @@if (set_hash !=NULL )__set_hash_del (set_hash); -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return 0 ; }
@@ -155,7 +155,7 @@IP_SET_ASSERT (ip_set_list[binding]);DP ("set: %s, ip: %u.%u.%u.%u, binding: %s" , ip_set_list[id]->name,HIPQUAD (ip), ip_set_list[binding]->name); -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock); set_hash =LIST_FIND (&ip_set_hash[key], ip_hash_cmp, struct ip_set_hash *, id, ip);if (!set_hash) {
@@ -177,7 +177,7 @@ set_hash->binding = binding;__ip_set_get (set_hash->binding); unlock: -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return ret; }
@@ -221,7 +221,7 @@unsigned char i =0 ;IP_SET_ASSERT (flags[i]); -read_lock_bh (&ip_set_lock); +READ_LOCK (&ip_set_lock); do { set = ip_set_list[index]; IP_SET_ASSERT(set);
@@ -233,7 +233,7 @@ }while (res >0 && flags[i] &&follow_bindings (index, set, ip)); -read_unlock_bh (&ip_set_lock); +READ_UNLOCK (&ip_set_lock);return res; }
@@ -250,7 +250,7 @@IP_SET_ASSERT (flags[i]); retry: -read_lock_bh (&ip_set_lock); +READ_LOCK (&ip_set_lock); do { set = ip_set_list[index]; IP_SET_ASSERT(set);
@@ -262,7 +262,7 @@ }while ((res ==0 || res == -EEXIST ) && flags[i] &&follow_bindings (index, set, ip)); -read_unlock_bh (&ip_set_lock); +READ_UNLOCK (&ip_set_lock);if (res == -EAGAIN && set->type->retry
@@ -281,7 +281,7 @@unsigned char i =0 ;IP_SET_ASSERT (flags[i]); -read_lock_bh (&ip_set_lock); +READ_LOCK (&ip_set_lock); do { set = ip_set_list[index]; IP_SET_ASSERT(set);
@@ -293,7 +293,7 @@ }while ((res ==0 || res == -EEXIST ) && flags[i] &&follow_bindings (index, set, ip)); -read_unlock_bh (&ip_set_lock); +READ_UNLOCK (&ip_set_lock); }/* Register and deregister settype */
@@ -326,7 +326,7 @@return -EINVAL ; } -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock);if (find_set_type (set_type->typename)) {/* Duplicate! */ ip_set_printk("'%s' already registered!",
@@ -338,14 +338,14 @@list_append (&set_type_list, set_type);DP ("'%s' registered." , set_type->typename); unlock: -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return ret; }void ip_set_unregister_set_type (struct ip_set_type *set_type) { -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock);if (!find_set_type (set_type->typename)) {ip_set_printk ("'%s' not registered?" , set_type->typename);
@@ -355,7 +355,7 @@ __MOD_DEC_SELF;DP ("'%s' unregistered." , set_type->typename); unlock: -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock); }
@@ -567,13 +567,13 @@if (binding ==IP_SET_INVALID_ID )return -ENOENT ; -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock);/* Sets as binding values are referenced */ if (set->binding !=IP_SET_INVALID_ID )__ip_set_put (set->binding); set->binding = binding;__ip_set_get (set->binding); -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return 0 ; }
@@ -645,15 +645,15 @@/* unbind :all: */ if (strcmp (req_bind->binding,IPSET_TOKEN_DEFAULT ) ==0 ) {/* Default binding of sets */ -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock);FOREACH_SET_DO (__unbind_default); -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return 0 ; }else if (strcmp (req_bind->binding,IPSET_TOKEN_ALL ) ==0 ) {/* Flush all bindings of all sets*/ -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock);FOREACH_HASH_RW_DO (__set_hash_del); -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return 0 ; }DP ("unreachable reached!" );
@@ -669,19 +669,19 @@if (binding ==IP_SET_INVALID_ID )return -ENOENT ; -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock);/* Sets in hash values are referenced */ __ip_set_put (set->binding); set->binding =IP_SET_INVALID_ID ; -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return 0 ; }else if (strcmp (req_bind->binding,IPSET_TOKEN_ALL ) ==0 ) {/* Flush all bindings */ -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock);FOREACH_HASH_RW_DO (__set_hash_del_byid, set->id); -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return 0 ; }
@@ -757,10 +757,10 @@ {struct ip_set_type *type; -read_lock_bh (&ip_set_lock); +READ_LOCK (&ip_set_lock); type =find_set_type (typename);if (type ==NULL ) -read_unlock_bh (&ip_set_lock); +READ_UNLOCK (&ip_set_lock);return type; }
@@ -848,7 +848,7 @@return -ENOENT ; }__MOD_INC (set->type->me); -read_unlock_bh (&ip_set_lock); +READ_UNLOCK (&ip_set_lock);/* * Without holding any locks, create private part.
@@ -867,7 +867,7 @@* find free id/index and check that it is not already in * ip_set_list. */ -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock);if ((res =find_free_id (set->name, &index, &id)) !=0 ) {DP ("no free id!" ); goto cleanup;
@@ -886,11 +886,11 @@DP ("create: '%s' created with index %u, id %u!" , set->name, index, id); set->id = id; ip_set_list[index] = set; -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return res; cleanup: -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock); set->type->destroy (set);__MOD_DEC (set->type->me);kfree (set);
@@ -907,12 +907,12 @@IP_SET_ASSERT (set);DP ("set: %s" , set->name); -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock);FOREACH_HASH_RW_DO (__set_hash_del_byid, set->id);if (set->binding !=IP_SET_INVALID_ID )__ip_set_put (set->binding); ip_set_list[index] =NULL ; -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);/* Must call it without holding any lock */ set->type->destroy (set);
@@ -983,7 +983,7 @@int res =0 ;DP ("set: %s to %s" , set->name, name); -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock); for (i = 0; i < ip_set_max; i++) { if (ip_set_list[i] != NULL && strncmp(ip_set_list[i]->name,
@@ -995,7 +995,7 @@ }strncpy (set->name, name,IP_SET_MAXNAMELEN ); unlock: -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return res; }
@@ -1017,7 +1017,7 @@return -ENOEXEC ;/* No magic here: ref munging protected by the mutex */ -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock);strncpy (from_name, from->name,IP_SET_MAXNAMELEN ); from_ref =atomic_read (&from->ref);
@@ -1029,7 +1029,7 @@ ip_set_list[from_index] = to; ip_set_list[to_index] = from; -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);return 0 ; }
@@ -1351,10 +1351,10 @@ hash_save->binding); else {IP_SET_ASSERT (set->binding ==IP_SET_INVALID_ID ); -write_lock_bh (&ip_set_lock); +WRITE_LOCK (&ip_set_lock); set->binding = hash_save->binding;__ip_set_get (set->binding); -write_unlock_bh (&ip_set_lock); +WRITE_UNLOCK (&ip_set_lock);DP ("default binding: %u" , set->binding); }if (res !=0 )
Hi,
Quoted 2 lines · Piotr Chytla
ipset from patch-o-matic-ng(r6345) fails to compile on 2.4.31/32, Problem and solution is the same as this :
We are at rev 6470 in p-o-m-ng, I think you are using a too old release.
lockhelp.h dependecy was completely removed from ipset so CONFIG_NETFILTER_DEBUG does not affect it at all.
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
Quoted 5 lines · Jozsef Kadlecsik
Quoted 2 lines
ipset from patch-o-matic-ng(r6345) fails to compile on 2.4.31/32, Problem and solution is the same as this :
We are at rev 6470 in p-o-m-ng, I think you are using a too old release.
Sorry my mistake, It wasn't rev 6345, I'm using ftp snapshot patch-o-matic-ng-20060222.
Quoted 3 lines
lockhelp.hdependecy was completely removed from ipset soCONFIG_NETFILTER_DEBUGdoes not affect it at all.
ip_set.c from patch-o-matic-ng-20060222/patchlets/set/linux/net/ipv4/netfilter/ip_set.c
MD5(./ip_set.c)= 4f7670b61c1c19ef53efa9f8b3967ae5
I'm geting this while compiling 2.4.31 with ipset:
gcc -D__KERNEL__ -I/storage/src/linux-2.4.31-ipset/include -Wall
-Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common
-fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686
-DMODULE -DMODVERSIONS -include /storage/src/linux-2.4.31-ipset/include/linux/modversions.h -nostdinc -iwithprefix include -DKBUILD_BASENAME=ip_set -DEXPORT_SYMTAB -c ip_set.c ip_set.c: In function `ip_set_hash_del':
ip_set.c:133: warning: passing arg 1 of `write_lock' from incompatible pointer type
ip_set.c:142: error: structure has no member named `lock'ip_set.c: In function `ip_set_hash_add':
ip_set.c:158: warning: passing arg 1 of `write_lock' from incompatible pointer type
ip_set.c:180: error: structure has no member named `lock'ip_set.c: In function `ip_set_testip_kernel_Rsmp_4db03336':
ip_set.c:224: warning: passing arg 1 of `read_lock' from incompatible pointer type
ip_set.c:236: error: structure has no member named `lock'ip_set.c: In function `ip_set_addip_kernel_Rsmp_9c8f3e11':
ip_set.c:253: warning: passing arg 1 of `read_lock' from incompatible pointer type
ip_set.c:265: error: structure has no member named `lock'ip_set.c: In function `ip_set_delip_kernel_Rsmp_e054472f':
ip_set.c:284: warning: passing arg 1 of `read_lock' from incompatible pointer type
ip_set.c:296: error: structure has no member named `lock'ip_set.c: In function `ip_set_register_set_type_Rsmp_313ca42e':
ip_set.c:329: warning: passing arg 1 of `write_lock' from incompatible pointer type
ip_set.c:341: error: structure has no member named `lock'ip_set.c: In function `ip_set_unregister_set_type_Rsmp_8e327a2d':
ip_set.c:348: warning: passing arg 1 of `write_lock' from incompatible pointer type
ip_set.c:358: error: structure has no member named `lock'ip_set.c: In function `ip_set_bindip':
ip_set.c:570: warning: passing arg 1 of `write_lock' from incompatible pointer type
ip_set.c:576: error: structure has no member named `lock'
/pch
Signature · 2 lines
Dyslexia bug unpatched since 1977 ... exploit has been leaked to the underground.
Hi,
Quoted 8 lines · Piotr Chytla
Quoted 5 lines · Jozsef Kadlecsik
Quoted 2 lines
ipset from patch-o-matic-ng(r6345) fails to compile on 2.4.31/32, Problem and solution is the same as this :
We are at rev 6470 in p-o-m-ng, I think you are using a too old release.
Sorry my mistake, It wasn't rev 6345, I'm using ftp snapshot patch-o-matic-ng-20060222.
You are right, the lock definition relied on lockhelp.h. Instead of putting back the lockhelp.h dependency, the attached patch removes it completely from the 2.4.* branch of the patch. It has been commited in svn as well. Thank you for letting me about the problem.
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
net/ipv4/netfilter/ip_set.c +1 -1
@@ -32,7 +32,7 @@static struct list_head set_type_list;/* all registered sets */ static struct ip_set **ip_set_list;/* all individual sets */ -static DECLARE_RWLOCK (ip_set_lock);/* protects the lists and the hash */ +static rwlock_t ip_set_lock =RW_LOCK_UNLOCKED ;/* protects the lists and the hash */ static DECLARE_MUTEX (ip_set_app_mutex);/* serializes user access */ static ip_set_id_t ip_set_max =CONFIG_IP_NF_SET_MAX ;static ip_set_id_t ip_set_bindings_hash_size =CONFIG_IP_NF_SET_HASHSIZE ;