From: Eric Dumazet <eric.dumazet@gmail.com>
To: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: Neil Horman <nhorman@tuxdriver.com>,
Gao Feng <gaofeng@cn.fujitsu.com>,
netdev@vger.kernel.org, davem@davemloft.net,
"Steinar H. Gunderson" <sesse@google.com>
Subject: Re: [PATCH V2] ipv6: fix race condition regarding dst->expires and dst->from.
Date: Wed, 20 Feb 2013 08:12:40 -0800 [thread overview]
Message-ID: <1361376760.19353.185.camel@edumazet-glaptop> (raw)
In-Reply-To: <5124A574.5030904@linux-ipv6.org>
On Wed, 2013-02-20 at 19:29 +0900, YOSHIFUJI Hideaki wrote:
> Eric Dumazet wrote:
> | Some strange crashes happen in rt6_check_expired(), with access
> | to random addresses.
> |
> | At first glance, it looks like the RTF_EXPIRES and
> | stuff added in commit 1716a96101c49186b
> | (ipv6: fix problem with expired dst cache)
> | are racy : same dst could be manipulated at the same time
> | on different cpus.
> |
> | At some point, our stack believes rt->dst.from contains a dst pointer,
> | while its really a jiffie value (as rt->dst.expires shares the same area
> | of memory)
> |
> | rt6_update_expires() should be fixed, or am I missing something ?
> |
> | CC Neil because of https://bugzilla.redhat.com/show_bug.cgi?id=892060
>
> Because we do not have any locks for dst_entry, we cannot change
> essential structure in the entry; e.g., we cannot change reference
> to other entity.
>
> To fix this issue, split 'from' and 'expires' field in dst_entry
> out of union. Once it is 'from' is assigned in the constructor,
> keep the reference until the very last stage of the life time of
> the object.
>
> Of course, it is unsafe to change 'from', so make rt6_set_from simple
> just for fresh entries.
>
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Reported-by: Neil Horman <nhorman@tuxdriver.com>
> CC: Gao Feng <gaofeng@cn.fujitsu.com>
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> ---
This seems good to me, but I cant test it at this moment.
I CC Steinar as he reported one crash to me.
Thanks Yoshifuji !
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reported-by: Steinar H. Gunderson <sesse@google.com>
next prev parent reply other threads:[~2013-02-20 16:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-18 23:55 [RFC] ipv6: rt6_update_expires() seems racy Eric Dumazet
2013-02-19 20:28 ` [RFC PATCH] ipv6: Split from and expires field in dst_entry out of union [net-next] Neil Horman
2013-02-19 21:17 ` Eric Dumazet
2013-02-19 21:49 ` Neil Horman
2013-02-19 21:55 ` Eric Dumazet
2013-02-20 6:33 ` Gao feng
2013-02-20 7:00 ` Eric Dumazet
2013-02-20 9:31 ` Gao feng
2013-02-20 10:02 ` YOSHIFUJI Hideaki
2013-02-20 10:17 ` [PATCH] ipv6: fix race condition regarding dst->expires and dst->from YOSHIFUJI Hideaki
2013-02-20 10:25 ` YOSHIFUJI Hideaki
2013-02-20 10:29 ` [PATCH V2] " YOSHIFUJI Hideaki
2013-02-20 16:12 ` Eric Dumazet [this message]
2013-02-20 16:34 ` Neil Horman
2013-02-20 20:12 ` David Miller
2013-02-20 10:55 ` [RFC PATCH] ipv6: Split from and expires field in dst_entry out of union [net-next] David Laight
2013-02-20 12:02 ` Neil Horman
2013-02-20 12:08 ` David Laight
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=1361376760.19353.185.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=gaofeng@cn.fujitsu.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=sesse@google.com \
--cc=yoshfuji@linux-ipv6.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