mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: mremap() use is racy
Date: Wed, 24 Aug 2005 00:46:27 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.61.0508240037430.12750@goblin.wat.veritas.com> (raw)
In-Reply-To: <430B9E45.3080107@redhat.com>

On Tue, 23 Aug 2005, Ulrich Drepper wrote:
> Linus Torvalds wrote:
> > Actually, it should be pretty much as valid as using mremap - ie it works 
> > on Linux. 
> > 
> > Especially if you use MAP_SHARED, you don't even need to mprotect 
> > anything: you'll get a nice SIGBUS if you ever try to access past the last 
> > page that maps the file.
> 
> If you guarantee this (and test for this) it's fine with me.  The POSIX
> spec explicitly leaves this undefined and requiring to use mremap()
> would be a nice way to work around this without allowing the
> introduction of undefined behavior into programs.  I probably would
> prefer to use mremap() since this makes it clear what should happen but
> I can live with using the too-large mapping.

I don't have spec to hand to quote, but at least 10 years ago the SIGBUS
beyond end of file was required behaviour, on both MAP_SHARED and more
surprisingly MAP_PRIVATE mappings of a file.  Well, you don't get SIGBUS
on any part of the page that covers the end of the file: perhaps what
you read as undefined in the spec is addressing that tail page issue.

We guarantee it: it's a kernel bug if it doesn't work.

Hugh

  reply	other threads:[~2005-08-23 23:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-23 19:53 Ulrich Drepper
2005-08-23 20:45 ` Hugh Dickins
2005-08-23 20:56   ` Ulrich Drepper
2005-08-23 21:28     ` Linus Torvalds
2005-08-23 22:08       ` Ulrich Drepper
2005-08-23 23:46         ` Hugh Dickins [this message]
2005-08-24  0:08         ` Linus Torvalds
2005-08-24 12:00           ` Hugh Dickins

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.0508240037430.12750@goblin.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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®