The following is just a simple 'if ANON|SHARE is broken, disable
compression'. We don't have time for fancy stuff until we have time
for
long term testing.
I have one friend of mine testing this. Can I get a few other people to
test. This is against --current, but maybe work against 3.3p1. Unsure.
BTW.. those on NeXT platform (if you have autoreconf) should also test
this. this should solve your problem also.
- Ben
Index: acconfig.h
==================================================================RCS file:
/var/cvs/openssh/acconfig.h,v
retrieving revision 1.139
diff -u -r1.139 acconfig.h
--- acconfig.h 24 Jun 2002 16:26:49 -0000 1.139
+++ acconfig.h 25 Jun 2002 00:15:54 -0000
@@ -355,6 +355,9 @@
/* Path that unprivileged child will chroot() to in privep mode */
#undef PRIVSEP_PATH
+/* Define if you have the `mmap' function that supports MAP_ANON|SHARED */
+#undef HAVE_MMAP_ANON_SHARED
+
@BOTTOM@
/* ******************* Shouldn't need to edit below this line
************** */
Index: configure.ac
==================================================================RCS file:
/var/cvs/openssh/configure.ac,v
retrieving revision 1.69
diff -u -r1.69 configure.ac
--- configure.ac 24 Jun 2002 16:26:49 -0000 1.69
+++ configure.ac 25 Jun 2002 00:16:06 -0000
@@ -574,6 +574,30 @@
socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
+if test $ac_cv_func_mmap = yes ; then
+AC_MSG_CHECKING([for mmap anon shared])
+AC_TRY_RUN(
+ [
+#include <stdio.h>
+#include <sys/mman.h>
+#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
+#define MAP_ANON MAP_ANONYMOUS
+#endif
+main() { char *p;
+p = (char *) mmap(NULL, 10, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, -1, 0);
+if (p == (char *)-1)
+ exit(1);
+exit(0);
+}
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_MMAP_ANON_SHARED)
+ ],
+ [ AC_MSG_RESULT(no) ]
+)
+fi
+
dnl IRIX and Solaris 2.5.1 have dirname() in libgen
AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
AC_CHECK_LIB(gen, dirname,[
Index: monitor_mm.c
==================================================================RCS file:
/var/cvs/openssh/monitor_mm.c,v
retrieving revision 1.10
diff -u -r1.10 monitor_mm.c
--- monitor_mm.c 7 Jun 2002 01:57:25 -0000 1.10
+++ monitor_mm.c 25 Jun 2002 00:16:09 -0000
@@ -84,13 +84,11 @@
*/
mm->mmalloc = mmalloc;
-#if defined(HAVE_MMAP) && defined(MAP_ANON)
+#ifdef HAVE_MMAP_ANON_SHARED
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));
#else
- fatal("%s: UsePrivilegeSeparation=yes not supported",
+ fatal("%s: UsePrivilegeSeparation=yes and Compression=yes not
supported",
__func__);
#endif
Index: servconf.c
==================================================================RCS file:
/var/cvs/openssh/servconf.c,v
retrieving revision 1.92
diff -u -r1.92 servconf.c
--- servconf.c 23 Jun 2002 21:29:24 -0000 1.92
+++ servconf.c 25 Jun 2002 00:16:12 -0000
@@ -257,7 +257,7 @@
if (use_privsep == -1)
use_privsep = 1;
-#if !defined(HAVE_MMAP) || !defined(MAP_ANON)
+#if !defined(HAVE_MMAP_ANON_SHARED)
if (use_privsep && options->compression == 1) {
error("This platform does not support both privilege "
"separation and compression");
Otherwise: http://www.pconline.com/~mouring/openssh.tar.gz is the complete --head w/ the patch and a configure. - Ben On Mon, 24 Jun 2002, Ben Lindstrom wrote:> > The following is just a simple 'if ANON|SHARE is broken, disable > compression'. We don't have time for fancy stuff until we have time for > long term testing. > > I have one friend of mine testing this. Can I get a few other people to > test. This is against --current, but maybe work against 3.3p1. Unsure. > > BTW.. those on NeXT platform (if you have autoreconf) should also test > this. this should solve your problem also. > > > - Ben > > Index: acconfig.h > ==================================================================> RCS file: /var/cvs/openssh/acconfig.h,v > retrieving revision 1.139 > diff -u -r1.139 acconfig.h > --- acconfig.h 24 Jun 2002 16:26:49 -0000 1.139 > +++ acconfig.h 25 Jun 2002 00:15:54 -0000 > @@ -355,6 +355,9 @@ > /* Path that unprivileged child will chroot() to in privep mode */ > #undef PRIVSEP_PATH > > +/* Define if you have the `mmap' function that supports MAP_ANON|SHARED */ > +#undef HAVE_MMAP_ANON_SHARED > + > @BOTTOM@ > > /* ******************* Shouldn't need to edit below this line ************** */ > Index: configure.ac > ==================================================================> RCS file: /var/cvs/openssh/configure.ac,v > retrieving revision 1.69 > diff -u -r1.69 configure.ac > --- configure.ac 24 Jun 2002 16:26:49 -0000 1.69 > +++ configure.ac 25 Jun 2002 00:16:06 -0000 > @@ -574,6 +574,30 @@ > socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \ > truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty) > > +if test $ac_cv_func_mmap = yes ; then > +AC_MSG_CHECKING([for mmap anon shared]) > +AC_TRY_RUN( > + [ > +#include <stdio.h> > +#include <sys/mman.h> > +#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) > +#define MAP_ANON MAP_ANONYMOUS > +#endif > +main() { char *p; > +p = (char *) mmap(NULL, 10, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, -1, 0); > +if (p == (char *)-1) > + exit(1); > +exit(0); > +} > + ], > + [ > + AC_MSG_RESULT(yes) > + AC_DEFINE(HAVE_MMAP_ANON_SHARED) > + ], > + [ AC_MSG_RESULT(no) ] > +) > +fi > + > dnl IRIX and Solaris 2.5.1 have dirname() in libgen > AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[ > AC_CHECK_LIB(gen, dirname,[ > Index: monitor_mm.c > ==================================================================> RCS file: /var/cvs/openssh/monitor_mm.c,v > retrieving revision 1.10 > diff -u -r1.10 monitor_mm.c > --- monitor_mm.c 7 Jun 2002 01:57:25 -0000 1.10 > +++ monitor_mm.c 25 Jun 2002 00:16:09 -0000 > @@ -84,13 +84,11 @@ > */ > mm->mmalloc = mmalloc; > > -#if defined(HAVE_MMAP) && defined(MAP_ANON) > +#ifdef HAVE_MMAP_ANON_SHARED > 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)); > #else > - fatal("%s: UsePrivilegeSeparation=yes not supported", > + fatal("%s: UsePrivilegeSeparation=yes and Compression=yes not supported", > __func__); > #endif > > Index: servconf.c > ==================================================================> RCS file: /var/cvs/openssh/servconf.c,v > retrieving revision 1.92 > diff -u -r1.92 servconf.c > --- servconf.c 23 Jun 2002 21:29:24 -0000 1.92 > +++ servconf.c 25 Jun 2002 00:16:12 -0000 > @@ -257,7 +257,7 @@ > if (use_privsep == -1) > use_privsep = 1; > > -#if !defined(HAVE_MMAP) || !defined(MAP_ANON) > +#if !defined(HAVE_MMAP_ANON_SHARED) > if (use_privsep && options->compression == 1) { > error("This platform does not support both privilege " > "separation and compression"); > > _______________________________________________ > openssh-unix-dev at mindrot.org mailing list > http://www.mindrot.org/mailman/listinfo/openssh-unix-dev >
On Mon, 24 Jun 2002, Ben Lindstrom wrote:> > The following is just a simple 'if ANON|SHARE is broken, disable > compression'. We don't have time for fancy stuff until we have time for > long term testing. > > I have one friend of mine testing this. Can I get a few other people to > test. This is against --current, but maybe work against 3.3p1. Unsure. > > BTW.. those on NeXT platform (if you have autoreconf) should also test > this. this should solve your problem also. > > > - Ben[patch snipped] I think we should put the /dev/zero, SHARED test in too. That would allow Solaris < 8, & UnixWare 2.x, and maybe others to use compression. The two PRIVATE tests are not needed now. -- Tim Rice Multitalents (707) 887-1469 tim at multitalents.net