On Tue, Jun 17, 2008 at 19:25, Lucian Adrian Grijincu
<
lucian.grijincu@...> wrote:
> On Tue, Jun 17, 2008 at 16:40, William A. Rowe, Jr. <
wrowe@...> wrote:
>> Candidates will be up at
http://apr.apache.org/dev/dist/ once the sync
>> happens within the hour... vote away;
> A Cell Blade system: Linux 2.6.22-5.20070920bsc #1 SMP Tue Sep 25
> 10:49:16 CEST 2007 ppc64 ppc64 ppc64 GNU/Linux
>
>
>> [-1] Release apr 1.3.2 as GA
> -bash-3.2$ ./testall testlfs
> testlfs : |Segmentation fault
It seems that in `apr_mmap_create` on this system `mmap` returns
MAP_FAILED == (void *)-1 but does not set `errno` to an appropriate
value:
│133 mm = mmap(NULL, size, native_flags, MAP_SHARED,
file->filedes, offset);
│134
│135 if (mm == (void *)-1) {
│136 /* we failed to get an mmap'd file... */
│137 *new = NULL;
>│138 return errno;
│139 }
(gdb) print mm
$2 = (void *) 0xffffffff
(gdb) print errno
$5 = 0
Should we check whether `errno` is 0 and if it is should we return a
default error?
Because `apr_mmap_create` returns errno=0=APR_SUCCESS the tests
believe that `map` is set to an appropriate value and then proceed to
dereference it:
│265 APR_ASSERT_SUCCESS(tc, "mmap 8GB file",
│266 apr_mmap_create(&map, fh, off, len,
APR_MMAP_READ, p));
│267
│268 APR_ASSERT_SUCCESS(tc, "close file", apr_file_close(fh));
│269
>│270 ABTS_ASSERT(tc, "mapped a 16K block", map->size == len);
(gdb) print map
$8 = (apr_mmap_t *) 0x0
(gdb) n
Program received signal SIGSEGV, Segmentation fault.
0x10023aa4 in test_mmap (tc=0xffe4f73c, data=0x0) at testlfs.c:270
--
Lucian