From: Tobias DiPasquale <codeslinger@gmail.com>
To: Tobias DiPasquale <codeslinger@gmail.com>,
netfilter-devel@lists.netfilter.org
Subject: Re: GFP_KERNEL i checkentry
Date: Fri, 17 Jun 2005 17:56:39 -0400 [thread overview]
Message-ID: <876ef97a0506171456ea839db@mail.gmail.com> (raw)
In-Reply-To: <20050617203044.GB14065@aaricia.csbnet.se>
On 6/17/05, Joakim Axelsson <gozem@gozem.se> wrote:
> Back to the problem. I did some more testing. I created a module
> ipt_ALLOCTEST which only allocs a 'size' bytes 'number' of times in
> checkentry. I couldn't get the kernel to crash with it. It seems however if
> i also add a spinlock locked using spin_lock_bh() i put myself under the
> "spell" of in_interrupt() and must there fore use GFP_ATOMIC.
Yeah, spin_lock_bh() will create a situation that in_interrupt() will
return true on. This is what's causing the problem with your
allocations. Had I read the code earlier, I would have seen this
fairly obvious error. I was at work at the time, though, and a little
busy... ;-)
> Another conclusion is that spin_lock_bh does not disapear even if the kernel
> is compiled UP (not SMP).
The spin_lock part will, but the _bh() part won't, and that's what the
problem is in this case. You can't allocate GFP_KERNEL while in
interrupt context.
> Now to some more exact question:
> Is ONLY ipt_match and ipt_target in_interrupts()? What about spin_lock
> (without bh), ipt_checkentry and ipt_destroy. Also, how does proc-entry
> works (read and write). While at it. Module loading code is also not
> in_interrupt(), correct?
spin_lock's without bh are still no good, because kmalloc( ...,
GFP_KERNEL) can put you to sleep while holding that lock (which will
cause a deadlock). If you need a spin_lock, use GFP_ATOMIC. A good
book on this and more is Linux Kernel Development by Robert Love.
> I put my test code at http://www.gozem.se/~gozem/netfilter/
>
> Thank you for your time.
I will check it out later tonight when I get home from dinner.
--
[ Tobias DiPasquale ]
0x636f6465736c696e67657240676d61696c2e636f6d
prev parent reply other threads:[~2005-06-17 21:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-17 16:50 GFP_KERNEL i checkentry Joakim Axelsson
2005-06-17 17:12 ` Tobias DiPasquale
2005-06-17 18:29 ` Joakim Axelsson
2005-06-17 20:30 ` Joakim Axelsson
2005-06-17 21:56 ` Tobias DiPasquale [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=876ef97a0506171456ea839db@mail.gmail.com \
--to=codeslinger@gmail.com \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.