[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160816184733.GA19380@pc.thejh.net>
Date: Tue, 16 Aug 2016 20:47:33 +0200
From: Jann Horn <jann@...jh.net>
To: Robert Foss <robert.foss@...labora.com>
Cc: corbet@....net, akpm@...ux-foundation.org, vbabka@...e.cz,
mhocko@...e.com, koct9i@...il.com, hughd@...gle.com,
n-horiguchi@...jp.nec.com, john.stultz@...aro.org,
minchan@...nel.org, ross.zwisler@...ux.intel.com,
jmarchan@...hat.com, hannes@...xchg.org, mingo@...nel.org,
keescook@...omium.org, viro@...iv.linux.org.uk,
gorcunov@...nvz.org, sonnyrao@...omium.org,
plaguedbypenguins@...il.com, eric.engestrom@...tec.com,
rientjes@...gle.com, jdanis@...gle.com, calvinowens@...com,
adobriyan@...il.com, kirill.shutemov@...ux.intel.com,
ldufour@...ux.vnet.ibm.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, Ben Zhang <benzh@...omium.org>,
Bryan Freed <bfreed@...omium.org>,
Filipe Brandenburger <filbranden@...omium.org>,
Mateusz Guzik <mguzik@...hat.com>,
Michal Hocko <mhocko@...nel.org>, linux-api@...r.kernel.org
Subject: Re: [PACTH v3 1/3] mm, proc: Implement /proc/<pid>/totmaps
On Tue, Aug 16, 2016 at 02:34:15PM -0400, Robert Foss wrote:
> On 2016-08-16 02:18 PM, Jann Horn wrote:
> >On Tue, Aug 16, 2016 at 01:34:14PM -0400, robert.foss@...labora.com wrote:
> >>+ }
> >>+
> >>+ return 0;
> >>+
> >>+error:
> >>+ return ret;
> >>+}
> >>+
> >[...]
> >>+const struct file_operations proc_totmaps_operations = {
> >>+ .open = totmaps_open,
> >>+ .read = seq_read,
> >>+ .llseek = seq_lseek,
> >>+ .release = proc_map_release,
> >>+};
> >
> >As I said regarding v2 already:
> >This won't release priv->task, causing a memory leak (exploitable
> >through a reference counter overflow of the task_struct usage
> >counter).
>
> Sorry about dropping the ball on that one, what's correct way to release
> priv->task?
get_proc_task() does get_pid_task(), which does get_task_struct(), which
increments the ->usage field of the task. You want the inverse
operation - something that decrements ->usage and checks for zero. This is
done via put_task_struct(), which is defined a few lines below
get_task_struct().
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists