mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
	Ingo Molnar <mingo@elte.hu>, Robin Holt <holt@sgi.com>,
	Andrew Morton <akpm@osdl.org>, Roland McGrath <roland@redhat.com>,
	linux-mm@kvack.org, linux-kernel <linux-kernel@vger.kernel.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [patch 2.6.13-rc4] fix get_user_pages bug
Date: Mon, 1 Aug 2005 22:06:15 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.61.0508012153570.6323@goblin.wat.veritas.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0508011250210.3341@g5.osdl.org>

On Mon, 1 Aug 2005, Linus Torvalds wrote:
> On Mon, 1 Aug 2005, Hugh Dickins wrote:
> > 
> > > Aside, that brings up an interesting question - why should readonly
> > > mappings of writeable files (with VM_MAYWRITE set) disallow ptrace
> > > write access while readonly mappings of readonly files not? Or am I
> > > horribly confused?
> > 
> > Either you or I.  You'll have to spell that out to me in more detail,
> > I don't see it that way.
> 
> We have always just done a COW if it's read-only - even if it's shared.
> 
> The point being that if a process mapped did a read-only mapping, and a 
> tracer wants to modify memory, the tracer is always allowed to do so, but 
> it's _not_ going to write anything back to the filesystem.  Writing 
> something back to an executable just because the user happened to mmap it 
> with MAP_SHARED (but read-only) _and_ the user had the right to write to 
> that fd is _not_ ok.

I'll need to think that through, but not right now.  It's a surprise
to me, and it's likely to surprise the current kernel too.  I'd prefer
to say that if the executable was mapped shared from a writable fd,
then the tracer will write back to it; but you're clearly against that.
We may need to split the vma to handle your semantics correctly.

> Using the dirty flag for a "page is _really_ writable" is admittedly kind
> of hacky, but it does have the advantage of working even when the -real-
> write bit isn't set due to "maybe_mkwrite()". If it forces the s390 people 
> to add some more hacks for their strange VM, so be it..

I'll concentrate on this for now.  s390 used to have the same semantics
as everyone else, they made a conscious choice to diverge, and keep dirty
bit in separate array indexed by struct page, and page_test_and_clear_dirty
macro they use instead of clearing pte_dirty.

It works all right, and I don't think it will prevent us communicating
between maybe_mkwrite and get_user_pages by a pte flag that would be
the usual pte_dirty on every other architecture.  Just need to be
careful to handle the right one right.

Hugh

  reply	other threads:[~2005-08-01 21:07 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050801032258.A465C180EC0@magilla.sf.frob.com>
2005-08-01  8:21 ` Nick Piggin
2005-08-01  9:19   ` Ingo Molnar
2005-08-01  9:27     ` Nick Piggin
2005-08-01 10:15       ` Ingo Molnar
2005-08-01 10:57         ` Nick Piggin
2005-08-01 19:43           ` Hugh Dickins
2005-08-01 20:08             ` Linus Torvalds
2005-08-01 21:06               ` Hugh Dickins [this message]
2005-08-01 21:51                 ` Linus Torvalds
2005-08-01 22:01                   ` Linus Torvalds
2005-08-02 12:01                     ` Martin Schwidefsky
2005-08-02 12:26                       ` Hugh Dickins
2005-08-02 12:28                         ` Nick Piggin
2005-08-02 15:19                         ` Martin Schwidefsky
2005-08-02 15:30                       ` Linus Torvalds
2005-08-02 16:03                         ` Hugh Dickins
2005-08-02 16:25                           ` Linus Torvalds
2005-08-02 17:02                             ` Linus Torvalds
2005-08-02 17:27                               ` Hugh Dickins
2005-08-02 17:21                             ` Hugh Dickins
2005-08-02 18:47                               ` Linus Torvalds
2005-08-02 19:20                                 ` Hugh Dickins
2005-08-02 19:54                                   ` Linus Torvalds
2005-08-02 20:55                                     ` Hugh Dickins
2005-08-03 10:24                                       ` Nick Piggin
2005-08-03 11:47                                         ` Hugh Dickins
2005-08-03 12:13                                           ` Nick Piggin
2005-08-03 16:12                                         ` Linus Torvalds
2005-08-03 16:39                                           ` Linus Torvalds
2005-08-03 16:42                                             ` Linus Torvalds
2005-08-03 17:12                                           ` Hugh Dickins
2005-08-03 23:03                                           ` Nick Piggin
2005-08-04 14:14                                           ` Alexander Nyberg
2005-08-04 14:30                                             ` Nick Piggin
2005-08-04 15:00                                               ` Alexander Nyberg
2005-08-04 15:35                                                 ` Hugh Dickins
2005-08-04 16:32                                                   ` Russell King
2005-08-04 15:36                                                 ` Linus Torvalds
2005-08-04 16:29                                               ` Russell King
2005-08-03 10:24                                       ` Martin Schwidefsky
2005-08-03 11:57                                         ` Hugh Dickins
2005-08-02 16:44                         ` Martin Schwidefsky
2005-08-01 15:42   ` Linus Torvalds
2005-08-01 18:18     ` Linus Torvalds
2005-08-03  8:24       ` Robin Holt
2005-08-03 11:31         ` Hugh Dickins
2005-08-04 11:48           ` Robin Holt
2005-08-04 13:04             ` Hugh Dickins
2005-08-01 19:29     ` Hugh Dickins
2005-08-01 19:48       ` Linus Torvalds
2005-08-02  8:07         ` Martin Schwidefsky
2005-08-01 19:57       ` Andrew Morton
2005-08-01 20:16         ` Linus Torvalds
2005-08-02  0:14     ` Nick Piggin
2005-08-02  1:27     ` Nick Piggin
2005-08-02  3:45       ` Linus Torvalds
2005-08-02  4:25         ` Nick Piggin
2005-08-02  4:35           ` Linus Torvalds
2005-08-01 20:03   ` Hugh Dickins
2005-08-01 20:12     ` Andrew Morton
2005-08-01 20:26       ` Linus Torvalds
2005-08-01 20:51       ` Hugh Dickins
2005-08-02 14:02 Dan Higgins

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=Pine.LNX.4.61.0508012153570.6323@goblin.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=akpm@osdl.org \
    --cc=holt@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=nickpiggin@yahoo.com.au \
    --cc=roland@redhat.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®