privsep patch, Please test

Tim Rice tim at multitalents.net
Thu May 30 13:25:56 EST 2002


On Wed, 29 May 2002, Ben Lindstrom wrote:

>
> Can you make the following change to just before the mmap()..  Thanks.
>
>         if (address == MAP_FAILED)
> -                fatal("mmap(%lu)", (u_long)size);
> +                fatal("mmap(%lu) %s", (u_long)size, strerror(errno));
>
> I need to know what mmap is setting errno to.  Otherwise I'm making a
> guess in the dark (which is 2.2 Linux mmap is fucked, or you have a
> version of glibc that has a bad mmap).

strace tells the story
open("/dev/zero", O_RDWR|O_LARGEFILE)   = 8
mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 8, 0) = -1 EINVAL (Invalid a
rgument)

The man page says
    EINVAL We don't like start or length  or  offset.   (E.g.,
           they  are  too  large, or not aligned on a PAGESIZE
           boundary.)

I don't understand why it's happy with MAP_PRIVATE but doesn't like
MAP_SHARED.


-- 
Tim Rice				Multitalents	(707) 887-1469
tim at multitalents.net


>
> - Ben
>
> On Thu, 30 May 2002, Mathias Koerber wrote:
>
> >
> >
> > > -----Original Message-----
> > > From: Tim Rice [mailto:tim at multitalents.net]
> > > Sent: Thursday, May 30, 2002 10:49 AM
> > > To: Mathias Koerber
> > > Cc: OpenSSH Development
> > > Subject: RE: privsep patch, Please test
> > >
> > >
> > > On Thu, 30 May 2002, Mathias Koerber wrote:
> > >
> > > > > This was talked about a few posts ago.  Go to where the
> > > mmap() call is for
> > > > > the alternation version and change MAP_PRIVATE to MAP_SHARED
> > > >
> > > > If I do that (after applying Tim's privsep.patch),thusly:
> > > >
> > > >  #ifdef HAVE_MMAP
> > > >  #ifdef HAVE_WORKING_MAP_ANONYMOUS
> > > >          address = mmap(NULL, size, PROT_WRITE|PROT_READ,
> > > > MAP_ANON|MAP_SHARED,
> > > >              -1, 0);
> > > >  #else
> > > > +        address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_PRIVATE,
> > > > -        address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED,
> > >
> > > This looks backwards. My patch had,
> > >        address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_PRIVATE,
> > > should have had,
> > >         address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED,
> >
> > That's the change I made based on Ben's suggestion..
> >
> > >
> > > What platform are you on?
> >
> > Linux 2.2.13
> >
> > >
> > >
> > _______________________________________________
> > openssh-unix-dev at mindrot.org mailing list
> > http://www.mindrot.org/mailman/listinfo/openssh-unix-dev
> >
>

-- 
Tim Rice				Multitalents	(707) 887-1469
tim at multitalents.net





More information about the openssh-unix-dev mailing list