Skip to contentSkip to conversation

Race Conditions

DISCUSSION A K A 2 participants 2 messages Feb 20, 2003 – Feb 26, 2003 netfilter

lore
Share & tools
lore

A K A

author
#0 lore raw

I have developed a module and in the init_module function i register two functions to two hooks -NF_IP_LOCAL_IN and NF_IP_POST_ROUTING. In the two functions i am acesssing a global data structure. Is it possible for me to have race condition while accessing the data structure or can I be sure that while one function is executing another will not because they are both running at the same IRQ level which is below the schedular, and hence cannot interupt each other. Is this assumption correct.

any coments, suggestions and pointers are appreciated.

regards,
Asad

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

#1 lore raw
Quoted 10 lines · A K A

I have developed a module and in the init_module function i register two functions to two hooks -NF_IP_LOCAL_IN and NF_IP_POST_ROUTING. In the two functions i am acesssing a global data structure. Is it possible for me to have race condition while accessing the data structure or can I be sure that while one function is executing another will not because they are both running at the same IRQ level which is below the schedular, and hence cannot interupt each other. Is this assumption correct.

no, you cannot. All netfilter code needs to be SMP-safe and you can have two threads in the same softirq context (netfilter runs in softirq context).

Quoted 2 lines

regards,
Asad

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