From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Gao feng <gaofeng@cn.fujitsu.com>
Cc: George Spelvin <linux@horizon.com>,
bp@alien8.de, kaber@trash.net, linux-kernel@vger.kernel.org,
netfilter@vger.kernel.org
Subject: Re: v3.10-rc7 oops soon after boot
Date: Mon, 24 Jun 2013 13:34:41 +0200 [thread overview]
Message-ID: <20130624113441.GA2583@localhost> (raw)
In-Reply-To: <51C816C8.4080709@cn.fujitsu.com>
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
On Mon, Jun 24, 2013 at 05:52:08PM +0800, Gao feng wrote:
> On 06/24/2013 05:41 PM, George Spelvin wrote:
> >> Please try the patch below,
> >> I think this bug is introduced by me :(
> >>
> >> Thanks!
> >
> > Well, you changed it, but it still crashes.
> >
> > It's now at del_timer+0x9/0x58, with the code being:
>
> This one should work.
>
> Thanks for your quickly reply.
I managed to crash it using a group != 1 (default) and enabling
batching:
iptables -I INPUT -j ULOG --ulog-nlgroup 2 --ulog-qthresh 50
It seems ulog->nlgroup[i] is always left unset.
I have mangled your patch, find it attached.
[-- Attachment #2: 0001-netfilter-ipt_ULOG-fix-incorrect-setting-of-ulog-tim.patch --]
[-- Type: text/x-diff, Size: 2155 bytes --]
From 79da8ea854c06ca9320decbb2f9d2e8d25b2f7e5 Mon Sep 17 00:00:00 2001
From: Gao feng <gaofeng@cn.fujitsu.com>
Date: Mon, 24 Jun 2013 17:04:02 +0800
Subject: [PATCH] netfilter: ipt_ULOG: fix incorrect setting of ulog timer
The parameter of setup_timer should be &ulog->nlgroup[i].
the incorrect parameter will cause kernel panic in
ulog_timer.
Bug introducted in commit 355430671ad93546b34b4e91bdf720f3a704efa4
"netfilter: ipt_ULOG: add net namespace support for ipt_ULOG"
ebt_ULOG doesn't have this problem.
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv4/netfilter/ipt_ULOG.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index ff4b781..32b0e97 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -125,15 +125,16 @@ static void ulog_send(struct ulog_net *ulog, unsigned int nlgroupnum)
/* timer function to flush queue in flushtimeout time */
static void ulog_timer(unsigned long data)
{
+ unsigned int groupnum = *((unsigned int *)data);
struct ulog_net *ulog = container_of((void *)data,
struct ulog_net,
- nlgroup[*(unsigned int *)data]);
+ nlgroup[groupnum]);
pr_debug("timer function called, calling ulog_send\n");
/* lock to protect against somebody modifying our structure
* from ipt_ulog_target at the same time */
spin_lock_bh(&ulog->lock);
- ulog_send(ulog, data);
+ ulog_send(ulog, groupnum);
spin_unlock_bh(&ulog->lock);
}
@@ -407,8 +408,11 @@ static int __net_init ulog_tg_net_init(struct net *net)
spin_lock_init(&ulog->lock);
/* initialize ulog_buffers */
- for (i = 0; i < ULOG_MAXNLGROUPS; i++)
- setup_timer(&ulog->ulog_buffers[i].timer, ulog_timer, i);
+ for (i = 0; i < ULOG_MAXNLGROUPS; i++) {
+ ulog->nlgroup[i] = i;
+ setup_timer(&ulog->ulog_buffers[i].timer, ulog_timer,
+ (unsigned long)&ulog->nlgroup[i]);
+ }
ulog->nflognl = netlink_kernel_create(net, NETLINK_NFLOG, &cfg);
if (!ulog->nflognl)
--
1.7.10.4
WARNING: multiple messages have this Message-ID (diff)
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Gao feng <gaofeng@cn.fujitsu.com>
Cc: George Spelvin <linux@horizon.com>,
bp@alien8.de, kaber@trash.net, linux-kernel@vger.kernel.org,
netfilter@vger.kernel.org
Subject: Re: v3.10-rc7 oops soon after boot
Date: Mon, 24 Jun 2013 13:34:41 +0200 [thread overview]
Message-ID: <20130624113441.GA2583@localhost> (raw)
In-Reply-To: <51C816C8.4080709@cn.fujitsu.com>
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
On Mon, Jun 24, 2013 at 05:52:08PM +0800, Gao feng wrote:
> On 06/24/2013 05:41 PM, George Spelvin wrote:
> >> Please try the patch below,
> >> I think this bug is introduced by me :(
> >>
> >> Thanks!
> >
> > Well, you changed it, but it still crashes.
> >
> > It's now at del_timer+0x9/0x58, with the code being:
>
> This one should work.
>
> Thanks for your quickly reply.
I managed to crash it using a group != 1 (default) and enabling
batching:
iptables -I INPUT -j ULOG --ulog-nlgroup 2 --ulog-qthresh 50
It seems ulog->nlgroup[i] is always left unset.
I have mangled your patch, find it attached.
[-- Attachment #2: 0001-netfilter-ipt_ULOG-fix-incorrect-setting-of-ulog-tim.patch --]
[-- Type: text/x-diff, Size: 2156 bytes --]
>From 79da8ea854c06ca9320decbb2f9d2e8d25b2f7e5 Mon Sep 17 00:00:00 2001
From: Gao feng <gaofeng@cn.fujitsu.com>
Date: Mon, 24 Jun 2013 17:04:02 +0800
Subject: [PATCH] netfilter: ipt_ULOG: fix incorrect setting of ulog timer
The parameter of setup_timer should be &ulog->nlgroup[i].
the incorrect parameter will cause kernel panic in
ulog_timer.
Bug introducted in commit 355430671ad93546b34b4e91bdf720f3a704efa4
"netfilter: ipt_ULOG: add net namespace support for ipt_ULOG"
ebt_ULOG doesn't have this problem.
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv4/netfilter/ipt_ULOG.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index ff4b781..32b0e97 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -125,15 +125,16 @@ static void ulog_send(struct ulog_net *ulog, unsigned int nlgroupnum)
/* timer function to flush queue in flushtimeout time */
static void ulog_timer(unsigned long data)
{
+ unsigned int groupnum = *((unsigned int *)data);
struct ulog_net *ulog = container_of((void *)data,
struct ulog_net,
- nlgroup[*(unsigned int *)data]);
+ nlgroup[groupnum]);
pr_debug("timer function called, calling ulog_send\n");
/* lock to protect against somebody modifying our structure
* from ipt_ulog_target at the same time */
spin_lock_bh(&ulog->lock);
- ulog_send(ulog, data);
+ ulog_send(ulog, groupnum);
spin_unlock_bh(&ulog->lock);
}
@@ -407,8 +408,11 @@ static int __net_init ulog_tg_net_init(struct net *net)
spin_lock_init(&ulog->lock);
/* initialize ulog_buffers */
- for (i = 0; i < ULOG_MAXNLGROUPS; i++)
- setup_timer(&ulog->ulog_buffers[i].timer, ulog_timer, i);
+ for (i = 0; i < ULOG_MAXNLGROUPS; i++) {
+ ulog->nlgroup[i] = i;
+ setup_timer(&ulog->ulog_buffers[i].timer, ulog_timer,
+ (unsigned long)&ulog->nlgroup[i]);
+ }
ulog->nflognl = netlink_kernel_create(net, NETLINK_NFLOG, &cfg);
if (!ulog->nflognl)
--
1.7.10.4
next prev parent reply other threads:[~2013-06-24 11:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 6:49 v3.10-rc7 oops soon after boot George Spelvin
2013-06-24 7:03 ` George Spelvin
2013-06-24 7:33 ` Borislav Petkov
2013-06-24 8:47 ` George Spelvin
2013-06-24 9:12 ` Gao feng
2013-06-24 9:12 ` Gao feng
2013-06-24 9:41 ` George Spelvin
2013-06-24 9:52 ` Gao feng
2013-06-24 9:52 ` Gao feng
2013-06-24 10:01 ` George Spelvin
2013-06-24 11:34 ` Pablo Neira Ayuso [this message]
2013-06-24 11:34 ` Pablo Neira Ayuso
2013-06-24 15:10 ` Pablo Neira Ayuso
2013-06-24 16:13 ` Borislav Petkov
2013-06-24 22:17 ` George Spelvin
2013-06-24 22:34 ` Borislav Petkov
2013-06-25 1:36 ` Gao feng
2013-06-25 6:17 ` Gao feng
2013-06-26 6:28 ` George Spelvin
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=20130624113441.GA2583@localhost \
--to=pablo@netfilter.org \
--cc=bp@alien8.de \
--cc=gaofeng@cn.fujitsu.com \
--cc=kaber@trash.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@horizon.com \
--cc=netfilter@vger.kernel.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.