linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Michal Hocko <mhocko@suse.cz>, Ingo Molnar <mingo@elte.hu>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	David Miller <davem@davemloft.net>
Subject: Re: BUG: Bad page map in process udevd (anon_vma: (null)) in 2.6.38-rc4
Date: Sun, 20 Feb 2011 09:27:20 +0100	[thread overview]
Message-ID: <1298190440.8559.50.camel@edumazet-laptop> (raw)
In-Reply-To: <AANLkTik8kjt1TZ5vOoAm_y0f7toGtOSpxOsgCXO-bey9@mail.gmail.com>

Le samedi 19 fA(C)vrier 2011 A  22:15 -0800, Linus Torvalds a A(C)crit :
> On Sat, Feb 19, 2011 at 6:01 PM, Eric W. Biederman
> <ebiederm@xmission.com> wrote:
> >
> > So I think the change below to fix dev_deactivate which Eric D. missed
> > will fix this problem.  Now to go test that.
> 
> You know what? I think the whole thing is crap. I did a simple grep
> for 'unregister_netdevice_many()', and they are all buggy.
> 


> Look in net/ipv4/ip_gre.c, net/ipv4/ipip.c,net/ipv4/ipmr.c,
> net/ipv6/sit.c, look in net/ipv6/ip6mr.c, just just about anywhere.
> Those people *all* do basically a list-head on the stack, and then
> they do unregister_netdevice_many() on those things, and they clearly
> expect the list to be gone.

If they use rtnl_unlock() they are fine, since by the time rtnl_unlock()
returns, devices have been freed. LIST_HEAD content is void, or else we
have more serious bugs.

> 
> I suspect that the right thing to do really is to change the semantics
> of those functions that take that kill-list *entirely*. Namely that
> they will literall ykill the list too, not just the entries on the
> list.
> 
> So unregister_netdevice_many() should always return with the list
> empty and destroyed. There is no valid use of a list of netdevices
> after you've unregistered them.
> 
> Now, dev_deactivate_many() actually has uses of that list after
> they've been de-activated (__dev_close_many will deactivate them, and
> then after that do the whole ndo_stop dance too, so I guess all (two)
> callers of that function need to get rid of their list manually. So I
> think your patch to sch_generic.c is good, but I really think the
> semantics of unregister_netdevice_many() should just be changed.
> 
> And I think the networking people need to do some serious code review
> of this whole thing. The whole "let's build a list on the stack, then
> leave it around, and later use it randomly when the stack head pointer
> is long gone" thing is just incredible crapola. We shouldn't be
> finding these things one-by-one as a list debugging thing fires.
> People need tolook at their code and fix it before the bugs start
> triggering.

This code is run with RTNL locked anyway, so we could use a global list
head, like net_todo_list list (net/core/dev.c line 4980)

I believe the dev->unreg_list had a precise meaning when I introduced it
in 2009 (commits 44a0873d52282f24b1894c58c0f157e0f626ddc9,
9b5e383c11b08784eb0087617f880077982ef769,
23289a37e2b127dfc4de1313fba15bb4c9f0cd5b) .

devices were added to the LIST_HEAD, but never removed. (devices were
freed anyway, and list manipulated inside RNTL by a single thread)

But as Eric B. said, it was re-used for other roles.

We need to track these changes precisely and make appropriate fixes.



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-02-20  8:27 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-16 18:52 Michal Hocko
2011-02-16 19:37 ` Ingo Molnar
2011-02-16 19:50   ` Linus Torvalds
2011-02-16 20:09     ` Linus Torvalds
2011-02-16 20:51       ` Linus Torvalds
2011-02-17  9:09       ` Michal Hocko
2011-02-17 16:13         ` Linus Torvalds
2011-02-17 16:26           ` Michal Hocko
2011-02-17 16:35           ` Ingo Molnar
2011-02-17 18:57             ` Eric W. Biederman
2011-02-17 19:11               ` Linus Torvalds
2011-02-17 19:31                 ` Eric W. Biederman
2011-02-18  3:16                 ` Eric W. Biederman
2011-02-18  4:30                   ` Linus Torvalds
2011-02-18  4:36                     ` David Miller
2011-02-18  6:25                       ` Eric Dumazet
2011-02-18  7:29                         ` Eric Dumazet
2011-02-18  8:54                           ` [PATCH 1/2] net: dont leave active on stack LIST_HEAD Eric Dumazet
2011-02-18 20:14                             ` David Miller
2011-02-18  4:38                     ` BUG: Bad page map in process udevd (anon_vma: (null)) in 2.6.38-rc4 Linus Torvalds
2011-02-18  4:40                       ` David Miller
2011-02-18  4:57                         ` Linus Torvalds
2011-02-18  8:29                           ` Eric W. Biederman
2011-02-18  5:20                     ` Eric W. Biederman
2011-02-18  8:41                       ` Eric Dumazet
2011-02-18  8:59                       ` [PATCH 2/2] net: deinit automatic LIST_HEAD Eric Dumazet
2011-02-18 20:14                         ` David Miller
2011-02-18 12:29                 ` BUG: Bad page map in process udevd (anon_vma: (null)) in 2.6.38-rc4 Michal Hocko
2011-02-18 16:26                   ` Michal Hocko
2011-02-18 16:39                     ` Linus Torvalds
2011-02-18 18:08                       ` Eric W. Biederman
2011-02-18 18:48                         ` Linus Torvalds
2011-02-18 19:01                           ` Arnaldo Carvalho de Melo
2011-02-18 19:11                             ` Arnaldo Carvalho de Melo
2011-02-18 20:38                               ` Eric W. Biederman
2011-02-19  8:35                                 ` [PATCH] tcp: fix inet_twsk_deschedule() Eric Dumazet
2011-02-20  2:59                                   ` David Miller
2011-02-18 19:13                             ` BUG: Bad page map in process udevd (anon_vma: (null)) in 2.6.38-rc4 Eric Dumazet
2011-02-18 19:56                       ` David Miller
2011-02-19  6:22                       ` Eric W. Biederman
2011-02-19 15:33                         ` Linus Torvalds
2011-02-20  2:01                           ` Eric W. Biederman
2011-02-20  6:15                             ` Linus Torvalds
2011-02-20  8:27                               ` Eric Dumazet [this message]
2011-02-20 19:53                               ` David Miller
2011-02-20 21:34                                 ` Eric W. Biederman
2011-02-18  8:54             ` Michal Hocko
2011-02-20 12:43             ` Ingo Molnar
2011-02-17 16:36           ` Eric Dumazet
2011-02-17 17:07             ` Linus Torvalds
2011-02-17 19:36               ` Eric Dumazet
2011-02-17 20:18               ` Linus Torvalds
2011-02-16 20:13     ` Ingo Molnar

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=1298190440.8559.50.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox