lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 27 Sep 2012 09:59:13 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	"Myklebust, Trond" <Trond.Myklebust@...app.com>
Cc:	Joerg Roedel <joro@...tes.org>,
	Joerg Roedel <joerg.roedel@....com>,
	"linux-nfs@...r.kernel.org" <linux-nfs@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: kernel BUG at /data/lemmy/linux.trees.git/fs/nfs/idmap.c:681!

On Thu, Sep 27, 2012 at 9:16 AM, Myklebust, Trond
<Trond.Myklebust@...app.com> wrote:
>
> I cannot see how that BUG_ON can be triggered in the current code, given
> that the only place where idmap->idmap_key_cons is set to a non-NULL
> value is covered by a mutex, and that it is always cleared before we
> release said mutex.

Quite frankly, the "I cannot see" thing is *never* an excuse for a BUG_ON().

We don't do kernel-killing asserts in Linux. Never.

The only excuse for a BUG_ON() is "I cannot possibly continue, I don't
even have an error path I can take".

If it's a fundamentally impossible situation, the BUG_ON() should
never have been there in the first place!

And if it's a "I don't see how it could happen", then it should have
been something like

    if (WARN_ON_ONCE(condition))
        goto cleanup;

rather than a BUG_ON().

We have too many f*cking BUG_ON's in the kernel, and the fact that one
triggers and it has taken a month and a half without it even being
resolved is a problem.

Get rid of the thing, already, dammit. If you cannot figure out how it
can happen, then the *last* thing you want to do is then kill the
machine so that it's impossible to debug it sanely.

Besides, as far as I can tell, idmap_key_cons locking is suspect
anyway. Stuff like this:

                cons = ACCESS_ONCE(idmap->idmap_key_cons);
                idmap->idmap_key_cons = NULL;

is an almost certain example of "the code is racy, and we did it
wrong". The above is basically *never* correct.

If the access is properly locked, then the ACCESS_ONCE() is a bug.

And if the access *isn't* properly locked, then setting things to NULL
afterwards is in no way safe.

IOW, either way, it's broken. And there's at least two of those
clearly buggy code-sequences involving that field.

So get rid of the BUG_ON() (possibly replacing it with the
WARN_ON_ONCE), and please look at those ACCESS_ONCE() sequences and
fix them. Either they happen under a lock, or they don't. None of this
crazy racy crap, please.

                   Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ