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

Sean Conner sean at conman.org
Sun Jul 28 05:04:46 EST 2002


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

--- 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__);




More information about the openssh-unix-dev mailing list