From: Christian Brauner <brauner@kernel.org>
To: Oleksandr Tymoshenko <ovt@google.com>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] seccomp: fix refcounter leak if fork/clone is terminated
Date: Mon, 5 Sep 2022 10:39:14 +0200 [thread overview]
Message-ID: <20220905083914.msdgd575tblq4syj@wittgenstein> (raw)
In-Reply-To: <20220902034135.2853973-1-ovt@google.com>
On Fri, Sep 02, 2022 at 03:41:35AM +0000, Oleksandr Tymoshenko wrote:
> release_task, where the seccomp's filter refcounter is released, is not
> called for the case when the fork/clone is terminated midway by a
> signal. This leaves an extra reference that prevents filter from being
> destroyed even after all processes using it exit leading to a BPF JIT
> memory leak. Dereference the refcounter in the failure path of the
> copy_process function.
>
> Fixes: 3a15fb6ed92c ("seccomp: release filter after task is fully dead")
> Cc: Christian Brauner <brauner@kernel.org>
> Cc: stable@vger.kernel.org
> Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
> ---
Hey Oleksandr,
Thanks for the patch! I'm really puzzled as to why we never noticed this
and I'm trying to re-architect how this happend. But in any case,
there's a patch in the seccomp tree that fixes this:
https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id=6d17452707ca
which is slighly different from your approach in that it moves
copy_seccomp() after the point of no return. Let us know if you see any
issues with this!
Christian
next prev parent reply other threads:[~2022-09-05 8:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 3:41 Oleksandr Tymoshenko
2022-09-05 8:39 ` Christian Brauner [this message]
2022-09-05 22:53 ` Oleksandr Tymoshenko
2022-09-06 7:46 ` Christian Brauner
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=20220905083914.msdgd575tblq4syj@wittgenstein \
--to=brauner@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ovt@google.com \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®