[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090206224059.GA9080@pingi.kke.suse.de>
Date: Fri, 6 Feb 2009 23:41:00 +0100
From: Karsten Keil <kkeil@...e.de>
To: Rusty Russell <rusty@...tcorp.com.au>
Cc: linux-kernel@...r.kernel.org, Michal Hocko <mhocko@...e.cz>,
richard kennedy <richard@....demon.co.uk>,
Dan Williams <dan.j.williams@...el.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Russell King <rmk+kernel@....linux.org.uk>,
dwmw2@...radead.org, Scott Wood <scottwood@...escale.com>,
netdev@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>,
gregkh@...e.de
Subject: Re: [RFC] Suspicious bug in module refcounting
Hi Rusty,
On Wed, Feb 04, 2009 at 02:18:08PM +1030, Rusty Russell wrote:
> On Wednesday 04 February 2009 00:17:21 Karsten Keil wrote:
> > The refcount is a per CPU atomic variable, module_refcount() simple add
> > in a fully unprotected loop (not disabled irqs, not protected against
> > scheduling) all per cpu values.
>
> Hi Karsten,
>
> Yes, the BUG_ON() is overly aggressive. And I really hate __module_get,
> and it looks like most of the callers are completely bogus. The watchdog
> drivers use it to nail themselves in place in their open routines: this is
> OK, if a bit weird.
>
...
>
> Meanwhile, I'll remove the BUG_ON for 2.6.29.
>
> Thanks,
> Rusty.
Seems that this was not picked up yet for 2.6.29, but I think it really should
go in random triggering BUG() is not very nice, maybe it should also added to
the stable trees.
Can you please submit it again ?
>
> module: remove over-zealous check in __module_get()
>
> module_refcount() isn't reliable outside stop_machine(), as demonstrated
> by Karsten Keil <kkeil@...e.de>, networking can trigger it under load
> (an inc on one cpu and dec on another while module_refcount() is tallying
> can give false results, for example).
>
> Almost noone should be using __module_get, but that's another issue.
>
> Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -407,7 +407,6 @@ static inline void __module_get(struct m
> static inline void __module_get(struct module *module)
> {
> if (module) {
> - BUG_ON(module_refcount(module) == 0);
> local_inc(__module_ref_addr(module, get_cpu()));
> put_cpu();
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Karsten Keil
SuSE Labs
ISDN and VOIP development
SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists