Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Mar 2010 16:06:10 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Alexander Best <alexbestms@wwu.de>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: [patch] somebody please fix this outstanding mmap(2) bug
Message-ID:  <201003221606.10924.jhb@freebsd.org>
In-Reply-To: <permail-201003221946531e86ffa800005027-a_best01@message-id.uni-muenster.de>
References:  <permail-201003221946531e86ffa800005027-a_best01@message-id.uni-muenster.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 22 March 2010 3:46:53 pm Alexander Best wrote:
> John Baldwin schrieb am 2010-03-22:
> > On Monday 22 March 2010 11:07:43 am Alexander Best wrote:
> > > could somebody please commit this patch? it's been around forever
> > > (2003 or
> > > 2004) and fixes mmap so the offset argument is being ignored when
> > > MAP_ANON
> > is
> > > defined (just like the mmap(2) manual says). right now the offset
> > > argument
> > is
> > > being taken into account although MAP_ANON is set!!!
> 
> > > the pr is kern/71258 (including a little c app to demonstrate the
> > > bug)
> 
> > > i've also sent a followup patch to the pr which returns EINVAL if
> > > the offset
> > > is non zero and MAP_ANON is set, but i guess that might break some
> > > code.
> 
> > I think we should go the EINVAL route, and I will commit the patch
> > you did to
> > add that.
> 
> thanks. :) i've checked what posix sais about this and since it doesn't know
> MAP_ANON there's no real rule for this case. the only thing that comes close
> is:
> 
> "The mmap() function may fail if:
> 
> [EINVAL]
> The addr argument (if MAP_FIXED was specified) or off is not a multiple of the
> page size as returned by sysconf(), or is considered invalid by the
> implementation."

Yes, the 'considered invalid by the implementation' is the bit I'm claiming.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003221606.10924.jhb>