This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug in mmap()


Hi all,

An issue in my code reveals a bug in mmap():
/lib/libc.so.6.1 Linux/alpha 2.6.13.2

My mapping descriptor structure shows this:

(gdb) print *pMI
$2 = {txt_data = 0x2000001c000, txt_size = 8192, txt_full_size = 16384,
 txt_fd = 7, txt_zero_fd = -1, txt_errno = 0, txt_prot = 0, txt_flags = 0,
 txt_alloc = 0}

Immediately before this call:

       pNuls = mmap(
               (void*)(((char*)pMI->txt_data) + pMI->txt_size),
               pgsz,
               PROT_READ|PROT_WRITE,
               MAP_ANONYMOUS|MAP_FIXED|MAP_SHARED, 0, 0 );

The address passed is:

(gdb) print 0x2000001c000+8192
$5 = 0x2000001e000

It seg faults instead of returning ((void*)-1).

So, the "|MAP_SHARED" dinkleberry is left over from the copied text
where I am mapping a real file.  Anyway, his call should either work
or return ((void*)-1).  Not seg fault.  Handling a seg fault is
painful.  This could be a kernel issue, of course, but libc is
between my code and there, so I am reporting it to you....Thanks - Bruce


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]