From mboxrd@z Thu Jan 1 00:00:00 1970 From: Djalal Harouni Subject: Re: [PATCH 0/9] proc: protect /proc//* files across execve Date: Sun, 11 Mar 2012 01:27:25 +0100 Message-ID: <20120311002725.GA4310@dztty> References: <1331421919-15499-1-git-send-email-tixxdz@opendz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Andrew Morton , Al Viro , Alexey Dobriyan , "Eric W. Biederman" , Vasiliy Kulikov , Kees Cook , Solar Designer , WANG Cong , James Morris , Oleg Nesterov , linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alan Cox , Greg KH , Ingo Molnar , Stephen Wilson , "Jason A. Donenfeld" To: Linus Torvalds Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-security-module-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Sat, Mar 10, 2012 at 04:01:09PM -0800, Linus Torvalds wrote: > On Sat, Mar 10, 2012 at 3:25 PM, Djalal Harouni wrote: > > > > 1) Use the target exec_id to bind files to their exec_id task: > > > > For the REG files /proc//{environ,pagemap,mem} we set the exec_id > > of the proc_file_private to the target task, and we continue with > > permission checks at open time, later on each read/write call the > > permission checks are done + check the target exec_id if it equals the > > exec_id of the proc_file_private that was set at open time, in other words > > we bind the file to its task's exec_id, this way new exec programs can not > > operate on the passed fd. > > So the exec_id approach was totally broken when it was used for > /proc//mem, is there any reason to believe it's a good idea now? Yes the previously one was broken since it was not a global uniq exec_id, it was designed for threads tracking. The current one is a global exec_id with uniq IDs, incremented on each do_execve_common() call. > It's entirely predictable, and you can make the exec_id match by > simply forking elsewhere and then passing the fd around using unix > domain sockets, since the exec_id is just updated by incrementing a > counter. For the fork one yes exec_id will match but we have the permission checks (ptrace) at each syscall, so even if two processes share the same exec_id the ptrace check should fail. Yes it's predictable, but I don't see how you could pass the fd to another extern privileged process without failing at the exec_id check. -- tixxdz http://opendz.org