[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211229155305.eb4e3cf76fc9e811bb2b3bfc@linux-foundation.org>
Date: Wed, 29 Dec 2021 15:53:05 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Calvin Liao <calvin.liao@...il.com>
Cc: Matthias Brugger <matthias.bgg@...il.com>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
"Peter Zijlstra" <peterz@...radead.org>,
Christian Brauner <christian.brauner@...ntu.com>,
Jens Axboe <axboe@...nel.dk>,
Alexey Gladkov <legion@...nel.org>,
Mike Christie <michael.christie@...cle.com>,
"David Hildenbrand" <david@...hat.com>,
Rolf Eike Beer <eb@...ix.com>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
wsd_upstream <wsd_upstream@...iatek.com>,
"calvin.liao" <calvin.liao@...iatek.com>,
Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [PATCH 1/1] seccomp: release seccomp after killing terminate
clone/fork
On Tue, 28 Dec 2021 13:34:21 +0800 Calvin Liao <calvin.liao@...il.com> wrote:
> From: "calvin.liao" <calvin.liao@...iatek.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);
Powered by blists - more mailing lists