From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alan Modra <amodra@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
netdev <netdev@vger.kernel.org>,
Ambrose Feinstein <ambrose@google.com>,
Paul Mackerras <paulus@samba.org>,
Anton Blanchard <anton@samba.org>,
linuxppc-dev@lists.ozlabs.org, David Miller <davem@davemloft.net>
Subject: Re: [PATCH net-next] af_unix: fix a fatal race with bit fields
Date: Fri, 03 May 2013 22:57:27 +1000 [thread overview]
Message-ID: <1367585847.4389.65.camel@pasglop> (raw)
In-Reply-To: <20130503013136.GN5221@bubble.grove.modra.org>
On Fri, 2013-05-03 at 11:01 +0930, Alan Modra wrote:
> On Tue, Apr 30, 2013 at 10:04:32PM -0700, Eric Dumazet wrote:
> > These kind of errors are pretty hard to find, its a pity to spend time
> > on them.
>
> Well, yes. From the first comment in gcc PR52080. "For the following
> testcase we generate a 8 byte RMW cycle on IA64 which causes locking
> problems in the linux kernel btrfs filesystem."
>
> Did someone fix btrfs, but not check other kernel locks? Having now
> hit the same problem again, have you checked that other kernel locks
> don't have adjacent bit fields in the same 64-bit word? And comment
> the struct to ensure someone doesn't optimize those unsigned chars
> back to bit fields.
Unfortunately, fixing "other" kernel locks is near impossible.
One could try to grep for all spinlock_t and maybe even all atomic_t,
may even write a script to spot automatically if a bitfield appears
to be around (though it could be hidden behind a structure etc...) but
what about an int accessed with cmxchg (a kernel macro doing a
lwarx/stwcx. loop on a value) for example ? There's plenty of these...
I don't think we can realistically "fix" all potential occurrences of
that bug in the kernel short of geting rid of all bitfields, which isn't
going to happen any time soon.
I'm afraid this *must* be fixed at the compiler level, with as backports
much as can realistically be done back to distros.
Ben.
next prev parent reply other threads:[~2013-05-03 12:57 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
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 [this message]
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=1367585847.4389.65.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=ambrose@google.com \
--cc=amodra@gmail.com \
--cc=anton@samba.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--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).