linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch 1/3] MAP_NOZERO - implement a new VM_NOZERO/MAP_NOZERO page retirement policy
Date: Wed, 27 Jun 2007 00:18:50 -0400	[thread overview]
Message-ID: <4681E52A.8030300@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0706262016080.26540@alien.or.mcafeemobile.com>

Davide Libenzi wrote:
> On Tue, 26 Jun 2007, Rik van Riel wrote:
> 
>> SUID programs should not be able to use this feature,
>> either.
> 
> Why? A SUID programs runs under the UID of the owner, and should be no 
> problems in it seeing the owners data.

Because an SUID program can change its UID back.

At least, one that was SUID root.  OTOH, any
program running as root can change UID, so we
should probably not allow root to get nonzeroed
pages.

> But the patch post was more a quest for possible scenarios where the use 
> of MAP_NOZERO can result in lower security WRT the same program (under the 
> same security restrictions) not using such feature.
> If you have something specific in mind, please go ahead and shoot.

Besides the non-enforcing of SELinux security
labels (and maybe namespaces?), I cannot think
of anything.

>>> When pages exit (unmapped from) a  vma, they are marked with the effective
>>> UID of the  mm_struct  that owns it.
>>
>>> --- linux-2.6.mod.orig/include/linux/mm_types.h	2007-06-21
>>> 14:02:06.000000000 -0700
>>> +++ linux-2.6.mod/include/linux/mm_types.h	2007-06-25 19:11:22.000000000
>>> -0700
>>> @@ -64,6 +64,7 @@
>>>  	struct list_head lru;		/* Pageout list, eg. active_list
>>>  					 * protected by zone->lru_lock !
>>>  					 */
>>> +	int owner_uid;			/* Last owner of the page */
>>>  	/*
>>>  	 * On machines where all RAM is mapped into kernel address space,
>>>  	 * we can simply calculate the virtual address. On machines with
>> Since this is only set when the page is freed, could
>> the owner_uid and security context be put inside a
>> union with some fields that are not otherwise used
>> for free pages?
> 
> I tried to look, and the attempt to reuse _mapcount failed miserably :)
> The last time we have the owner info (vma->mm) available, is before 
> processing of the other fields ends. OTOH I'm not VM guru either, so I may 
> be wrong. It can share ->virtual (when enabled).

I think the process that actually calls the page freeing
functions is always the process that owned the page, so
going for current->mm should work.

Getting the UID wrong for file pages caught in a truncate
is fine, since the process obviously already had access
to the data in that page.

-- 
Politics is the struggle between those who want to make their country
the best in the world, and those who believe it already is.  Each group
calls the other unpatriotic.

  reply	other threads:[~2007-06-27  4:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-27  2:44 [patch 1/3] MAP_NOZERO - implement a new VM_NOZERO/MAP_NOZERO page retirement policy Davide Libenzi
2007-06-27  3:03 ` Rik van Riel
2007-06-27  3:28   ` Davide Libenzi
2007-06-27  4:18     ` Rik van Riel [this message]
2007-06-27  4:32       ` Davide Libenzi
2007-06-28  6:19         ` Andy Isaacson
2007-06-28 14:27           ` Rik van Riel
2007-06-28 18:24           ` Davide Libenzi

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=4681E52A.8030300@redhat.com \
    --to=riel@redhat.com \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).