lkml.org 
[lkml]   [2020]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/3] seccomp: Add find_notification helper
On Fri, May 29, 2020 at 05:40:38PM +0000, Sargun Dhillon wrote:
> >
> > While the comment is good, let's actually enforce this with:
> >
> > if (WARN_ON(!mutex_is_locked(&filter->notif_lock)))
> > return NULL;
> >
> I don't see much use of lockdep in seccomp (well, any), but
> wouldn't a stronger statement be to use lockdep, and just have:
>
> lockdep_assert_held(&filter->notify_lock);
>
> As that checks that the lock is held by the current task.

/me slaps his forehead

Yes. I need more coffee or something. Yes, I meant
lockdep_assert_held(), and now I need to go fix my pstore series since I
confused myself into the wrong function and using it so many times in
pstore overwrote the correct function in my head. Thank you!

> Although, that does put this check behind lockdep, which means
> that running in "normal" circumstances is less safe (but faster?).

Now, that's fine. The check needs to be "am *I* holding this mutex?" and
I don't think anything except lockdep can do that.

--
Kees Cook

\
 
 \ /
  Last update: 2020-05-29 22:16    [W:0.090 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site