From: Andrew Morton <akpm@linux-foundation.org>
To: Calvin Liao <calvin.liao@gmail.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
"Eric W . Biederman" <ebiederm@xmission.com>,
"Peter Zijlstra" <peterz@infradead.org>,
Christian Brauner <christian.brauner@ubuntu.com>,
Jens Axboe <axboe@kernel.dk>, Alexey Gladkov <legion@kernel.org>,
Mike Christie <michael.christie@oracle.com>,
"David Hildenbrand" <david@redhat.com>,
Rolf Eike Beer <eb@emlix.com>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
wsd_upstream <wsd_upstream@mediatek.com>,
"calvin.liao" <calvin.liao@mediatek.com>,
Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [PATCH 1/1] seccomp: release seccomp after killing terminate clone/fork
Date: Wed, 29 Dec 2021 15:53:05 -0800 [thread overview]
Message-ID: <20211229155305.eb4e3cf76fc9e811bb2b3bfc@linux-foundation.org> (raw)
In-Reply-To: <20211228053421.26825-1-calvin.liao@gmail.com>
On Tue, 28 Dec 2021 13:34:21 +0800 Calvin Liao <calvin.liao@gmail.com> wrote:
> From: "calvin.liao" <calvin.liao@mediatek.com>
>
> Add to release seccomp after killing terminate clone/fork to avoid
> memory leak when enabling CONFIG_SECCOMP.
>
Help us out here - where was this filter allocated? Please describe
the code flow which led to this leak. Rather than simply saying "there
is a leak".
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1698,6 +1698,13 @@ static void copy_seccomp(struct task_struct *p)
> #endif
> }
>
> +static void release_seccomp(struct task_struct *p)
> +{
> +#ifdef CONFIG_SECCOMP
> + seccomp_filter_release(p);
> +#endif
ifdefs aren't needed?
> +}
> +
> SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
> {
> current->clear_child_tid = tidptr;
> @@ -2405,6 +2412,7 @@ static __latent_entropy struct task_struct *copy_process(
> return p;
>
> bad_fork_cancel_cgroup:
> + release_seccomp(p);
Why not simply call seccomp_filter_release() here, without ifdefs?
> sched_core_free(p);
> spin_unlock(¤t->sighand->siglock);
> write_unlock_irq(&tasklist_lock);
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
prev parent reply other threads:[~2021-12-29 23:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-28 5:34 [PATCH 1/1] seccomp: release seccomp after killing terminate clone/fork Calvin Liao
2021-12-29 23:53 ` Andrew Morton [this message]
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=20211229155305.eb4e3cf76fc9e811bb2b3bfc@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aarcange@redhat.com \
--cc=axboe@kernel.dk \
--cc=calvin.liao@gmail.com \
--cc=calvin.liao@mediatek.com \
--cc=christian.brauner@ubuntu.com \
--cc=david@redhat.com \
--cc=eb@emlix.com \
--cc=ebiederm@xmission.com \
--cc=legion@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=michael.christie@oracle.com \
--cc=peterz@infradead.org \
--cc=wsd_upstream@mediatek.com \
/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;
as well as URLs for NNTP newsgroup(s).