Patch to OpenSSH-3.4p1/monitor_mm.c for Linux 2.0

Wojtek Pilorz wpilorz at bdk.pl
Mon Jul 29 22:31:55 EST 2002


On Sat, 27 Jul 2002, Sean Conner wrote:

> Date: Sat, 27 Jul 2002 15:04:46 -0400 (EDT)
> From: Sean Conner <sean at conman.org>
> To: openssh-unix-dev at mindrot.org
> Subject: Patch to OpenSSH-3.4p1/monitor_mm.c for Linux 2.0
> 
> 
> I had to modify the file monitor_mm.c to get the privledge separation to
> work for Linux 2.0.36 (and above) and am passing on the patch to you; if
> there is a better place to send this, please let me know.  I've included a
> new #define (USE_MMAP_DEV_ZERO) to select this patch, but am not including
> the patch to config.h---if there's a better name for it, please, by all
> means, change it.
> 
>   Thanks for your time and consideration.
> 
>   Sean
You do not ever close fh; is that intentional?

Best regards,

Wojtek


> 
> --- openssh-3.4p1/monitor_mm.c	Tue Jun 25 20:29:03 2002
> +++ openssh-3.4p1.new/monitor_mm.c	Fri Jul 26 03:00:35 2002
> @@ -85,10 +85,24 @@
>  	mm->mmalloc = mmalloc;
>  
>  #ifdef HAVE_MMAP_ANON_SHARED
> +#  ifdef USE_MMAP_DEV_ZERO
> +	{
> +	  int fh;
> +
> +	  fh = open("/dev/zero",O_RDWR);
> +	  if (fh == -1)
> +	  	fatal("mmap(`/dev/zero'): %s",strerror(errno));
> +	
> +	  address = mmap(NULL,size,PROT_WRITE|PROT_READ,MAP_PRIVATE,fh,0);
> +	  if (address == MAP_FAILED)
> +	  	fatal("mmap(%lu,%d): %s",(u_long)size,fh,strerror(errno));
> +	}
> +#  else
>  	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));
> +#  endif
>  #else
>  	fatal("%s: UsePrivilegeSeparation=yes and Compression=yes not supported",
>  	    __func__);
> 
> _______________________________________________
> openssh-unix-dev at mindrot.org mailing list
> http://www.mindrot.org/mailman/listinfo/openssh-unix-dev
> 




More information about the openssh-unix-dev mailing list