error: can't mmap pool

Callaghan, Brian Callaghan@aafes.com
Thu May 16 16:39:01 2002


This did appear to do the trick.  Thank you-- 

Brian

-----Original Message-----
From: Werner Koch [mailto:wk@gnupg.org]
Sent: Thursday, May 16, 2002 2:15 AM
To: gnupg-users@gnupg.org
Subject: Re: error: can't mmap pool


On Wed, 15 May 2002 14:59:03 -0500, Callaghan, Brian said:

> I started trying with 1.0.7 and will go back and retry 1.0.6 am also
seeing
> if I can get it to run on AIX.

No need to go back, I just checked that the code did not change from
1.0.6.

I'd appreciate to see an strace or replace the function 
util/secmem.c:init_pool with that instrumented code:


static void
init_pool( size_t n)
{
    size_t pgsize;

    poolsize = n;

    if( disable_secmem )
	log_bug("secure memory is disabled");

  #ifdef HAVE_GETPAGESIZE
    pgsize = getpagesize();
  #else
    pgsize = 4096;
  #endif

  #if HAVE_MMAP
    poolsize = (poolsize + pgsize -1 ) & ~(pgsize-1);
    #ifdef MAP_ANONYMOUS
       log_debug ("secmem: using anonymous mapping (%lu,%lu,%d,%d)\n",
                   (unsigned long)pgsize,
                   (unsigned long)poolsize, MAP_PRIVATE, MAP_ANONYMOUS);
       pool = mmap( 0, poolsize, PROT_READ|PROT_WRITE,
				 MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
    #else /* map /dev/zero instead */
    {	int fd;

	fd = open("/dev/zero", O_RDWR);
	if( fd == -1 ) {
	    log_error("can't open /dev/zero: %s\n", strerror(errno) );
	    pool = (void*)-1;
	}
	else {
            log_debug ("secmem: using /dev/zero mapping (%lu,%lu,%d,%d)\n",
                       (unsigned long)pgsize,
                       (unsigned long)poolsize, MAP_PRIVATE, fd);
	    pool = mmap( 0, poolsize, PROT_READ|PROT_WRITE,
				      MAP_PRIVATE, fd, 0);
	}
    }
    #endif
    if( pool == (void*)-1 )
	log_info("can't mmap pool of %u bytes: %s - using malloc\n",
			    (unsigned)poolsize, strerror(errno));
    else {
	pool_is_mmapped = 1;
	pool_okay = 1;
    }

  #endif
    if( !pool_okay ) {
	pool = malloc( poolsize );
	if( !pool )
	    log_fatal("can't allocate memory pool of %u bytes\n",
						       (unsigned)poolsize);
	else
	    pool_okay = 1;
    }
    lock_pool( pool, poolsize );
    poollen = 0;
}
 


  Werner


_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users