[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110914162143.GA11157@albatros>
Date: Wed, 14 Sep 2011 20:21:43 +0400
From: Vasiliy Kulikov <segoon@...nwall.com>
To: Pavel Emelyanov <xemul@...allels.com>
Cc: Cyrill Gorcunov <gorcunov@...il.com>, Pavel Machek <pavel@....cz>,
Andrew Morton <akpm00@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"containers@...ts.osdl.org" <containers@...ts.osdl.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
Kirill Shutemov <kirill@...temov.name>,
James Bottomley <jbottomley@...allels.com>,
Nathan Lynch <ntl@...ox.com>, Zan Lynx <zlynx@....org>,
Daniel Lezcano <dlezcano@...ibm.com>,
Tejun Heo <tj@...nel.org>,
Alexey Dobriyan <adobriyan@...il.com>,
Al Viro <viro@...IV.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [patch 2/2] fs, proc: Introduce the /proc/<pid>/map_files/
directory v12
On Wed, Sep 14, 2011 at 20:13 +0400, Pavel Emelyanov wrote:
> > No, I mean something else. Assume you have a task, which does the
> > steps:
> >
> > 1) opens some sensitive file as root. This file is e.g. 0700.
> >
> > 2) mmaps the file via opened fd, either RO or RW.
> >
> > 3) closes fd.
> >
> > 4) drops root.
> >
> > Now it has a mapping of a privileged file, but cannot get fd of it
> > anyhow. With map_files/ he may open his own /proc/$$/map_files/, pass
> > ptrace() check, and get fd of the privileged file. He cannot explicitly
> > open it as it is 0700, but he may open it via map_files/ and get RO/RW
> > fd.
> >
>
> What is the problem here - the fact that we have some file considered to
> be private be open-able by somebody else, or the fact that we can truncate
> the file being mapped?
The latter - the file, which is considered to be restricted to a process
as W only without ability to truncate it, now can be truncated. The
process after (4) had no such ability without map_files/ with current
permission model of mmap'ed files. Or I am missing something?
FWIW, ftruncate() might be not the only syscall which makes sense to use
in this case, I just thought about it.
Thanks,
--
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists