3.3p1 patch for Solaris 2.6

Ben Lindstrom mouring at etoh.eviladmin.org
Wed Jun 26 01:13:49 EST 2002


Even if it's more of a moving target it would be easier if you did this
against the current CVS or a newer snapshot.

Also this will fail under Linux 2.2.  So we still need to test if that
method works in configure.ac.

Are we comfortable getting such a beast done by at a reasonable time so I
can call for Linux 2.2 and Solaris testing before I go to bed?

I'm not sure I'm comfortable.  Mainly because I can't test it outside of
2.5.1 solaris.

- Ben



On Wed, 26 Jun 2002 itojun at iijlab.net wrote:

> >> 	here's a patch to 3.3p1 for Solaris 2.6 - it does not handle
> >> 	mmap() with fd = -1.  does it look okay?
> >That looks good.  Any reason why you do not check the open result,
> >too.  I mean I know mmap is going to fail with an invalid fd, but
> >still.
>
> 	i just wasn't careful enough.  here's a new one.
>
> itojun
>
>
> --- work.i386/openssh-3.3p1/servconf.c-	Tue Jun 25 23:43:22 2002
> +++ work.i386/openssh-3.3p1/servconf.c	Tue Jun 25 23:43:33 2002
> @@ -257,7 +257,7 @@
>  	if (use_privsep == -1)
>  		use_privsep = 1;
>
> -#if !defined(HAVE_MMAP) || !defined(MAP_ANON)
> +#if !defined(HAVE_MMAP)
>  	if (use_privsep && options->compression == 1) {
>  		error("This platform does not support both privilege "
>  		    "separation and compression");
> --- work.i386/openssh-3.3p1/monitor_mm.c-	Tue Jun 25 23:42:02 2002
> +++ work.i386/openssh-3.3p1/monitor_mm.c	Wed Jun 26 00:05:42 2002
> @@ -71,6 +71,9 @@
>  {
>  	void *address;
>  	struct mm_master *mm;
> +#if defined(HAVE_MMAP) && !defined(MAP_ANON)
> +	int fd;
> +#endif
>
>  	if (mmalloc == NULL)
>  		mm = xmalloc(sizeof(struct mm_master));
> @@ -87,6 +90,15 @@
>  #if  defined(HAVE_MMAP) && defined(MAP_ANON)
>  	address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED,
>  	    -1, 0);
> +	if (address == MAP_FAILED)
> +		fatal("mmap(%lu): %s", (u_long)size, strerror(errno));
> +#elif defined(HAVE_MMAP) && !defined(MAP_ANON)
> +	fd = open("/dev/zero", O_RDWR);
> +	if (fd < 0)
> +		fatal("open(/dev/zero): %s", strerror(errno));
> +	address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED,
> +	    fd, 0);
> +	close(fd);
>  	if (address == MAP_FAILED)
>  		fatal("mmap(%lu): %s", (u_long)size, strerror(errno));
>  #else
>




More information about the openssh-unix-dev mailing list