linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Miell <nmiell@comcast.net>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Hugh Dickins <hugh@veritas.com>,
	Ulrich Drepper <drepper@gmail.com>,
	blaisorblade@yahoo.it,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch 2/3] MAP_NOZERO - implement sys_brk2()
Date: Wed, 27 Jun 2007 15:11:49 -0700	[thread overview]
Message-ID: <1182982309.2737.9.camel@entropy> (raw)
In-Reply-To: <Pine.LNX.4.64.0706271135560.32731@alien.or.mcafeemobile.com>

On Wed, 2007-06-27 at 11:45 -0700, Davide Libenzi wrote:
> On Wed, 27 Jun 2007, Hugh Dickins wrote:
> 
> > On Wed, 27 Jun 2007, Davide Libenzi wrote:
> > > On Wed, 27 Jun 2007, Hugh Dickins wrote:
> > > 
> > > > In honesty, I should add that I dislike and distrust Davide's
> > > > MAP_NOZERO very much indeed!  Would much rather leave my cpus
> > > > spending a little time in clear_page().  A uid in struct page
> > > > (though I'm sure we could find somewhere to tuck it away) -
> > > > the horror, the horror!  But I've so far failed to find a killer
> > > > argument against it, and am hoping for someone else to do so.
> > > 
> > > Little time? Please, do not trust me. Start oprofile and run a kernel 
> > > build. Look, I'm not even talking about som micro benchmark explicitly 
> > > built to exploit the thing. A kernel build.
> > > You will find clear_page to be the *1st* kernel entry after cc1 and as.
> > > That is bad for two reasons. The time it spends in there, and the cache it 
> > > blows.
> > 
> > I don't doubt that it shows real benefits; but dangerously cutting
> > corners usually shows benefits too.  Relying on a uid at this level
> > feels very wrong to me - but as I said, I've not found a killer
> > argument against it.
> 
> The reason why I posted is exactly so other ppl can look at it and find 
> possible flaws in the way pages and retired. If an effective UID was able 
> to see (or it generated) the data on that page, it should be able to get 
> that page back uncleared (when VM_NOZERO is set).
> >From a performance POV, a 2-3% boost on a non-micro-bench test like a 
> kernel build is not exaclty peanuts. And for more heavy malloc/anon-mmap 
> appliations, the boost goes up to 10-15%. That is not exactly what I 
> call "little time" ;)
>
> - Davide
> 

I don't think the security issues with this will ever make it
worthwhile.

Consider:

1) euid is not sufficient, you need to store away arbitrary LSM
information and call LSM hooks to decide security equivalence. The same
applies to VServer or whatever other container system you use.

2) Two processes, A and B, are in separate VFS namespaces but have
equivalent security identity according to LSM. Process A reads data from
file F which is not visible in process's B's namespace. You have to
prevent process B from ever getting a page that once contained data from
file F.

3) mlock() is often used by programs like GPG to prevent decrypted
secret keys from ever getting swapped out. You need to zero all
once-mlocked pages before they get reused to prevent that page from
getting swapped to disk or application bugs from leaking the key.

-- 
Nicholas Miell <nmiell@comcast.net>


  reply	other threads:[~2007-06-27 22:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-27  2:44 [patch 2/3] MAP_NOZERO - implement sys_brk2() Davide Libenzi
2007-06-27  3:07 ` Rik van Riel
2007-06-27  3:33   ` Davide Libenzi
2007-06-27  3:45   ` Ulrich Drepper
2007-06-27  4:11     ` Rik van Riel
2007-06-27  5:04       ` Ulrich Drepper
2007-06-27  3:48 ` Ulrich Drepper
2007-06-27  3:55   ` Davide Libenzi
2007-06-27  5:02     ` Ulrich Drepper
2007-06-27 12:32       ` Hugh Dickins
2007-06-27 15:59         ` Davide Libenzi
2007-06-27 17:01         ` Ulrich Drepper
2007-06-27 17:43           ` Hugh Dickins
2007-06-27 18:13             ` Davide Libenzi
2007-06-27 18:32               ` Hugh Dickins
2007-06-27 18:45                 ` Davide Libenzi
2007-06-27 22:11                   ` Nicholas Miell [this message]
2007-06-28  0:17                     ` Davide Libenzi
2007-06-28  2:58                       ` Davide Libenzi
2007-06-30  7:52                     ` Andrew Morton
2007-06-27 18:52             ` Ulrich Drepper
2007-06-27 19:32               ` Hugh Dickins
2007-06-27 19:00           ` Rik van Riel
2007-06-27 19:22             ` Davide Libenzi
2007-06-27 16:05       ` 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=1182982309.2737.9.camel@entropy \
    --to=nmiell@comcast.net \
    --cc=blaisorblade@yahoo.it \
    --cc=davidel@xmailserver.org \
    --cc=drepper@gmail.com \
    --cc=hugh@veritas.com \
    --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).