lkml.org 
[lkml]   [2020]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/2] seccomp: notify user trap about unused filter
    On Wed, May 27, 2020 at 09:25:59AM -0600, Tycho Andersen wrote:
    > On Wed, May 27, 2020 at 01:19:01PM +0200, Christian Brauner wrote:
    > > +void seccomp_filter_notify(const struct task_struct *tsk)
    > > +{
    > > + struct seccomp_filter *orig = tsk->seccomp.filter;
    > > +
    > > + while (orig && refcount_dec_and_test(&orig->live)) {
    > > + if (waitqueue_active(&orig->wqh))
    > > + wake_up_poll(&orig->wqh, EPOLLHUP);
    > > + orig = orig->prev;
    > > + }
    > > +}
    >
    > Is there a reason this can't live in put_seccomp_filter()?

    put_seccomp_filter() is called from free_task() which in turn gets
    called via delayed_put_task_struct through call_rcu() so the
    notification will happen at some point whereas you'd often want the
    notification to happen at reliable point. This is why most of that stuff
    happens in release_task() which is called in the exit path when the task
    is finally marked as dead. This is similar to how cgroup_release() is
    called from release_task() whereas cgroup_free() is called from
    free_task() or other stuff.

    \
     
     \ /
      Last update: 2020-05-27 17:35    [W:4.198 / U:0.064 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site