Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-29 Thread Christian Brauner
On Fri, May 29, 2020 at 01:32:03AM +0200, Jann Horn wrote: > On Fri, May 29, 2020 at 1:11 AM Kees Cook wrote: > > On Thu, May 28, 2020 at 05:14:11PM +0200, Christian Brauner wrote: > > > * @usage: reference count to manage the object lifetime. > > > * get/put helpers should be used whe

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-29 Thread Christian Brauner
On Fri, May 29, 2020 at 01:06:59AM -0700, Kees Cook wrote: > On Fri, May 29, 2020 at 09:56:41AM +0200, Christian Brauner wrote: > > On Thu, May 28, 2020 at 04:11:00PM -0700, Kees Cook wrote: > > > void seccomp_filter_release(const struct task_struct *tsk) > > > { > > > struct seccomp_filter *orig

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-29 Thread Kees Cook
On Fri, May 29, 2020 at 09:56:41AM +0200, Christian Brauner wrote: > On Thu, May 28, 2020 at 04:11:00PM -0700, Kees Cook wrote: > > void seccomp_filter_release(const struct task_struct *tsk) > > { > > struct seccomp_filter *orig = READ_ONCE(tsk->seccomp.filter); > > > > smp_store_release(&

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-29 Thread Kees Cook
On Fri, May 29, 2020 at 09:47:44AM +0200, Christian Brauner wrote: > Well the correct way would probably be: > "usage" -> "refs" > "live" -> "users" Yeah, I like it! :) > So we'd need a first patch to convert "usage" to "refs" and then > introduce "users". Yup, sounds right. > > signal_struct

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-29 Thread Christian Brauner
On Fri, May 29, 2020 at 12:56:50AM -0700, Kees Cook wrote: > On Fri, May 29, 2020 at 09:51:37AM +0200, Christian Brauner wrote: > > Aside from this being not an issue now, can we please not dump seccomp > > filter contents in proc. That sounds terrible and what's the rationale, > > libseccomp alrea

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-29 Thread Christian Brauner
On Thu, May 28, 2020 at 04:11:00PM -0700, Kees Cook wrote: > On Thu, May 28, 2020 at 05:14:11PM +0200, Christian Brauner wrote: > > * @usage: reference count to manage the object lifetime. > > * get/put helpers should be used when accessing an instance > > * outside of a lifet

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-29 Thread Kees Cook
On Fri, May 29, 2020 at 09:51:37AM +0200, Christian Brauner wrote: > Aside from this being not an issue now, can we please not dump seccomp > filter contents in proc. That sounds terrible and what's the rationale, > libseccomp already let's you dump filter contents while loading and you > could ptr

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-29 Thread Christian Brauner
On Fri, May 29, 2020 at 01:32:03AM +0200, Jann Horn wrote: > On Fri, May 29, 2020 at 1:11 AM Kees Cook wrote: > > On Thu, May 28, 2020 at 05:14:11PM +0200, Christian Brauner wrote: > > > * @usage: reference count to manage the object lifetime. > > > * get/put helpers should be used whe

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-29 Thread Christian Brauner
On Thu, May 28, 2020 at 04:11:00PM -0700, Kees Cook wrote: > On Thu, May 28, 2020 at 05:14:11PM +0200, Christian Brauner wrote: > > * @usage: reference count to manage the object lifetime. > > * get/put helpers should be used when accessing an instance > > * outside of a lifet

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-28 Thread Kees Cook
On Fri, May 29, 2020 at 01:32:03AM +0200, Jann Horn wrote: > On Fri, May 29, 2020 at 1:11 AM Kees Cook wrote: > > So, is it safe to detach the filter in release_task()? Has dethreading > > happened yet? i.e. can we race TSYNC? -- is there a possible > > inc-from-zero? > > release_task -> __exit_s

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-28 Thread Jann Horn
On Fri, May 29, 2020 at 1:11 AM Kees Cook wrote: > On Thu, May 28, 2020 at 05:14:11PM +0200, Christian Brauner wrote: > > * @usage: reference count to manage the object lifetime. > > * get/put helpers should be used when accessing an instance > > * outside of a lifetime-guard

Re: [PATCH v2 1/2] seccomp: notify user trap about unused filter

2020-05-28 Thread Kees Cook
On Thu, May 28, 2020 at 05:14:11PM +0200, Christian Brauner wrote: > * @usage: reference count to manage the object lifetime. > * get/put helpers should be used when accessing an instance > * outside of a lifetime-guarded section. In general, this > * is only needed