netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@openvz.org>
To: Roel Kluin <12o3l@tiscali.nl>, David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [BUG] in inet6_create
Date: Fri, 02 Nov 2007 15:54:12 +0300	[thread overview]
Message-ID: <472B1DF4.8070503@openvz.org> (raw)
In-Reply-To: <472AF50A.5070706@openvz.org>

Pavel Emelyanov wrote:
> Roel Kluin wrote:
>> I got this bug recently, I am not sure whether this is related to any previously 
>> reported ones. It was a recently pulled git kernel. Also I have been hacking my
>> kernel a bit lately, but I think that I haven't got any changes in the currently
>> running kernel.
>>
>> FYI: my network card was not running (module not loaded, and I just started 
>> thunderbird)
>>
>> Roel
>>
>> More information needed?
> 
> I've tried to objdump my ipv6.ko, and found (at the different offset,
> but) the same codeline. It showed that the buggy place was in:
> 
>         list_for_each_rcu(p, &inetsw6[sock->type]) {
> 
> some list_head pointer was NULL.
> 
> I looked at the inet6_init (which seems to run at the moment of the
> oops according to the calltrace) and found that the ipv6 protocol 
> is first registered and only after this the inetsw6 lists are
> properly initialized.

Hm... A deeper look at the code showed that the proto_register() is
OK to be called before the list initialization.

Nevertheless, the faulty place is found correctly (providing that
Roel's objdump looks similar to mine, but it should - this codeline
is unique in the ipv6.ko).

Roel, are you sure, that the kernel you're running is not hacked
by some of you patches :)

> I suspect that this is a race: we create the socket right after
> the new protocol is registered, but before the list heads are 
> ready. The ->init call is called without the stopmachine, so
> other process run in parallel with it.
> 
> This patch should help, but I don't think that such a situation
> is easily reproducible.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> 
> ---
> 
> diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
> index ecbd388..f9bd26f 100644
> --- a/net/ipv6/af_inet6.c
> +++ b/net/ipv6/af_inet6.c
> @@ -769,6 +769,10 @@ static int __init inet6_init(void)
>  #endif
>  #endif
>  
> +	/* Register the socket-side information for inet6_create.  */
> +	for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r)
> +		INIT_LIST_HEAD(r);
> +
>  	err = proto_register(&tcpv6_prot, 1);
>  	if (err)
>  		goto out;
> @@ -786,10 +790,6 @@ static int __init inet6_init(void)
>  		goto out_unregister_udplite_proto;
>  
>  
> -	/* Register the socket-side information for inet6_create.  */
> -	for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r)
> -		INIT_LIST_HEAD(r);
> -
>  	/* We MUST register RAW sockets before we create the ICMP6,
>  	 * IGMP6, or NDISC control sockets.
>  	 */
> 


  reply	other threads:[~2007-11-02 12:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01 20:07 [BUG] in inet6_create Roel Kluin
2007-11-01 21:14 ` Roel Kluin
2007-11-02  9:15   ` Pavel Emelyanov
2007-11-02 17:51     ` Roel Kluin
2007-11-06  8:14       ` Pavel Emelyanov
2007-11-06 15:44         ` Roel Kluin
2007-11-06 16:06           ` Pavel Emelyanov
2007-11-06 17:31             ` Roel Kluin
2007-11-02  9:59 ` Pavel Emelyanov
2007-11-02 12:54   ` Pavel Emelyanov [this message]
2007-11-05 11:00 ` YOSHIFUJI Hideaki / 吉藤英明
2007-11-07 10:34   ` David Miller

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=472B1DF4.8070503@openvz.org \
    --to=xemul@openvz.org \
    --cc=12o3l@tiscali.nl \
    --cc=davem@davemloft.net \
    --cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).