Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1737043
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() |
| Date | 2017-09-21 22:00 +0200 |
| Message-ID | <usfNE-5au-15@gated-at.bofh.it> (permalink) |
| References | <urMLD-38Q-11@gated-at.bofh.it> <urMLD-38Q-9@gated-at.bofh.it> <urS4H-6Jl-25@gated-at.bofh.it> <us7n3-8lo-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Sep 21, 2017 at 3:57 AM, Oleg Nesterov <oleg@redhat.com> wrote: > On 09/20, Kees Cook wrote: >> >> On Wed, Sep 20, 2017 at 5:56 AM, Oleg Nesterov <oleg@redhat.com> wrote: >> > @@ -908,13 +912,13 @@ long seccomp_get_filter(struct task_struct *task, unsigned long filter_off, >> > if (!data) >> > goto out; >> > >> > - get_seccomp_filter(task); >> > + refcount_inc(&filter->usage); >> > spin_unlock_irq(&task->sighand->siglock); >> > >> > if (copy_to_user(data, fprog->filter, bpf_classic_proglen(fprog))) >> > ret = -EFAULT; >> > >> > - put_seccomp_filter(task); >> > + __put_seccomp_filter(filter); >> > return ret; >> >> Given how reference counting is done for filters, I'd be happier with >> leaving the get_seccomp_filter() as-is, > > No, please note that filter != tsk->seccomp.filter, get_seccomp_filter() > won't work. Ah yes, sorry, you're right. >> (i.e. don't open-code >> the refcount_inc()). > > agreed, probably another __get_seccomp_filter(filter) makes sense, especially > if we do other changes like get_nth(). > > But imo not in this fix. Regardless, whatever lands will need backport adjustment for refcount_*/atomic_* in -stable. Can you resend the two patches; I can send the backport to -stable manually... -Kees -- Kees Cook Pixel Security
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Oleg Nesterov <oleg@redhat.com> - 2017-09-20 15:00 +0200
Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Oleg Nesterov <oleg@redhat.com> - 2017-09-20 15:10 +0200
Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Tycho Andersen <tycho@docker.com> - 2017-09-20 15:40 +0200
introduce get_nth_filter() Oleg Nesterov <oleg@redhat.com> - 2017-09-20 18:00 +0200
Re: introduce get_nth_filter() Oleg Nesterov <oleg@redhat.com> - 2017-09-20 18:20 +0200
Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Kees Cook <keescook@chromium.org> - 2017-09-20 20:50 +0200
Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Oleg Nesterov <oleg@redhat.com> - 2017-09-21 13:40 +0200
Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Tycho Andersen <tycho@docker.com> - 2017-09-20 15:30 +0200
Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Kees Cook <keescook@chromium.org> - 2017-09-20 20:40 +0200
Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Oleg Nesterov <oleg@redhat.com> - 2017-09-21 13:00 +0200
Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Kees Cook <keescook@chromium.org> - 2017-09-21 22:00 +0200
Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Oleg Nesterov <oleg@redhat.com> - 2017-09-22 17:30 +0200
Re: [PATCH] seccomp: fix the usage of get/put_seccomp_filter() in seccomp_get_filter() Tycho Andersen <tycho@docker.com> - 2017-09-22 17:30 +0200
csiph-web