From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4853 invoked by alias); 8 Sep 2003 22:33:31 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 4841 invoked from network); 8 Sep 2003 22:33:30 -0000 Received: from unknown (HELO lamaster.com) (208.234.14.68) by sources.redhat.com with SMTP; 8 Sep 2003 22:33:30 -0000 Received: from prime-analytics.com ([209.104.16.58]) by lamaster.com (8.12.9/8.12.9) with ESMTP id h88MXS9p005344 for ; Mon, 8 Sep 2003 18:33:28 -0400 Message-ID: <3F5D0343.60300@prime-analytics.com> Date: Mon, 08 Sep 2003 22:33:00 -0000 From: John Joganic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030612 X-Accept-Language: en-us, en MIME-Version: 1.0 To: cygwin@cygwin.com Subject: similar crash in mmap for 1.5.3-1 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-09/txt/msg00552.txt.bz2 Previous posts described a bug in mmap called via malloc. I am seeing a bug in mmap itself. The following test does not map large amounts of memory, nor does it leak. It crashes however, after 4193 (0x1061) iterations every time. Like the malloc crash, the call stack references strdup, and in this case calloc as well. On a Linux box, this program runs to completion without a hitch. Thanks! -John fail.c: #include #include #include #include #include int main(int argc, char **argv) { int i, fd; void *p; char buf[1024] = { 0 }; fd = open("test.dat",O_CREAT|O_RDWR,0666); if (fd < 0) { perror("failed to open"); exit(1); } write(fd,buf,1024); for (i=0; i<10000; ++i) { fprintf(stderr,"%d ",i); p = mmap(NULL,1024,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0); if (!p) { perror("failed mmap"); exit(1); } fprintf(stderr,"=> %p\n",p); munmap(p,1024); } printf("success\n"); close(fd); return 0; } The result is: ... 4186 => 0x3f0000 4187 => 0x3f0000 4188 => 0x3f0000 4189 => 0x3f0000 4190 => 0x3f0000 4191 => 0x3f0000 4192 => 0x3f0000 4193 4 [main] fail 3024 cmalloc: cmalloc returned NULL Program received signal SIGSEGV, Segmentation fault. 0x6103f1d9 in strdup () from /usr/bin/cygwin1.dll (gdb) bt #0 0x6103f1d9 in strdup () from /usr/bin/cygwin1.dll #1 0x6103fcc2 in mmap64 () from /usr/bin/cygwin1.dll #2 0x004011d6 in main () (gdb) -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/