All of lore.kernel.org
 help / color / mirror / Atom feed
* ctnetlink & helper_locking_fix conflict
@ 2004-11-09  7:13 Henrik Nordstrom
  2004-11-09 17:11 ` Harald Welte
  0 siblings, 1 reply; 3+ messages in thread
From: Henrik Nordstrom @ 2004-11-09  7:13 UTC (permalink / raw)
  To: Netfilter Developers

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.

>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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ctnetlink & helper_locking_fix conflict
  2004-11-09  7:13 ctnetlink & helper_locking_fix conflict Henrik Nordstrom
@ 2004-11-09 17:11 ` Harald Welte
  2004-11-10 18:45   ` Pablo Neira
  0 siblings, 1 reply; 3+ messages in thread
From: Harald Welte @ 2004-11-09 17:11 UTC (permalink / raw)
  To: Henrik Nordstrom; +Cc: Netfilter Developers

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

On Tue, Nov 09, 2004 at 08:13:33AM +0100, Henrik Nordstrom wrote:
> 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.
> 
> >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

> Regards
> Henrik

-- 
- Harald Welte <laforge@netfilter.org>             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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ctnetlink & helper_locking_fix conflict
  2004-11-09 17:11 ` Harald Welte
@ 2004-11-10 18:45   ` Pablo Neira
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira @ 2004-11-10 18:45 UTC (permalink / raw)
  To: Harald Welte; +Cc: Netfilter Developers, Henrik Nordstrom

Harald Welte wrote:

>On Tue, Nov 09, 2004 at 08:13:33AM +0100, Henrik Nordstrom wrote:
>  
>
>>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.
>>
>>>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
>  
>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-10 18:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-09  7:13 ctnetlink & helper_locking_fix conflict Henrik Nordstrom
2004-11-09 17:11 ` Harald Welte
2004-11-10 18:45   ` Pablo Neira

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.