Re: netfilter hooks context?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After reading [A Map of the Networking Code in Linux Kernel 2.4.20]
and thinking about it. It seems to me that packets coming from the
host will often be in process context e.g. UDP packets will be
generated for each sendto syscall. So packets in the localout and
postrouing could potentially be in run in process context.

Therefore spin locks in those hooks should disable bottom halves to be
safe from deadlock. Can anyone confirm or invalidate this please?

cheers
Iain

On Fri, Oct 19, 2012 at 5:18 PM, Iain Fraser <iainkfraser@xxxxxxxxx> wrote:
> Hello,
>
> I'm writing a LKM that uses netfilter hooks. I thought that netfilter
> hooks were run in softirq context. So when using spinlocks in the
> hooks I use plain spin_lock and in any process context code e.g. proc
> I use spin_lock_bh. However my code occasionally deadlocks with this
> single lock.
>
> If the hooks were running in softirq context this wouldn't occur
> because softirq's don't preemept each other on the same processor. So
> now I'm wondering if my original softirq assumption was incorrect. Can
> a hook be called from NON softirq context?
>
> thanks in advance
> Iain
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux