All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Kees Cook <keescook@chromium.org>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andy Lutomirski <luto@amacapital.net>
Subject: Re: Runtime trouble with commit dbd952127d (seccomp: introduce writer locking)
Date: Mon, 11 Aug 2014 13:26:05 -0700	[thread overview]
Message-ID: <20140811202605.GA2986@roeck-us.net> (raw)
In-Reply-To: <CAGXu5jJ7AKTG+d50Mo8WfvZQ2dYkE8syq=517TkHMYouvJCZXw@mail.gmail.com>

On Mon, Aug 11, 2014 at 12:51:22PM -0700, Kees Cook wrote:
> On Mon, Aug 11, 2014 at 7:11 AM, Guenter Roeck <linux@roeck-us.net> wrote:
> > On 08/11/2014 04:48 AM, Oleg Nesterov wrote:
> >>
> >> On 08/10, Linus Torvalds wrote:
> >>>
> >>>
> >>> So that should just be converted to assert_spin_is_locked().
> >>
> >>
> >> I still think that lockdep_assert_held() is better. Unlike
> >> assert_spin_locked() it checks that this lock is held by us, and this
> >> is what we want in this case.
> >>
> >
> > assert_spin_locked maps to "BUG_ON(!raw_spin_is_locked(x))"
> > which it seems is exactly what the current code is doing.
> > I submitted a patch to make that change to use assert_spin_locked.
> > Presumably the author had a reason for using BUG_ON and not
> > lockdep_assert_held(), ie to perform the checks all the time
> > and not just while debugging. For me this was the safe change
> > to make. Anything else should, in my opinion, come from the
> > original author who introduced the code.
> 
> Thanks for the patch! Yeah, that's a weird case; I think we need some
> documentation in the header file about the UP vs SMP logic when using
> spin_is_locked(). I note that all other stuff gets hidden behind the
> _up and _smp headers.
> 
Guess one has to know what to look for.

Documentation/scsi/ChangeLog.megaraid gives a hint, as do the comments
next to WARN_ON_SMP.

Not that I knew before last night :-).

> I don't prefer lockdep_assert_held(), though, since I want lock
> failures to hit BUG. I'll apply the patch and ask James to pull it.
> 
Thanks a lot!

Guenter

      reply	other threads:[~2014-08-11 20:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-10  1:47 Runtime trouble with commit dbd952127d (seccomp: introduce writer locking) Guenter Roeck
2014-08-10  3:18 ` Kees Cook
2014-08-10  5:37   ` Guenter Roeck
2014-08-10 18:35   ` Guenter Roeck
2014-08-10 19:33   ` Oleg Nesterov
2014-08-10 20:51     ` Guenter Roeck
2014-08-10 21:10       ` Linus Torvalds
2014-08-10 23:18         ` Guenter Roeck
2014-08-11  0:05           ` Linus Torvalds
2014-08-11 11:48             ` Oleg Nesterov
2014-08-11 14:11               ` Guenter Roeck
2014-08-11 19:51                 ` Kees Cook
2014-08-11 20:26                   ` Guenter Roeck [this message]

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=20140811202605.GA2986@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=oleg@redhat.com \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.