All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Pekka J Enberg <penberg@cs.helsinki.fi>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	bryan.wu@analog.com, linux-kernel@vger.kernel.org,
	Hugh Dickins <hugh@veritas.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	dhowells@redhat.com
Subject: Re: [PATCH -mm] Revoke core code: fix nommu arch compiling error bug
Date: Mon, 26 Mar 2007 13:22:44 +0100	[thread overview]
Message-ID: <11045.1174911764@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0703261447190.13229@sbz-30.cs.Helsinki.FI>

Pekka J Enberg <penberg@cs.helsinki.fi> wrote:

> > I don't know, what does it do?  Remember, once a NOMMU process thinks it
> > has the right to access a mapping, there's no way of stopping it doing so
> > short of killing the process.
> 
> revoke_mapping() is mostly same as munmap(2) except that it preserves the 
> vma but makes it VM_REVOKED. This means that if the process tries to 
> access the region it will SIGBUS and if it tries to remap the range it 
> will get EINVAL.

Yeah, that's not enforceable in NOMMU-mode situations.  I presume it differs
from munmap() also in that it can effectively be forced by one process upon
another.

In MMU-mode, how does this work with private mappings that have some private
copies of the pages that make up the mapping?  Are those still available to a
process that is using them?  Are they revoked when swapped out?  Or are they
forcibly evicted?

> What we're trying to do here is, we want to make sure no other tasks can 
> access the inode once it has been revoked.

Okay.

> So there's no way to raise SIGBUS if the range is being accessed. The 
> alternatives are:
> 
>   - No support for revoke(2) on NOMMU.

That's a bit over the top, I think.  It sounds like revoke() is perfectly fine
- as long as there aren't any mappings on the target inode (or at least shared
mappings - dunno about private mappings).

>   - If there are shared mappings, always return -ENOENT for revoke(2).

That sounds feasible.  How about -ETXTBSY instead?

>   - If there are shared mappings, immediately raise SIGBUS for those 
>     processes that are accessing it.

Hmmm... maybe.  That sounds a bit antisocial though, but is also workable.
Does the SIGBUS raised have its own si_code, btw?  Perhaps BUS_REVOKED?

> Making the shared mappings private is not an option because there's no way 
> for the process to know that it's mapping is being pulled under it which 
> will result in bugs. Hmm.

Agreed.

David

  parent reply	other threads:[~2007-03-26 12:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-26 10:23 [PATCH -mm] Revoke core code: fix nommu arch compiling error bug Wu, Bryan
2007-03-26 10:37 ` Pekka J Enberg
2007-03-26 10:41 ` Andrew Morton
2007-03-26 11:25 ` David Howells
2007-03-26 11:30   ` Pekka J Enberg
2007-03-26 11:44   ` David Howells
2007-03-26 11:55     ` Pekka J Enberg
2007-03-26 12:22     ` David Howells [this message]
2007-03-26 12:37       ` Pekka J Enberg
2007-03-26 13:24       ` David Howells
2007-03-26 20:21         ` Mike Frysinger
2007-03-27  3:29           ` Wu, Bryan
2007-03-27  6:57             ` Pekka J Enberg
2007-03-27  7:20               ` Mike Frysinger
2007-03-27 10:05         ` David Howells
2007-03-27 17:00           ` Mike Frysinger
2007-03-27 19:06           ` David Howells
2007-03-26 13:03     ` Alan Cox
2007-03-26 11:50   ` Andrew Morton
2007-03-26 11:58   ` David Howells

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=11045.1174911764@redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bryan.wu@analog.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.