ctnetlink & helper_locking_fix conflict
Hi,
there is a conflict between the above two patches. The helper_locking_fix removes the locks from the helpers, but ctnetlink adds code using these locks.
Quoted 1 line
From reading the code I think the helper side locking should be removed
from the ctnetlink additions as well, but just wanted to verify with you.
Example of the offending code (ip_conntrack_irc.c, and many more):
+static void ctnl_change(struct ip_conntrack *ct, union ip_conntrack_help *h) +{
+ LOCK_BH(&ip_irc_lock);
+ memcpy(&ct->help, h, sizeof(ct->help));
+ UNLOCK_BH(&ip_irc_lock);
+}
+
+static void ctnl_new_expect(struct ip_conntrack_expect *exp,
+ union ip_conntrack_expect_proto *p,
+ union ip_conntrack_expect_help *h)
+{
+ if (h == NULL)
+ return;
+ LOCK_BH(&ip_irc_lock);
+ memcpy(&exp->help, h, sizeof(exp->help));
+ UNLOCK_BH(&ip_irc_lock);
+}
+
where ip_irc_lock was killed by helper_locking_fix.
Regards
Henrik
Quoted 8 lines · Henrik Nordstrom
Hi,
there is a conflict between the above two patches. The
helper_locking_fixremoves the locks from the helpers, but ctnetlink adds code using these locks.Quoted 1 line
From reading the code I think the helper side locking should be removed
from the ctnetlink additions as well, but just wanted to verify with you.
I think it is safe. We're holding a write lock on ip_conntrack_lock and thus it's safe to change the helper data.
If you have a fix for ctnetlink, that would be appreciated
Quoted 2 lines
Regards
Henrik
Signature · 5 lines
- Harald Welte <[email protected]> http://www.netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie
Quoted 8 lines · Harald Welte
Quoted 5 lines · Henrik Nordstrom
Hi,
there is a conflict between the above two patches. The
helper_locking_fixremoves the locks from the helpers, but ctnetlink adds code using these locks.Quoted 1 line
From reading the code I think the helper side locking should be removed
Quoted 10 lines
Quoted 3 lines
from the ctnetlink additions as well, but just wanted to verify with you.
I think it is safe. We're holding a write lock on
ip_conntrack_lockand thus it's safe to change the helper data.If you have a fix for ctnetlink, that would be appreciated
I think that there's a minor race. In ip_conntrack_in()
855 ret = ct->helper->help(*pskb, ct, ctinfo)
This call isn't in a locked section. Someone could be calling the helper at the same time that ctnetlink is modifying the private helper info. I've annotated this issue since I'll be working in that code (change API) once I've done with the event stuff.
Pablo