From: Eric Dumazet <eric.dumazet@gmail.com>
To: Anton Blanchard <anton@samba.org>
Cc: David Miller <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
linuxppc-dev@lists.ozlabs.org, Paul Mackerras <paulus@samba.org>,
Ambrose Feinstein <ambrose@google.com>,
amodra@gmail.com
Subject: Re: [PATCH net-next] af_unix: fix a fatal race with bit fields
Date: Tue, 30 Apr 2013 19:24:20 -0700 [thread overview]
Message-ID: <1367375060.11020.24.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130501115103.58e40f37@kryten>
On Wed, 2013-05-01 at 11:51 +1000, Anton Blanchard wrote:
> Hi Eric,
>
> > From: Eric Dumazet <edumazet@google.com>
> >
> > Using bit fields is dangerous on ppc64, as the compiler uses 64bit
> > instructions to manipulate them. If the 64bit word includes any
> > atomic_t or spinlock_t, we can lose critical concurrent changes.
> >
> > This is happening in af_unix, where unix_sk(sk)->gc_candidate/
> > gc_maybe_cycle/lock share the same 64bit word.
> >
> > This leads to fatal deadlock, as one/several cpus spin forever
> > on a spinlock that will never be available again.
>
> I just spoke to Alan Modra and he suspects this is a compiler
> bug. Can you give us your compiler version info?
$ gcc-4.6.3-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc -v
Using built-in specs.
COLLECT_GCC=gcc-4.6.3-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc
COLLECT_LTO_WRAPPER=/usr/local/google/home/edumazet/cross/gcc-4.6.3-nolibc/powerpc64-linux/bin/../libexec/gcc/powerpc64-linux/4.6.3/lto-wrapper
Target: powerpc64-linux
Configured with: /home/tony/buildall/src/gcc/configure
--target=powerpc64-linux --host=x86_64-linux-gnu
--build=x86_64-linux-gnu --enable-targets=all
--prefix=/opt/cross/gcc-4.6.3-nolibc/powerpc64-linux/
--enable-languages=c --with-newlib --without-headers
--enable-sjlj-exceptions --with-system-libunwind --disable-nls
--disable-threads --disable-shared --disable-libmudflap --disable-libssp
--disable-libgomp --disable-decimal-float --enable-checking=release
--with-mpfr=/home/tony/buildall/src/sys-x86_64
--with-gmp=/home/tony/buildall/src/sys-x86_64 --disable-bootstrap
--disable-libquadmath
Thread model: single
gcc version 4.6.3 (GCC)
$ cat try.c ; gcc-4.6.3-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc
-O2 -S try.c ; cat try.s
struct s {
unsigned int lock;
unsigned int f1 : 1;
unsigned int f2 : 1;
void *ptr;
} *p ;
showbug()
{
p->lock++;
p->f1 = 1;
}
.file "try.c"
.section ".toc","aw"
.section ".text"
.section ".toc","aw"
.LC0:
.tc p[TC],p
.section ".text"
.align 2
.globl showbug
.section ".opd","aw"
.align 3
showbug:
.quad .L.showbug,.TOC.@tocbase,0
.previous
.type showbug, @function
.L.showbug:
addis 9,2,.LC0@toc@ha
ld 9,.LC0@toc@l(9)
ld 9,0(9)
lwz 11,0(9)
addi 0,11,1
stw 0,0(9)
li 11,1
ld 0,0(9)
rldimi 0,11,31,32
std 0,0(9)
blr
.long 0
.byte 0,0,0,0,0,0,0,0
.size showbug,.-.L.showbug
.comm p,8,8
.ident "GCC: (GNU) 4.6.3"
You can see "ld 0,0(9)" is used : its a 64 bit load.
next prev parent reply other threads:[~2013-05-01 2:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-01 1:12 [PATCH net-next] af_unix: fix a fatal race with bit fields Eric Dumazet
2013-05-01 1:39 ` Benjamin Herrenschmidt
2013-05-01 7:36 ` David Miller
2013-05-01 8:08 ` Benjamin Herrenschmidt
2013-05-01 15:24 ` [PATCH v2 " Eric Dumazet
2013-05-01 15:53 ` David Laight
2013-05-01 16:00 ` Eric Dumazet
2013-05-01 19:14 ` David Miller
2013-05-01 12:08 ` [PATCH " Ben Hutchings
2013-05-03 14:29 ` David Laight
2013-05-03 15:02 ` Eric Dumazet
2013-05-03 15:44 ` David Laight
2013-05-01 1:51 ` Anton Blanchard
2013-05-01 2:24 ` Eric Dumazet [this message]
2013-05-01 3:54 ` Alan Modra
2013-05-01 5:04 ` Eric Dumazet
2013-05-01 15:10 ` Stephen Hemminger
2013-05-02 21:11 ` Benjamin Herrenschmidt
2013-05-03 1:31 ` Alan Modra
2013-05-03 8:20 ` David Laight
2013-05-03 12:57 ` Benjamin Herrenschmidt
2013-05-03 14:14 ` Eric Dumazet
2013-05-02 17:02 ` Scott Wood
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=1367375060.11020.24.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=ambrose@google.com \
--cc=amodra@gmail.com \
--cc=anton@samba.org \
--cc=davem@davemloft.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=paulus@samba.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).